ReactOS 0.4.16-dev-125-g798ea90
engwindow.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for engwindow.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (EngWnd)
 
VOID FASTCALL IntEngWndCallChangeProc (_In_ EWNDOBJ *Clip, _In_ FLONG flChanged)
 
BOOLEAN FASTCALL IntEngWndUpdateClipObj (EWNDOBJ *Clip, PWND Window)
 
VOID FASTCALL IntEngWindowChanged (_In_ PWND Window, _In_ FLONG flChanged)
 
WNDOBJ *APIENTRY EngCreateWnd (SURFOBJ *pso, HWND hWnd, WNDOBJCHANGEPROC pfn, FLONG fl, int iPixelFormat)
 
VOID APIENTRY EngDeleteWnd (IN WNDOBJ *pwo)
 
BOOL APIENTRY WNDOBJ_bEnum (IN WNDOBJ *pwo, IN ULONG cj, OUT ULONG *pul)
 
ULONG APIENTRY WNDOBJ_cEnumStart (IN WNDOBJ *pwo, IN ULONG iType, IN ULONG iDirection, IN ULONG cLimit)
 
VOID APIENTRY WNDOBJ_vSetConsumer (IN WNDOBJ *pwo, IN PVOID pvConsumer)
 

Variables

INT gcountPWO = 0
 

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( EngWnd  )

◆ EngCreateWnd()

WNDOBJ *APIENTRY EngCreateWnd ( SURFOBJ pso,
HWND  hWnd,
WNDOBJCHANGEPROC  pfn,
FLONG  fl,
int  iPixelFormat 
)

Definition at line 145 of file engwindow.c.

151{
152 EWNDOBJ *Clip = NULL;
153 WNDOBJ *WndObjUser = NULL;
154 PWND Window;
155
156 TRACE("EngCreateWnd: pso = 0x%p, hwnd = 0x%p, pfn = 0x%p, fl = 0x%lx, pixfmt = %d\n",
157 pso, hWnd, pfn, fl, iPixelFormat);
158
160
162 {
163 FIXME("Unsupported flags: 0x%lx\n", fl & ~(WO_RGN_CLIENT_DELTA | WO_RGN_CLIENT | WO_RGN_SURFACE_DELTA | WO_RGN_SURFACE));
164 }
165
166 /* Get window object */
168 if (Window == NULL)
169 {
170 goto Exit;
171 }
172
173 /* Create WNDOBJ */
175 if (Clip == NULL)
176 {
177 ERR("Failed to allocate memory for a WND structure!\n");
178 goto Exit;
179 }
181
182 /* Fill the clipobj */
183 if (!IntEngWndUpdateClipObj(Clip, Window))
184 {
185 EngFreeMem(Clip);
186 goto Exit;
187 }
188
189 /* Fill user object */
190 WndObjUser = (WNDOBJ *)Clip;
191 WndObjUser->psoOwner = pso;
192 WndObjUser->pvConsumer = NULL;
193
194 /* Fill internal object */
195 Clip->Hwnd = hWnd;
196 Clip->ChangeProc = pfn;
197 /* Keep track of relevant flags */
199 if (fl & WO_SPRITE_NOTIFY)
201 /* Those should always be sent */
202 Clip->Flags |= WOC_CHANGED | WOC_DELETE;
204
205 /* associate object with window */
206 UserSetProp(Window, AtomWndObj, Clip, TRUE);
207 ++gcountPWO;
208
209 TRACE("EngCreateWnd: SUCCESS: %p!\n", WndObjUser);
210
211Exit:
212 UserLeave();
213 return WndObjUser;
214}
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
INT gcountPWO
Definition: engwindow.c:13
BOOLEAN FASTCALL IntEngWndUpdateClipObj(EWNDOBJ *Clip, PWND Window)
Definition: engwindow.c:51
ATOM AtomWndObj
Definition: ntuser.c:20
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
#define EngFreeMem
Definition: polytest.cpp:56
#define FL_ZERO_MEMORY
Definition: polytest.cpp:58
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
static void Exit(void)
Definition: sock.c:1330
#define TRACE(s)
Definition: solgame.cpp:4
Definition: window.c:28
WNDOBJCHANGEPROC ChangeProc
Definition: engobjects.h:102
int PixelFormat
Definition: engobjects.h:104
HWND Hwnd
Definition: engobjects.h:101
FLONG Flags
Definition: engobjects.h:103
PVOID pvConsumer
Definition: winddi.h:1228
SURFOBJ * psoOwner
Definition: winddi.h:1230
Definition: ntuser.h:694
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
VOID FASTCALL IntEngInitClipObj(XCLIPOBJ *Clip)
Definition: clip.c:158
#define GDITAG_WNDOBJ
Definition: tags.h:180
#define WOC_SPRITE_OVERLAP
Definition: winddi.h:1271
_In_ HANDLE _In_ SURFOBJ * pso
Definition: winddi.h:3665
_In_ FLONG fl
Definition: winddi.h:1279
#define WO_DRAW_NOTIFY
Definition: winddi.h:1599
_In_ LONG iPixelFormat
Definition: winddi.h:3488
#define WO_RGN_WINDOW
Definition: winddi.h:1598
#define WO_RGN_DESKTOP_COORD
Definition: winddi.h:1601
#define WOC_SPRITE_NO_OVERLAP
Definition: winddi.h:1272
#define WO_RGN_SURFACE_DELTA
Definition: winddi.h:1595
#define WO_RGN_CLIENT
Definition: winddi.h:1594
#define WOC_CHANGED
Definition: winddi.h:1268
#define WOC_DELETE
Definition: winddi.h:1269
#define WO_SPRITE_NOTIFY
Definition: winddi.h:1600
#define WO_RGN_UPDATE_ALL
Definition: winddi.h:1597
#define WO_RGN_SURFACE
Definition: winddi.h:1596
#define WO_RGN_CLIENT_DELTA
Definition: winddi.h:1593

◆ EngDeleteWnd()

VOID APIENTRY EngDeleteWnd ( IN WNDOBJ pwo)

Definition at line 222 of file engwindow.c.

224{
225 EWNDOBJ* Clip = (EWNDOBJ *)pwo;//CONTAINING_RECORD(pwo, XCLIPOBJ, WndObj);
226 PWND Window;
227
228 TRACE("EngDeleteWnd: pwo = 0x%p\n", pwo);
229
231
232 /* Get window object */
234 if (Window == NULL)
235 {
236 ERR("Couldnt get window object for WndObjInt->Hwnd!!!\n");
237 }
238 else
239 {
240 /* Remove object from window */
242 }
243 --gcountPWO;
244
245 UserLeave();
246
247 /* Free resources */
249 EngFreeMem(Clip);
250}
HANDLE FASTCALL UserRemoveProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
VOID FASTCALL IntEngFreeClipResources(XCLIPOBJ *Clip)
Definition: clip.c:164
_In_ WNDOBJ * pwo
Definition: winddi.h:4147

◆ IntEngWindowChanged()

VOID FASTCALL IntEngWindowChanged ( _In_ PWND  Window,
_In_ FLONG  flChanged 
)

Definition at line 99 of file engwindow.c.

102{
103 EWNDOBJ *Clip;
104
106
108 if (!Clip)
109 {
110 return;
111 }
112
113 ASSERT(Clip->Hwnd == Window->head.h);
114 // if (Clip->pvConsumer != NULL)
115 {
116 /* Update the WNDOBJ */
117 switch (flChanged)
118 {
119 case WOC_RGN_CLIENT:
120 /* Update the clipobj and client rect of the WNDOBJ */
122 break;
123
124 case WOC_DELETE:
125 /* FIXME: Should the WNDOBJs be deleted by win32k or by the driver? */
126 break;
127 }
128
129 /* Call the change proc */
130 IntEngWndCallChangeProc(Clip, flChanged);
131
132 /* HACK: Send WOC_CHANGED after WOC_RGN_CLIENT */
133 if (flChanged == WOC_RGN_CLIENT)
134 {
136 }
137 }
138}
VOID FASTCALL IntEngWndCallChangeProc(_In_ EWNDOBJ *Clip, _In_ FLONG flChanged)
Definition: engwindow.c:20
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define ASSERT(a)
Definition: mode.c:44
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
#define WOC_RGN_CLIENT
Definition: winddi.h:1265

◆ IntEngWndCallChangeProc()

VOID FASTCALL IntEngWndCallChangeProc ( _In_ EWNDOBJ Clip,
_In_ FLONG  flChanged 
)

Definition at line 20 of file engwindow.c.

23{
24 if (Clip->ChangeProc == NULL)
25 {
26 return;
27 }
28
29 /* check flags of the WNDOBJ */
30 flChanged &= Clip->Flags;
31 if (flChanged == 0)
32 {
33 return;
34 }
35
36 TRACE("Calling WNDOBJCHANGEPROC (0x%p), Changed = 0x%x\n",
37 Clip->ChangeProc, flChanged);
38
39 /* Call the WNDOBJCHANGEPROC */
40 if (flChanged == WOC_CHANGED)
41 Clip->ChangeProc(NULL, flChanged);
42 else
43 Clip->ChangeProc((WNDOBJ *)Clip, flChanged);
44}

Referenced by IntEngWindowChanged(), and WNDOBJ_vSetConsumer().

◆ IntEngWndUpdateClipObj()

BOOLEAN FASTCALL IntEngWndUpdateClipObj ( EWNDOBJ Clip,
PWND  Window 
)

Definition at line 51 of file engwindow.c.

54{
55 PREGION visRgn;
56
57 TRACE("IntEngWndUpdateClipObj\n");
58
60 if (visRgn != NULL)
61 {
62 if (visRgn->rdh.nCount > 0)
63 {
64 IntEngUpdateClipRegion((XCLIPOBJ*)Clip, visRgn->rdh.nCount, visRgn->Buffer, &visRgn->rdh.rcBound);
65 TRACE("Created visible region with %lu rects\n", visRgn->rdh.nCount);
66 TRACE(" BoundingRect: %d, %d %d, %d\n",
67 visRgn->rdh.rcBound.left, visRgn->rdh.rcBound.top,
68 visRgn->rdh.rcBound.right, visRgn->rdh.rcBound.bottom);
69 {
70 ULONG i;
71 for (i = 0; i < visRgn->rdh.nCount; i++)
72 {
73 TRACE(" Rect #%lu: %ld,%ld %ld,%ld\n", i+1,
74 visRgn->Buffer[i].left, visRgn->Buffer[i].top,
75 visRgn->Buffer[i].right, visRgn->Buffer[i].bottom);
76 }
77 }
78 }
79 REGION_Delete(visRgn);
80 }
81 else
82 {
83 /* Fall back to client rect */
84 IntEngUpdateClipRegion((XCLIPOBJ*)Clip, 1, &Window->rcClient, &Window->rcClient);
85 }
86
87 /* Update the WNDOBJ */
88 Clip->rclClient = Window->rcClient;
89 Clip->iUniq++;
90
91 return TRUE;
92}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: region.h:8
RECTL * Buffer
Definition: region.h:16
RGNDATAHEADER rdh
Definition: region.h:15
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
uint32_t ULONG
Definition: typedefs.h:59
PREGION FASTCALL VIS_ComputeVisibleRegion(PWND Wnd, BOOLEAN ClientArea, BOOLEAN ClipChildren, BOOLEAN ClipSiblings)
Definition: vis.c:13
VOID FASTCALL IntEngUpdateClipRegion(XCLIPOBJ *Clip, ULONG count, const RECTL *pRect, const RECTL *rcBounds)
Definition: clip.c:173
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2449

Referenced by EngCreateWnd(), and IntEngWindowChanged().

◆ WNDOBJ_bEnum()

BOOL APIENTRY WNDOBJ_bEnum ( IN WNDOBJ pwo,
IN ULONG  cj,
OUT ULONG pul 
)

Definition at line 258 of file engwindow.c.

262{
263 /* Relay */
264 return CLIPOBJ_bEnum(&pwo->coClient, cj, pul);
265}
ENGAPI BOOL APIENTRY CLIPOBJ_bEnum(_In_ CLIPOBJ *pco, _In_ ULONG cj, _Out_bytecap_(cj) ULONG *pul)
Definition: clip.c:319
_In_ ULONG cj
Definition: winddi.h:3540

◆ WNDOBJ_cEnumStart()

ULONG APIENTRY WNDOBJ_cEnumStart ( IN WNDOBJ pwo,
IN ULONG  iType,
IN ULONG  iDirection,
IN ULONG  cLimit 
)

Definition at line 273 of file engwindow.c.

278{
279 /* Relay */
280 // FIXME: Should we enumerate all rectangles or not?
281 return CLIPOBJ_cEnumStart(&pwo->coClient, FALSE, iType, iDirection, cLimit);
282}
#define FALSE
Definition: types.h:117
ENGAPI ULONG APIENTRY CLIPOBJ_cEnumStart(_Inout_ CLIPOBJ *pco, _In_ BOOL bAll, _In_ ULONG iType, _In_ ULONG iDirection, _In_ ULONG cLimit)
Definition: clip.c:255
_In_ ULONG iType
Definition: winddi.h:3748

◆ WNDOBJ_vSetConsumer()

VOID APIENTRY WNDOBJ_vSetConsumer ( IN WNDOBJ pwo,
IN PVOID  pvConsumer 
)

Definition at line 290 of file engwindow.c.

293{
294 EWNDOBJ* Clip = (EWNDOBJ *)pwo;//CONTAINING_RECORD(pwo, XCLIPOBJ, WndObj);
295 BOOL Hack;
296
297 TRACE("WNDOBJ_vSetConsumer: pwo = 0x%p, pvConsumer = 0x%p\n", pwo, pvConsumer);
298
299 Hack = (pwo->pvConsumer == NULL);
300 pwo->pvConsumer = pvConsumer;
301
302 /* HACKHACKHACK
303 *
304 * MSDN says that the WNDOBJCHANGEPROC will be called with the most recent state
305 * when a WNDOBJ is created - we do it here because most drivers will need pvConsumer
306 * in the callback to identify the WNDOBJ I think.
307 *
308 * - blight
309 */
310 if (Hack)
311 {
312 FIXME("Is this hack really needed?\n");
316 }
317}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WOC_DRAWN
Definition: winddi.h:1270

Variable Documentation

◆ gcountPWO

INT gcountPWO = 0

Definition at line 13 of file engwindow.c.

Referenced by EngCreateWnd(), and EngDeleteWnd().