ReactOS 0.4.15-dev-5865-g640e228
winpos.c File Reference
#include <win32k.h>
#include <ddk/immdev.h>
Include dependency graph for winpos.c:

Go to the source code of this file.

Macros

#define MINMAX_NOSWP   (0x00010000)
 
#define SWP_EX_NOCOPY   0x0001
 
#define SWP_EX_PAINTSELF   0x0002
 
#define SWP_AGG_NOGEOMETRYCHANGE    (SWP_NOSIZE | SWP_NOCLIENTSIZE | SWP_NOZORDER)
 
#define SWP_AGG_NOPOSCHANGE    (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER)
 
#define SWP_AGG_STATUSFLAGS    (SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
 
#define SWP_AGG_NOCLIENTCHANGE    (SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
 
#define EMPTYPOINT(pt)   ((pt).x == -1 && (pt).y == -1)
 
#define PLACE_MIN   0x0001
 
#define PLACE_MAX   0x0002
 
#define PLACE_RECT   0x0004
 

Functions

 DBG_DEFAULT_CHANNEL (UserWinpos)
 
BOOL FASTCALL IntGetClientOrigin (PWND Window OPTIONAL, LPPOINT Point)
 
VOID FASTCALL IntGetClientRect (PWND Wnd, RECTL *Rect)
 
BOOL FASTCALL IntGetWindowRect (PWND Wnd, RECTL *Rect)
 
INT FASTCALL IntMapWindowPoints (PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
 
BOOL FASTCALL IntClientToScreen (PWND Wnd, LPPOINT lpPoint)
 
BOOL FASTCALL IntScreenToClient (PWND Wnd, LPPOINT lpPoint)
 
BOOL FASTCALL IsChildVisible (PWND pWnd)
 
PWND FASTCALL IntGetLastTopMostWindow (VOID)
 
VOID SelectWindowRgn (PWND Window, HRGN hRgnClip)
 
BOOL FASTCALL ActivateOtherWindowMin (PWND Wnd)
 
static BOOL FASTCALL can_activate_window (PWND Wnd OPTIONAL)
 
VOID FASTCALL co_WinPosActivateOtherWindow (PWND Wnd)
 
VOID FASTCALL WinPosInitInternalPos (PWND Wnd, RECTL *RestoreRect)
 
BOOL FASTCALL IntGetWindowPlacement (PWND Wnd, WINDOWPLACEMENT *lpwndpl)
 
static void make_rect_onscreen (RECT *rect)
 
static void make_point_onscreen (POINT *pt)
 
BOOL FASTCALL IntSetWindowPlacement (PWND Wnd, WINDOWPLACEMENT *wpl, UINT Flags)
 
UINT FASTCALL co_WinPosArrangeIconicWindows (PWND parent)
 
static VOID FASTCALL WinPosFindIconPos (PWND Window, POINT *Pos)
 
BOOL UserHasWindowEdge (DWORD Style, DWORD ExStyle)
 
VOID FASTCALL IntGetWindowBorderMeasures (PWND Wnd, UINT *cx, UINT *cy)
 
VOID UserGetWindowBorders (DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
 
DWORD IntGetWindowBorders (DWORD Style, DWORD ExStyle)
 
UINT FASTCALL co_WinPosGetMinMaxInfo (PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
 
static BOOL IntValidateParent (PWND Child, PREGION ValidateRgn)
 
static VOID FASTCALL FixClientRect (PRECTL ClientRect, PRECTL WindowRect)
 
static VOID FASTCALL get_valid_rects (RECTL *old_client, RECTL *new_client, UINT flags, RECTL *valid)
 
static LONG FASTCALL co_WinPosDoNCCALCSize (PWND Window, PWINDOWPOS WinPos, RECTL *WindowRect, RECTL *ClientRect, RECTL *validRects)
 
static BOOL FASTCALL co_WinPosDoWinPosChanging (PWND Window, PWINDOWPOS WinPos, PRECTL WindowRect, PRECTL ClientRect)
 
static HWND FASTCALL WinPosDoOwnedPopups (PWND Window, HWND hWndInsertAfter)
 
static VOID FASTCALL WinPosInternalMoveWindow (PWND Window, INT MoveX, INT MoveY)
 
static BOOL FASTCALL WinPosFixupFlags (WINDOWPOS *WinPos, PWND Wnd)
 
VOID ForceNCPaintErase (PWND Wnd, HRGN hRgn, PREGION pRgn)
 
static VOID FASTCALL IntImeWindowPosChanged (VOID)
 
BOOLEAN FASTCALL co_WinPosSetWindowPos (PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
 
LRESULT FASTCALL co_WinPosGetNonClientSize (PWND Window, RECT *WindowRect, RECT *ClientRect)
 
void FASTCALL co_WinPosSendSizeMove (PWND Wnd)
 
UINT FASTCALL co_WinPosMinMaximize (PWND Wnd, UINT ShowFlag, RECT *NewPos)
 
BOOLEAN FASTCALL co_WinPosShowWindow (PWND Wnd, INT Cmd)
 
static PWND co_WinPosSearchChildren (IN PWND ScopeWin, IN POINT *Point, IN OUT USHORT *HitTest, IN BOOL Ignore)
 
PWND APIENTRY co_WinPosWindowFromPoint (IN PWND ScopeWin, IN POINT *WinPoint, IN OUT USHORT *HitTest, IN BOOL Ignore)
 
PWND FASTCALL IntRealChildWindowFromPoint (PWND Parent, LONG x, LONG y)
 
PWND APIENTRY IntChildWindowFromPointEx (PWND Parent, LONG x, LONG y, UINT uiFlags)
 
HDWP FASTCALL IntDeferWindowPos (HDWP hdwp, HWND hwnd, HWND hwndAfter, INT x, INT y, INT cx, INT cy, UINT flags)
 
BOOL FASTCALL IntEndDeferWindowPosEx (HDWP hdwp, BOOL bAsync)
 
HWND APIENTRY NtUserChildWindowFromPointEx (HWND hwndParent, LONG x, LONG y, UINT uiFlags)
 
BOOL APIENTRY NtUserEndDeferWindowPosEx (HDWP WinPosInfo, BOOL bAsync)
 
HDWP APIENTRY NtUserDeferWindowPos (HDWP WinPosInfo, HWND Wnd, HWND WndInsertAfter, int x, int y, int cx, int cy, UINT Flags)
 
DWORD APIENTRY NtUserGetInternalWindowPos (HWND hWnd, LPRECT rectWnd, LPPOINT ptIcon)
 
BOOL APIENTRY NtUserGetWindowPlacement (HWND hWnd, WINDOWPLACEMENT *lpwndpl)
 
DWORD APIENTRY NtUserMinMaximize (HWND hWnd, UINT cmd, BOOL Hide)
 
BOOL APIENTRY NtUserMoveWindow (HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
 
HWND APIENTRY NtUserRealChildWindowFromPoint (HWND Parent, LONG x, LONG y)
 
BOOL APIENTRY NtUserSetWindowPos (HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
 
INT APIENTRY NtUserSetWindowRgn (HWND hWnd, HRGN hRgn, BOOL bRedraw)
 
DWORD APIENTRY NtUserSetInternalWindowPos (HWND hwnd, UINT showCmd, LPRECT lprect, LPPOINT lppt)
 
BOOL APIENTRY NtUserSetWindowPlacement (HWND hWnd, WINDOWPLACEMENT *lpwndpl)
 
BOOL APIENTRY NtUserShowWindowAsync (HWND hWnd, LONG nCmdShow)
 
BOOL APIENTRY NtUserShowWindow (HWND hWnd, LONG nCmdShow)
 
HWND APIENTRY NtUserWindowFromPoint (LONG X, LONG Y)
 

Macro Definition Documentation

◆ EMPTYPOINT

#define EMPTYPOINT (   pt)    ((pt).x == -1 && (pt).y == -1)

Definition at line 30 of file winpos.c.

◆ MINMAX_NOSWP

#define MINMAX_NOSWP   (0x00010000)

Definition at line 16 of file winpos.c.

◆ PLACE_MAX

#define PLACE_MAX   0x0002

Definition at line 32 of file winpos.c.

◆ PLACE_MIN

#define PLACE_MIN   0x0001

Definition at line 31 of file winpos.c.

◆ PLACE_RECT

#define PLACE_RECT   0x0004

Definition at line 33 of file winpos.c.

◆ SWP_AGG_NOCLIENTCHANGE

#define SWP_AGG_NOCLIENTCHANGE    (SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)

Definition at line 27 of file winpos.c.

◆ SWP_AGG_NOGEOMETRYCHANGE

#define SWP_AGG_NOGEOMETRYCHANGE    (SWP_NOSIZE | SWP_NOCLIENTSIZE | SWP_NOZORDER)

Definition at line 21 of file winpos.c.

◆ SWP_AGG_NOPOSCHANGE

Definition at line 23 of file winpos.c.

◆ SWP_AGG_STATUSFLAGS

Definition at line 25 of file winpos.c.

◆ SWP_EX_NOCOPY

#define SWP_EX_NOCOPY   0x0001

Definition at line 18 of file winpos.c.

◆ SWP_EX_PAINTSELF

#define SWP_EX_PAINTSELF   0x0002

Definition at line 19 of file winpos.c.

Function Documentation

◆ ActivateOtherWindowMin()

BOOL FASTCALL ActivateOtherWindowMin ( PWND  Wnd)

Definition at line 286 of file winpos.c.

287{
288 BOOL ActivePrev, FindTopWnd;
289 PWND pWndTopMost, pWndChild, pWndSetActive, pWndTemp, pWndDesk;
292
293 //ERR("AOWM 1 %p\n",Wnd->head.h);
294 ActivePrev = (pti->MessageQueue->spwndActivePrev != NULL);
295 FindTopWnd = TRUE;
296
297 if ((pWndTopMost = IntGetLastTopMostWindow()))
298 pWndChild = pWndTopMost->spwndNext;
299 else
300 pWndChild = Wnd->spwndParent->spwndChild;
301
302 for (;;)
303 {
304 if ( ActivePrev )
305 pWndSetActive = pti->MessageQueue->spwndActivePrev;
306 else
307 pWndSetActive = pWndChild;
308
309 pWndTemp = NULL;
310
311 while(pWndSetActive)
312 {
313 if ( VerifyWnd(pWndSetActive) &&
314 !(pWndSetActive->ExStyle & WS_EX_NOACTIVATE) &&
315 (pWndSetActive->style & (WS_VISIBLE|WS_DISABLED)) == WS_VISIBLE &&
316 (!(pWndSetActive->style & WS_ICONIC) /* FIXME MinMax pos? */ ) )
317 {
318 if (!(pWndSetActive->ExStyle & WS_EX_TOOLWINDOW) )
319 {
320 UserRefObjectCo(pWndSetActive, &Ref);
321 //ERR("ActivateOtherWindowMin Set FG 1\n");
322 co_IntSetForegroundWindow(pWndSetActive);
323 UserDerefObjectCo(pWndSetActive);
324 //ERR("AOWM 2 Exit Good %p\n",pWndSetActive->head.h);
325 return TRUE;
326 }
327 if (!pWndTemp ) pWndTemp = pWndSetActive;
328 }
329 if ( ActivePrev )
330 {
331 ActivePrev = FALSE;
332 pWndSetActive = pWndChild;
333 }
334 else
335 pWndSetActive = pWndSetActive->spwndNext;
336 }
337
338 if ( !FindTopWnd ) break;
339 FindTopWnd = FALSE;
340
341 if ( pWndChild )
342 {
343 pWndChild = pWndChild->spwndParent->spwndChild;
344 continue;
345 }
346
347 if (!(pWndDesk = IntGetThreadDesktopWindow(pti)))
348 {
349 pWndChild = NULL;
350 continue;
351 }
352 pWndChild = pWndDesk->spwndChild;
353 }
354
355 if ((pWndSetActive = pWndTemp))
356 {
357 UserRefObjectCo(pWndSetActive, &Ref);
358 //ERR("ActivateOtherWindowMin Set FG 2\n");
359 co_IntSetForegroundWindow(pWndSetActive);
360 UserDerefObjectCo(pWndSetActive);
361 //ERR("AOWM 3 Exit Good %p\n",pWndSetActive->head.h);
362 return TRUE;
363 }
364 //ERR("AOWM 4 Bad\n");
365 return FALSE;
366}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window)
Definition: focus.c:1550
#define for
Definition: utility.h:88
PWND FASTCALL IntGetLastTopMostWindow(VOID)
Definition: winpos.c:239
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define WS_ICONIC
Definition: pedump.c:641
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_DISABLED
Definition: pedump.c:621
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
Definition: object.h:4
Definition: ntuser.h:689
DWORD ExStyle
Definition: ntuser.h:699
DWORD style
Definition: ntuser.h:701
struct _WND * spwndChild
Definition: ntuser.h:709
struct _WND * spwndNext
Definition: ntuser.h:706
struct _WND * spwndParent
Definition: ntuser.h:708
PWND FASTCALL IntGetThreadDesktopWindow(PTHREADINFO pti)
Definition: desktop.c:1359
PWND FASTCALL VerifyWnd(PWND pWnd)
Definition: window.c:86
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404

Referenced by co_WinPosShowWindow(), and UserSetActiveWindow().

◆ can_activate_window()

static BOOL FASTCALL can_activate_window ( PWND Wnd  OPTIONAL)
static

Definition at line 374 of file winpos.c.

375{
376 LONG style;
377
378 if (!Wnd) return FALSE;
379
380 style = Wnd->style;
381 if (!(style & WS_VISIBLE)) return FALSE;
382 if (style & WS_MINIMIZE) return FALSE;
383 if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
384 if (Wnd->ExStyle & WS_EX_NOACTIVATE) return FALSE;
385 return TRUE;
386 /* FIXME: This window could be disable because the child that closed
387 was a popup. */
388 //return !(style & WS_DISABLED);
389}
Arabic default style
Definition: afstyles.h:94
#define WS_CHILD
Definition: pedump.c:617
#define WS_POPUP
Definition: pedump.c:616
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60

Referenced by co_WinPosActivateOtherWindow().

◆ co_WinPosActivateOtherWindow()

VOID FASTCALL co_WinPosActivateOtherWindow ( PWND  Wnd)

Definition at line 398 of file winpos.c.

399{
400 PWND WndTo = NULL;
402
403 ASSERT_REFS_CO(Wnd);
404
405 if (IntIsDesktopWindow(Wnd))
406 {
407 //ERR("WinPosActivateOtherWindow Set Focus Msg Q No window!\n");
409 return;
410 }
411
412 /* If this is popup window, try to activate the owner first. */
413 if ((Wnd->style & WS_POPUP) && (WndTo = Wnd->spwndOwner))
414 {
415 TRACE("WPAOW Popup with Owner\n");
416 WndTo = UserGetAncestor( WndTo, GA_ROOT );
417 if (can_activate_window(WndTo)) goto done;
418 }
419
420 /* Pick a next top-level window. */
421 /* FIXME: Search for non-tooltip windows first. */
422 WndTo = Wnd;
423 for (;;)
424 {
425 if (!(WndTo = WndTo->spwndNext)) break;
426 if (can_activate_window( WndTo )) goto done;
427 }
428
429 /*
430 Fixes wine win.c:test_SetParent last ShowWindow test after popup dies.
431 Check for previous active window to bring to top.
432 */
433 if (Wnd)
434 {
435 WndTo = Wnd->head.pti->MessageQueue->spwndActivePrev;
436 if (can_activate_window( WndTo )) goto done;
437 }
438
439 // Find any window to bring to top. Works Okay for wine since it does not see X11 windows.
440 WndTo = UserGetDesktopWindow();
441 if ((WndTo == NULL) || (WndTo->spwndChild == NULL))
442 {
443 //ERR("WinPosActivateOtherWindow No window!\n");
444 return;
445 }
446 WndTo = WndTo->spwndChild;
447 for (;;)
448 {
449 if (WndTo == Wnd)
450 {
451 WndTo = NULL;
452 break;
453 }
454 if (can_activate_window( WndTo )) goto done;
455 if (!(WndTo = WndTo->spwndNext)) break;
456 }
457
458done:
459 if (WndTo) UserRefObjectCo(WndTo, &Ref);
460
462 {
463 /* ReactOS can pass WndTo = NULL to co_IntSetForegroundWindow and returns FALSE. */
464 //ERR("WinPosActivateOtherWindow Set FG 0x%p hWnd %p\n",WndTo, WndTo ? WndTo->head.h : 0);
465 if (co_IntSetForegroundWindow(WndTo))
466 {
467 if (WndTo) UserDerefObjectCo(WndTo);
468 return;
469 }
470 }
471 //ERR("WinPosActivateOtherWindow Set Active 0x%p\n",WndTo);
472 if (!UserSetActiveWindow(WndTo)) /* Ok for WndTo to be NULL here */
473 {
474 //ERR("WPAOW SA 1\n");
476 }
477 if (WndTo) UserDerefObjectCo(WndTo);
478}
BOOL FASTCALL UserSetActiveWindow(_In_opt_ PWND Wnd)
Definition: focus.c:1260
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
static BOOL FASTCALL can_activate_window(PWND Wnd OPTIONAL)
Definition: winpos.c:374
#define TRACE(s)
Definition: solgame.cpp:4
struct _WND * spwndOwner
Definition: ntuser.h:710
THRDESKHEAD head
Definition: ntuser.h:690
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3325
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:14
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
VOID FASTCALL IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
Definition: desktop.c:1319
#define IntIsDesktopWindow(WndObj)
Definition: window.h:25
#define GA_ROOT
Definition: winuser.h:2779

Referenced by co_WinPosShowWindow(), IntSendDestroyMsg(), and UserSetActiveWindow().

◆ co_WinPosArrangeIconicWindows()

UINT FASTCALL co_WinPosArrangeIconicWindows ( PWND  parent)

Definition at line 732 of file winpos.c.

733{
734 RECTL rectParent;
735 PWND Child;
736 INT x, y, xspacing, yspacing, sx, sy;
737
739
740 IntGetClientRect( parent, &rectParent );
741 // FIXME: Support Minimize Metrics gspv.mm.iArrange.
742 // Default: ARW_BOTTOMLEFT
743 x = rectParent.left;
744 y = rectParent.bottom;
745
748
749 Child = parent->spwndChild;
750 while(Child)
751 {
752 if((Child->style & WS_MINIMIZE) != 0 )
753 {
755 UserRefObjectCo(Child, &Ref);
756
758 sy = y - yspacing - UserGetSystemMetrics(SM_CYBORDER);
759
760 Child->InternalPos.IconPos.x = sx;
761 Child->InternalPos.IconPos.y = sy;
762 Child->InternalPos.flags |= WPF_MININIT;
763
765
767
768 if (x <= rectParent.right - xspacing)
769 x += xspacing;
770 else
771 {
772 x = rectParent.left;
773 y -= yspacing;
774 }
775 }
776 Child = Child->spwndNext;
777 }
778 return yspacing;
779}
r parent
Definition: btrfs.c:3010
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WPF_MININIT
Definition: ntuser.h:681
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1787
VOID FASTCALL IntGetClientRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:93
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define SM_CXMINIMIZED
Definition: winuser.h:1014
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define SM_CYMINIMIZED
Definition: winuser.h:1015
#define SWP_ASYNCWINDOWPOS
Definition: winuser.h:1243
#define SM_CYBORDER
Definition: winuser.h:959
#define SWP_NOCOPYBITS
Definition: winuser.h:1233
#define SM_CXBORDER
Definition: winuser.h:958
#define SWP_NOZORDER
Definition: winuser.h:1237

Referenced by NtUserCallHwndLock().

◆ co_WinPosDoNCCALCSize()

static LONG FASTCALL co_WinPosDoNCCALCSize ( PWND  Window,
PWINDOWPOS  WinPos,
RECTL WindowRect,
RECTL ClientRect,
RECTL validRects 
)
static

Definition at line 1181 of file winpos.c.

1182{
1183 PWND Parent;
1184 UINT wvrFlags = 0;
1185
1187
1188 /* Send WM_NCCALCSIZE message to get new client area */
1189 if ((WinPos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE)
1190 {
1192 WINDOWPOS winposCopy;
1193
1194 params.rgrc[0] = *WindowRect; // new coordinates of a window that has been moved or resized
1195 params.rgrc[1] = Window->rcWindow; // window before it was moved or resized
1196 params.rgrc[2] = Window->rcClient; // client area before the window was moved or resized
1197
1198 Parent = Window->spwndParent;
1199 if (0 != (Window->style & WS_CHILD) && Parent)
1200 {
1201 RECTL_vOffsetRect(&(params.rgrc[0]), - Parent->rcClient.left, - Parent->rcClient.top);
1202 RECTL_vOffsetRect(&(params.rgrc[1]), - Parent->rcClient.left, - Parent->rcClient.top);
1203 RECTL_vOffsetRect(&(params.rgrc[2]), - Parent->rcClient.left, - Parent->rcClient.top);
1204 }
1205
1206 params.lppos = &winposCopy;
1207 winposCopy = *WinPos;
1208
1209 wvrFlags = co_IntSendMessage(Window->head.h, WM_NCCALCSIZE, TRUE, (LPARAM) &params);
1210
1211 /* If the application send back garbage, ignore it */
1212 if (params.rgrc[0].left <= params.rgrc[0].right &&
1213 params.rgrc[0].top <= params.rgrc[0].bottom)
1214 {
1215 *ClientRect = params.rgrc[0]; // First rectangle contains the coordinates of the new client rectangle resulting from the move or resize
1216 if ((Window->style & WS_CHILD) && Parent)
1217 {
1218 RECTL_vOffsetRect(ClientRect, Parent->rcClient.left, Parent->rcClient.top);
1219 }
1220 FixClientRect(ClientRect, WindowRect);
1221 }
1222
1223 if (ClientRect->left != Window->rcClient.left ||
1224 ClientRect->top != Window->rcClient.top)
1225 {
1226 WinPos->flags &= ~SWP_NOCLIENTMOVE;
1227 }
1228
1229 if (ClientRect->right - ClientRect->left != Window->rcClient.right - Window->rcClient.left)
1230 {
1231 WinPos->flags &= ~SWP_NOCLIENTSIZE;
1232 }
1233 else
1234 wvrFlags &= ~WVR_HREDRAW;
1235
1236 if (ClientRect->bottom - ClientRect->top != Window->rcClient.bottom - Window->rcClient.top)
1237 {
1238 WinPos->flags &= ~SWP_NOCLIENTSIZE;
1239 }
1240 else
1241 wvrFlags &= ~WVR_VREDRAW;
1242
1243 validRects[0] = params.rgrc[1]; // second rectangle contains the valid destination rectangle
1244 validRects[1] = params.rgrc[2]; // third rectangle contains the valid source rectangle
1245 }
1246 else
1247 {
1248 if (!(WinPos->flags & SWP_NOMOVE) &&
1249 (ClientRect->left != Window->rcClient.left ||
1250 ClientRect->top != Window->rcClient.top))
1251 {
1252 WinPos->flags &= ~SWP_NOCLIENTMOVE;
1253 }
1254 }
1255
1257 {
1258 RECTL_vSetEmptyRect( &validRects[0] );
1259 RECTL_vSetEmptyRect( &validRects[1] );
1260 }
1261 else get_valid_rects( &Window->rcClient, ClientRect, wvrFlags, validRects );
1262
1263 return wvrFlags;
1264}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
GLenum const GLfloat * params
Definition: glext.h:5645
unsigned int UINT
Definition: ndis.h:50
static VOID FASTCALL FixClientRect(PRECTL ClientRect, PRECTL WindowRect)
Definition: winpos.c:1082
static VOID FASTCALL get_valid_rects(RECTL *old_client, RECTL *new_client, UINT flags, RECTL *valid)
Definition: winpos.c:1125
long top
Definition: polytest.cpp:53
Definition: window.c:28
UINT flags
Definition: winuser.h:3584
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
LONG_PTR LPARAM
Definition: windef.h:208
#define SWP_NOREDRAW
Definition: winuser.h:1236
#define SWP_FRAMECHANGED
Definition: winuser.h:1230
#define SWP_NOMOVE
Definition: winuser.h:1234
#define SWP_NOSIZE
Definition: winuser.h:1235
#define SWP_SHOWWINDOW
Definition: winuser.h:1238
#define SWP_HIDEWINDOW
Definition: winuser.h:1231
#define WM_NCCALCSIZE
Definition: winuser.h:1675

Referenced by co_WinPosSetWindowPos().

◆ co_WinPosDoWinPosChanging()

static BOOL FASTCALL co_WinPosDoWinPosChanging ( PWND  Window,
PWINDOWPOS  WinPos,
PRECTL  WindowRect,
PRECTL  ClientRect 
)
static

Definition at line 1268 of file winpos.c.

1272{
1274
1275 /* Send WM_WINDOWPOSCHANGING message */
1276
1277 if (!(WinPos->flags & SWP_NOSENDCHANGING)
1278 && !((WinPos->flags & SWP_AGG_NOCLIENTCHANGE) && (WinPos->flags & SWP_SHOWWINDOW)))
1279 {
1280 TRACE("Sending WM_WINDOWPOSCHANGING to hwnd %p flags %04x.\n", Window->head.h,WinPos->flags);
1281 co_IntSendMessage(Window->head.h, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
1282 }
1283
1284 /* Calculate new position and size */
1285
1286 *WindowRect = Window->rcWindow;
1287 *ClientRect = (Window->style & WS_MINIMIZE) ? Window->rcWindow : Window->rcClient;
1288
1289 if (!(WinPos->flags & SWP_NOSIZE))
1290 {
1291 if (Window->style & WS_MINIMIZE)
1292 {
1293 WindowRect->right = WindowRect->left + UserGetSystemMetrics(SM_CXMINIMIZED);
1294 WindowRect->bottom = WindowRect->top + UserGetSystemMetrics(SM_CYMINIMIZED);
1295 }
1296 else
1297 {
1298 WindowRect->right = WindowRect->left + WinPos->cx;
1299 WindowRect->bottom = WindowRect->top + WinPos->cy;
1300 }
1301 }
1302
1303 if (!(WinPos->flags & SWP_NOMOVE))
1304 {
1305 INT X, Y;
1306 PWND Parent;
1307 X = WinPos->x;
1308 Y = WinPos->y;
1309
1310 Parent = Window->spwndParent;
1311
1312 // Parent child position issue is in here. SetParent_W7 test CORE-6651.
1313 if (//((Window->style & WS_CHILD) != 0) && <- Fixes wine msg test_SetParent: "rects do not match", the last test.
1314 Parent &&
1315 Parent != Window->head.rpdesk->pDeskInfo->spwnd)
1316 {
1317 TRACE("Not SWP_NOMOVE 1 Parent client offset X %d Y %d\n",X,Y);
1318 X += Parent->rcClient.left;
1319 Y += Parent->rcClient.top;
1320 TRACE("Not SWP_NOMOVE 2 Parent client offset X %d Y %d\n",X,Y);
1321 }
1322
1323 WindowRect->left = X;
1324 WindowRect->top = Y;
1325 WindowRect->right += X - Window->rcWindow.left;
1326 WindowRect->bottom += Y - Window->rcWindow.top;
1327
1328 RECTL_vOffsetRect(ClientRect, X - Window->rcWindow.left,
1329 Y - Window->rcWindow.top);
1330 }
1332
1333 TRACE( "hwnd %p, after %p, swp %d,%d %dx%d flags %08x\n",
1334 WinPos->hwnd, WinPos->hwndInsertAfter, WinPos->x, WinPos->y,
1335 WinPos->cx, WinPos->cy, WinPos->flags );
1336 TRACE("WindowRect: %d %d %d %d\n", WindowRect->left,WindowRect->top,WindowRect->right,WindowRect->bottom);
1337 TRACE("ClientRect: %d %d %d %d\n", ClientRect->left,ClientRect->top,ClientRect->right,ClientRect->bottom);
1338
1339 return TRUE;
1340}
#define SWP_NOCLIENTSIZE
Definition: msg.h:29
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define Y(I)
#define X(b, s)
if(dx< 0)
Definition: linetemp.h:194
#define SWP_AGG_NOCLIENTCHANGE
Definition: winpos.c:27
HWND hwnd
Definition: winuser.h:3578
HWND hwndInsertAfter
Definition: winuser.h:3579
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1651
#define SWP_NOSENDCHANGING
Definition: winuser.h:1241

Referenced by co_WinPosSetWindowPos().

◆ co_WinPosGetMinMaxInfo()

UINT FASTCALL co_WinPosGetMinMaxInfo ( PWND  Window,
POINT MaxSize,
POINT MaxPos,
POINT MinTrack,
POINT MaxTrack 
)

Definition at line 935 of file winpos.c.

937{
938 MINMAXINFO MinMax;
939 PMONITOR monitor;
940 INT xinc, yinc;
941 LONG style = Window->style;
942 LONG adjustedStyle;
943 LONG exstyle = Window->ExStyle;
944 RECT rc;
945 DWORD adjust;
946
948
949 /* Compute default values */
950
951 rc = Window->rcWindow;
952 MinMax.ptReserved.x = rc.left;
953 MinMax.ptReserved.y = rc.top;
954
955 if ((style & WS_CAPTION) == WS_CAPTION)
956 adjustedStyle = style & ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
957 else
958 adjustedStyle = style;
959
960 if (Window->spwndParent)
961 IntGetClientRect(Window->spwndParent, &rc);
962
963 adjust = IntGetWindowBorders(adjustedStyle, exstyle);
964
965 // Handle special case while maximized. CORE-15893
966 if ((adjustedStyle & WS_THICKFRAME) && !(adjustedStyle & WS_CHILD) && !(adjustedStyle & WS_MINIMIZE))
967 adjust += 1;
968
969 xinc = yinc = adjust;
970
971 if ((adjustedStyle & WS_THICKFRAME) && (adjustedStyle & WS_CHILD) && !(adjustedStyle & WS_MINIMIZE))
972 {
975 }
976
980
981 xinc = -rc.left;
982 yinc = -rc.top;
983
984 MinMax.ptMaxSize.x = rc.right - rc.left;
985 MinMax.ptMaxSize.y = rc.bottom - rc.top;
986 if (style & (WS_DLGFRAME | WS_BORDER))
987 {
990 }
991 else
992 {
993 MinMax.ptMinTrackSize.x = 2 * xinc;
994 MinMax.ptMinTrackSize.y = 2 * yinc;
995 }
998 MinMax.ptMaxPosition.x = -xinc;
999 MinMax.ptMaxPosition.y = -yinc;
1000
1001 if (!EMPTYPOINT(Window->InternalPos.MaxPos)) MinMax.ptMaxPosition = Window->InternalPos.MaxPos;
1002
1003 co_IntSendMessage(Window->head.h, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax);
1004
1005 /* if the app didn't change the values, adapt them for the current monitor */
1006 if ((monitor = UserGetPrimaryMonitor()))
1007 {
1008 RECT rc_work;
1009
1010 rc_work = monitor->rcMonitor;
1011
1012 if (style & WS_MAXIMIZEBOX)
1013 {
1014 if ((style & WS_CAPTION) == WS_CAPTION || !(style & (WS_CHILD | WS_POPUP)))
1015 rc_work = monitor->rcWork;
1016 }
1017
1018 if (MinMax.ptMaxSize.x == UserGetSystemMetrics(SM_CXSCREEN) + 2 * xinc &&
1019 MinMax.ptMaxSize.y == UserGetSystemMetrics(SM_CYSCREEN) + 2 * yinc)
1020 {
1021 MinMax.ptMaxSize.x = (rc_work.right - rc_work.left) + 2 * xinc;
1022 MinMax.ptMaxSize.y = (rc_work.bottom - rc_work.top) + 2 * yinc;
1023 }
1024 if (MinMax.ptMaxPosition.x == -xinc && MinMax.ptMaxPosition.y == -yinc)
1025 {
1026 MinMax.ptMaxPosition.x = rc_work.left - xinc;
1027 MinMax.ptMaxPosition.y = rc_work.top - yinc;
1028 }
1029 if (MinMax.ptMaxSize.x >= (monitor->rcMonitor.right - monitor->rcMonitor.left) &&
1030 MinMax.ptMaxSize.y >= (monitor->rcMonitor.bottom - monitor->rcMonitor.top) )
1031 {
1033 }
1034 else
1035 Window->state &= ~WNDS_MAXIMIZESTOMONITOR;
1036 }
1037
1038
1039 MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x,
1040 MinMax.ptMinTrackSize.x);
1041 MinMax.ptMaxTrackSize.y = max(MinMax.ptMaxTrackSize.y,
1042 MinMax.ptMinTrackSize.y);
1043
1044 if (MaxSize)
1045 *MaxSize = MinMax.ptMaxSize;
1046 if (MaxPos)
1047 *MaxPos = MinMax.ptMaxPosition;
1048 if (MinTrack)
1049 *MinTrack = MinMax.ptMinTrackSize;
1050 if (MaxTrack)
1051 *MaxTrack = MinMax.ptMaxTrackSize;
1052
1053 return 0; // FIXME: What does it return? Wine returns MINMAXINFO.
1054}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WNDS_MAXIMIZESTOMONITOR
Definition: ntuser.h:630
#define EMPTYPOINT(pt)
Definition: winpos.c:30
DWORD IntGetWindowBorders(DWORD Style, DWORD ExStyle)
Definition: winpos.c:916
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_BORDER
Definition: pedump.c:625
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_THICKFRAME
Definition: pedump.c:630
RECT rcWork
Definition: monitor.h:19
RECT rcMonitor
Definition: monitor.h:18
POINT ptMaxPosition
Definition: winuser.h:3619
POINT ptMaxSize
Definition: winuser.h:3618
POINT ptMinTrackSize
Definition: winuser.h:3620
POINT ptReserved
Definition: winuser.h:3617
POINT ptMaxTrackSize
Definition: winuser.h:3621
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define max(a, b)
Definition: svc.c:63
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
PMONITOR NTAPI UserGetPrimaryMonitor(VOID)
Definition: monitor.c:102
#define SM_CYSCREEN
Definition: winuser.h:954
#define SM_CXMINTRACK
Definition: winuser.h:991
#define SM_CXFRAME
Definition: winuser.h:988
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXMAXTRACK
Definition: winuser.h:1016
#define WM_GETMINMAXINFO
Definition: winuser.h:1630
#define SM_CYMAXTRACK
Definition: winuser.h:1017
#define SM_CXDLGFRAME
Definition: winuser.h:960
#define SM_CYDLGFRAME
Definition: winuser.h:962
#define SM_CXSCREEN
Definition: winuser.h:953
#define SM_CYMINTRACK
Definition: winuser.h:992

Referenced by co_UserCreateWindowEx(), co_WinPosMinMaximize(), DefWndDoSizeMove(), and DefWndHandleWindowPosChanging().

◆ co_WinPosGetNonClientSize()

LRESULT FASTCALL co_WinPosGetNonClientSize ( PWND  Window,
RECT WindowRect,
RECT ClientRect 
)

Definition at line 2367 of file winpos.c.

2368{
2370
2372
2373 *ClientRect = *WindowRect;
2375
2376 FixClientRect(ClientRect, WindowRect);
2377
2378 return Result;
2379}
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1710
LONG_PTR LRESULT
Definition: windef.h:209
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426

Referenced by co_IntCreateScrollBars(), and co_UserCreateWindowEx().

◆ co_WinPosMinMaximize()

UINT FASTCALL co_WinPosMinMaximize ( PWND  Wnd,
UINT  ShowFlag,
RECT NewPos 
)

Definition at line 2416 of file winpos.c.

2417{
2418 POINT Size;
2419 WINDOWPLACEMENT wpl;
2420 LONG old_style;
2421 UINT SwpFlags = 0;
2422
2423 ASSERT_REFS_CO(Wnd);
2424
2425 wpl.length = sizeof(wpl);
2426 IntGetWindowPlacement( Wnd, &wpl );
2427
2428 if (co_HOOK_CallHooks( WH_CBT, HCBT_MINMAX, (WPARAM)Wnd->head.h, ShowFlag))
2429 {
2430 ERR("WinPosMinMaximize WH_CBT Call Hook return!\n");
2431 return SWP_NOSIZE | SWP_NOMOVE;
2432 }
2433 if (Wnd->style & WS_MINIMIZE)
2434 {
2435 switch (ShowFlag)
2436 {
2437 case SW_MINIMIZE:
2438 case SW_SHOWMINNOACTIVE:
2439 case SW_SHOWMINIMIZED:
2440 case SW_FORCEMINIMIZE:
2441 return SWP_NOSIZE | SWP_NOMOVE;
2442 }
2443 if (!co_IntSendMessageNoWait(Wnd->head.h, WM_QUERYOPEN, 0, 0))
2444 {
2445 return(SWP_NOSIZE | SWP_NOMOVE);
2446 }
2447 SwpFlags |= SWP_NOCOPYBITS;
2448 }
2449 switch (ShowFlag)
2450 {
2451 case SW_MINIMIZE:
2452 case SW_SHOWMINNOACTIVE:
2453 case SW_SHOWMINIMIZED:
2454 case SW_FORCEMINIMIZE:
2455 {
2456 //ERR("MinMaximize Minimize\n");
2457 if (Wnd->style & WS_MAXIMIZE)
2458 {
2459 Wnd->InternalPos.flags |= WPF_RESTORETOMAXIMIZED;
2460 }
2461 else
2462 {
2463 Wnd->InternalPos.flags &= ~WPF_RESTORETOMAXIMIZED;
2464 }
2465
2466 old_style = IntSetStyle( Wnd, WS_MINIMIZE, WS_MAXIMIZE );
2467
2469
2470 if (!(Wnd->InternalPos.flags & WPF_SETMINPOSITION))
2471 Wnd->InternalPos.flags &= ~WPF_MININIT;
2472
2474
2475 if (!(old_style & WS_MINIMIZE))
2476 {
2477 SwpFlags |= SWP_STATECHANGED;
2479 }
2480
2481 RECTL_vSetRect(NewPos, wpl.ptMinPosition.x, wpl.ptMinPosition.y,
2484 SwpFlags |= SWP_NOCOPYBITS;
2485 break;
2486 }
2487
2488 case SW_MAXIMIZE:
2489 {
2490 //ERR("MinMaximize Maximize\n");
2491 if ((Wnd->style & WS_MAXIMIZE) && (Wnd->style & WS_VISIBLE))
2492 {
2493 SwpFlags = SWP_NOSIZE | SWP_NOMOVE;
2494 break;
2495 }
2497
2498 /*ERR("Maximize: %d,%d %dx%d\n",
2499 wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, Size.x, Size.y);
2500 */
2501 old_style = IntSetStyle( Wnd, WS_MAXIMIZE, WS_MINIMIZE );
2502 /*if (old_style & WS_MINIMIZE)
2503 {
2504 IntShowOwnedPopups(Wnd, TRUE);
2505 }*/
2506
2507 if (!(old_style & WS_MAXIMIZE)) SwpFlags |= SWP_STATECHANGED;
2508 RECTL_vSetRect(NewPos, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y,
2509 //wpl.ptMaxPosition.x + Size.x, wpl.ptMaxPosition.y + Size.y);
2510 Size.x, Size.y);
2511 break;
2512 }
2513
2514 case SW_SHOWNOACTIVATE:
2515 Wnd->InternalPos.flags &= ~WPF_RESTORETOMAXIMIZED;
2516 /* fall through */
2517 case SW_SHOWNORMAL:
2518 case SW_RESTORE:
2519 case SW_SHOWDEFAULT: /* FIXME: should have its own handler */
2520 {
2521 //ERR("MinMaximize Restore\n");
2522 old_style = IntSetStyle( Wnd, 0, WS_MINIMIZE | WS_MAXIMIZE );
2523 if (old_style & WS_MINIMIZE)
2524 {
2526
2527 if (Wnd->InternalPos.flags & WPF_RESTORETOMAXIMIZED)
2528 {
2530 IntSetStyle( Wnd, WS_MAXIMIZE, 0 );
2531 SwpFlags |= SWP_STATECHANGED;
2532 RECTL_vSetRect(NewPos, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y,
2533 wpl.ptMaxPosition.x + Size.x, wpl.ptMaxPosition.y + Size.y);
2534 break;
2535 }
2536 else
2537 {
2538 *NewPos = wpl.rcNormalPosition;
2539 NewPos->right -= NewPos->left;
2540 NewPos->bottom -= NewPos->top;
2541 break;
2542 }
2543 }
2544 else
2545 {
2546 if (!(old_style & WS_MAXIMIZE))
2547 {
2548 break;
2549 }
2550 SwpFlags |= SWP_STATECHANGED;
2551 Wnd->InternalPos.flags &= ~WPF_RESTORETOMAXIMIZED;
2552 *NewPos = wpl.rcNormalPosition;
2553 NewPos->right -= NewPos->left;
2554 NewPos->bottom -= NewPos->top;
2555 break;
2556 }
2557 }
2558 }
2559 return SwpFlags;
2560}
#define ERR(fmt,...)
Definition: debug.h:110
#define SWP_STATECHANGED
Definition: msg.c:42
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
BOOL FASTCALL IntGetWindowPlacement(PWND Wnd, WINDOWPLACEMENT *lpwndpl)
Definition: winpos.c:560
static VOID FASTCALL WinPosFindIconPos(PWND Window, POINT *Pos)
Definition: winpos.c:782
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:935
#define WS_MAXIMIZE
Definition: pedump.c:623
POINT ptMaxPosition
Definition: winuser.h:3284
RECT rcNormalPosition
Definition: winuser.h:3285
POINT ptMinPosition
Definition: winuser.h:3283
struct _WND::@4895 InternalPos
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:888
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:143
BOOL FASTCALL IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow)
Definition: window.c:4650
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define HCBT_MINMAX
Definition: winuser.h:56
#define WM_QUERYOPEN
Definition: winuser.h:1614
#define SW_MINIMIZE
Definition: winuser.h:770
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1207
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
#define WH_CBT
Definition: winuser.h:35
#define SW_SHOWDEFAULT
Definition: winuser.h:774
#define SW_SHOWMINIMIZED
Definition: winuser.h:765
#define SW_FORCEMINIMIZE
Definition: winuser.h:775
#define WPF_RESTORETOMAXIMIZED
Definition: winuser.h:2522
#define SW_RESTORE
Definition: winuser.h:773
#define SW_MAXIMIZE
Definition: winuser.h:766
#define RDW_NOERASE
Definition: winuser.h:1205
#define RDW_VALIDATE
Definition: winuser.h:1208
#define WPF_SETMINPOSITION
Definition: winuser.h:2523
#define SW_SHOWMINNOACTIVE
Definition: winuser.h:771

Referenced by co_UserCreateWindowEx(), and co_WinPosShowWindow().

◆ co_WinPosSearchChildren()

static PWND co_WinPosSearchChildren ( IN PWND  ScopeWin,
IN POINT Point,
IN OUT USHORT HitTest,
IN BOOL  Ignore 
)
static

Definition at line 2849 of file winpos.c.

2855{
2856 HWND *List, *phWnd;
2857 PWND pwndChild = NULL;
2858
2859 /* not visible */
2860 if (!(ScopeWin->style & WS_VISIBLE))
2861 {
2862 return NULL;
2863 }
2864
2865 /* not in window or in window region */
2866 if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
2867 {
2868 return NULL;
2869 }
2870
2871 /* transparent */
2872 if ((ScopeWin->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) == (WS_EX_LAYERED|WS_EX_TRANSPARENT))
2873 {
2874 return NULL;
2875 }
2876
2877 if (!Ignore && (ScopeWin->style & WS_DISABLED))
2878 { /* disabled child */
2879 if ((ScopeWin->style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return NULL;
2880 /* process the hit error */
2881 *HitTest = HTERROR;
2882 return ScopeWin;
2883 }
2884
2885 /* not minimized and check if point is inside the window */
2886 if (!(ScopeWin->style & WS_MINIMIZE) &&
2887 RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) )
2888 {
2889 UserReferenceObject(ScopeWin);
2890
2891 List = IntWinListChildren(ScopeWin);
2892 if (List)
2893 {
2894 for (phWnd = List; *phWnd; ++phWnd)
2895 {
2896 if (!(pwndChild = ValidateHwndNoErr(*phWnd)))
2897 {
2898 continue;
2899 }
2900
2901 pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest, Ignore);
2902
2903 if (pwndChild != NULL)
2904 {
2905 /* We found a window. Don't send any more WM_NCHITTEST messages */
2907 UserDereferenceObject(ScopeWin);
2908 return pwndChild;
2909 }
2910 }
2912 }
2913 UserDereferenceObject(ScopeWin);
2914 }
2915
2916 if (ScopeWin->head.pti == PsGetCurrentThreadWin32Thread())
2917 {
2918 *HitTest = (USHORT)co_IntSendMessage(ScopeWin->head.h, WM_NCHITTEST, 0, MAKELONG(Point->x, Point->y));
2919
2920 if ((*HitTest) == (USHORT)HTTRANSPARENT)
2921 {
2922 return NULL;
2923 }
2924 }
2925 else
2926 {
2927 if (*HitTest == HTNOWHERE && pwndChild == NULL) *HitTest = HTCLIENT;
2928 }
2929
2930 return ScopeWin;
2931}
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static PWND co_WinPosSearchChildren(IN PWND ScopeWin, IN POINT *Point, IN OUT USHORT *HitTest, IN BOOL Ignore)
Definition: winpos.c:2849
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
unsigned short USHORT
Definition: pedump.c:61
#define MAKELONG(a, b)
Definition: typedefs.h:249
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
#define USERTAG_WINDOWLIST
Definition: tags.h:298
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:274
FORCEINLINE BOOL IntPtInWindow(PWND pwnd, INT x, INT y)
Definition: winpos.h:30
#define HTERROR
Definition: winuser.h:2462
#define WM_NCHITTEST
Definition: winuser.h:1676
#define HTCLIENT
Definition: winuser.h:2465
#define HTNOWHERE
Definition: winuser.h:2464
#define WS_EX_LAYERED
Definition: winuser.h:389
#define HTTRANSPARENT
Definition: winuser.h:2463

Referenced by co_WinPosSearchChildren(), and co_WinPosWindowFromPoint().

◆ co_WinPosSendSizeMove()

void FASTCALL co_WinPosSendSizeMove ( PWND  Wnd)

Definition at line 2382 of file winpos.c.

2383{
2384 RECTL Rect;
2385 LPARAM lParam;
2387
2388 IntGetClientRect(Wnd, &Rect);
2389 lParam = MAKELONG(Rect.right-Rect.left, Rect.bottom-Rect.top);
2390
2391 Wnd->state &= ~WNDS_SENDSIZEMOVEMSGS;
2392
2393 if (Wnd->style & WS_MAXIMIZE)
2394 {
2396 }
2397 else if (Wnd->style & WS_MINIMIZE)
2398 {
2400 lParam = 0;
2401 }
2402
2404
2406 lParam = MAKELONG(Wnd->rcClient.left, Wnd->rcClient.top);
2407 else
2408 lParam = MAKELONG(Wnd->rcClient.left-Wnd->spwndParent->rcClient.left, Wnd->rcClient.top-Wnd->spwndParent->rcClient.top);
2409
2411
2413}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
VOID FASTCALL IntEngWindowChanged(_In_ struct _WND *Window, _In_ FLONG flChanged)
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
RECT rcClient
Definition: ntuser.h:712
DWORD state
Definition: ntuser.h:696
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define WOC_RGN_CLIENT
Definition: winddi.h:1265
#define WM_SIZE
Definition: winuser.h:1601
#define SIZE_MINIMIZED
Definition: winuser.h:2496
#define SIZE_MAXIMIZED
Definition: winuser.h:2497
#define WM_MOVE
Definition: winuser.h:1600
#define SIZE_RESTORED
Definition: winuser.h:2495

Referenced by co_UserCreateWindowEx(), and co_WinPosShowWindow().

◆ co_WinPosSetWindowPos()

BOOLEAN FASTCALL co_WinPosSetWindowPos ( PWND  Window,
HWND  WndInsertAfter,
INT  x,
INT  y,
INT  cx,
INT  cy,
UINT  flags 
)

Definition at line 1787 of file winpos.c.

1796{
1797 WINDOWPOS WinPos;
1798 RECTL NewWindowRect;
1799 RECTL NewClientRect;
1800 RECTL valid_rects[2];
1801 PREGION VisBefore = NULL;
1802 PREGION VisBeforeJustClient = NULL;
1803 PREGION VisAfter = NULL;
1805 ULONG WvrFlags = 0;
1806 RECTL OldWindowRect, OldClientRect;
1807 int RgnType;
1808 HDC Dc;
1810 PWND Ancestor;
1811 BOOL bPointerInWindow, PosChanged = FALSE;
1813
1815
1816 TRACE("pwnd %p, after %p, %d,%d (%dx%d), flags 0x%x\n",
1817 Window, WndInsertAfter, x, y, cx, cy, flags);
1818#if DBG
1819 dump_winpos_flags(flags);
1820#endif
1821
1822 /* FIXME: Get current active window from active queue. Why? since r2915. */
1823
1824 bPointerInWindow = IntPtInWindow(Window, gpsi->ptCursor.x, gpsi->ptCursor.y);
1825
1826 WinPos.hwnd = Window->head.h;
1827 WinPos.hwndInsertAfter = WndInsertAfter;
1828 WinPos.x = x;
1829 WinPos.y = y;
1830 WinPos.cx = cx;
1831 WinPos.cy = cy;
1832 WinPos.flags = flags;
1833
1834 if ( flags & SWP_ASYNCWINDOWPOS )
1835 {
1836 LRESULT lRes;
1838 if ( ppos )
1839 {
1840 WinPos.flags &= ~SWP_ASYNCWINDOWPOS; // Clear flag.
1841 *ppos = WinPos;
1842 /* Yes it's a pointer inside Win32k! */
1843 lRes = co_IntSendMessageNoWait( WinPos.hwnd, WM_ASYNC_SETWINDOWPOS, 0, (LPARAM)ppos);
1844 /* We handle this the same way as Event Hooks and Hooks. */
1845 if ( !lRes )
1846 {
1848 return FALSE;
1849 }
1850 return TRUE;
1851 }
1852 return FALSE;
1853 }
1854
1855 co_WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect);
1856
1857 /* Does the window still exist? */
1858 if (!IntIsWindow(WinPos.hwnd))
1859 {
1860 TRACE("WinPosSetWindowPos: Invalid handle 0x%p!\n",WinPos.hwnd);
1862 return FALSE;
1863 }
1864
1865 /* Fix up the flags. */
1866 if (!WinPosFixupFlags(&WinPos, Window))
1867 {
1868 // See Note.
1869 return TRUE;
1870 }
1871
1872 Ancestor = UserGetAncestor(Window, GA_PARENT);
1873 if ( (WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) != SWP_NOZORDER &&
1874 Ancestor && Ancestor->head.h == IntGetDesktopWindow() )
1875 {
1877 }
1878
1879 if (!(WinPos.flags & SWP_NOREDRAW))
1880 {
1881 /* Compute the visible region before the window position is changed */
1882 if (!(WinPos.flags & SWP_SHOWWINDOW) &&
1883 (WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
1886 {
1888 (Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
1889
1890 if ( VisBefore != NULL &&
1891 REGION_Complexity(VisBefore) == NULLREGION )
1892 {
1893 REGION_Delete(VisBefore);
1894 VisBefore = NULL;
1895 }
1896 else if(VisBefore)
1897 {
1898 REGION_bOffsetRgn(VisBefore, -Window->rcWindow.left, -Window->rcWindow.top);
1899 }
1900
1901 /* Calculate the non client area for resizes, as this is used in the copy region */
1902 if ((WinPos.flags & (SWP_NOSIZE | SWP_FRAMECHANGED)) != SWP_NOSIZE)
1903 {
1904 VisBeforeJustClient = VIS_ComputeVisibleRegion(Window, TRUE, FALSE,
1905 (Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
1906
1907 if ( VisBeforeJustClient != NULL &&
1908 REGION_Complexity(VisBeforeJustClient) == NULLREGION )
1909 {
1910 REGION_Delete(VisBeforeJustClient);
1911 VisBeforeJustClient = NULL;
1912 }
1913 else if(VisBeforeJustClient)
1914 {
1915 REGION_bOffsetRgn(VisBeforeJustClient, -Window->rcWindow.left, -Window->rcWindow.top);
1916 }
1917 }
1918 }
1919 }
1920
1922 if (Window->hrgnNewFrame)
1923 {
1924 SelectWindowRgn( Window, Window->hrgnNewFrame ); // Should be PSMWP->acvr->hrgnClip
1925 Window->hrgnNewFrame = NULL;
1926 }
1927
1928 WvrFlags = co_WinPosDoNCCALCSize(Window, &WinPos, &NewWindowRect, &NewClientRect, valid_rects);
1929
1930// ERR("co_WinPosDoNCCALCSize returned 0x%x\n valid dest: %d %d %d %d\n valid src : %d %d %d %d\n", WvrFlags,
1931// valid_rects[0].left,valid_rects[0].top,valid_rects[0].right,valid_rects[0].bottom,
1932// valid_rects[1].left,valid_rects[1].top,valid_rects[1].right,valid_rects[1].bottom);
1933
1934 /* Validate link windows. (also take into account shell window in hwndShellWindow) */
1935 if (!(WinPos.flags & SWP_NOZORDER) && WinPos.hwnd != UserGetShellWindow())
1936 {
1938 }
1939
1940 OldWindowRect = Window->rcWindow;
1941 OldClientRect = Window->rcClient;
1942
1943 if (NewClientRect.left != OldClientRect.left ||
1944 NewClientRect.top != OldClientRect.top)
1945 {
1946 // Move child window if their parent is moved. Keep Child window relative to Parent...
1948 NewClientRect.left - OldClientRect.left,
1949 NewClientRect.top - OldClientRect.top);
1950 PosChanged = TRUE;
1951 }
1952
1953 Window->rcWindow = NewWindowRect;
1954 Window->rcClient = NewClientRect;
1955
1956 /* erase parent when hiding or resizing child */
1957 if (WinPos.flags & SWP_HIDEWINDOW)
1958 {
1959 /* Clear the update region */
1961 NULL,
1962 0,
1964
1965 if (UserIsDesktopWindow(Window->spwndParent))
1967
1968 Window->style &= ~WS_VISIBLE; //IntSetStyle( Window, 0, WS_VISIBLE );
1969 Window->head.pti->cVisWindows--;
1971 }
1972 else if (WinPos.flags & SWP_SHOWWINDOW)
1973 {
1974 if (Window->style & WS_CHILD)
1975 {
1976 if ((Window->style & WS_POPUP) && (Window->ExStyle & WS_EX_APPWINDOW))
1977 {
1979 if (!(WinPos.flags & SWP_NOACTIVATE))
1981 }
1982 }
1983 else if ((Window->ExStyle & WS_EX_APPWINDOW) ||
1984 (!(Window->ExStyle & WS_EX_TOOLWINDOW) && !Window->spwndOwner &&
1985 (!Window->spwndParent || UserIsDesktopWindow(Window->spwndParent))))
1986 {
1988 {
1990 if (!(WinPos.flags & SWP_NOACTIVATE))
1992 }
1993 }
1994
1995 Window->style |= WS_VISIBLE; //IntSetStyle( Window, WS_VISIBLE, 0 );
1996 Window->head.pti->cVisWindows++;
1998 }
1999 else
2000 {
2002 }
2003
2004 if (Window->hrgnUpdate != NULL && Window->hrgnUpdate != HRGN_WINDOW)
2005 {
2006 NtGdiOffsetRgn(Window->hrgnUpdate,
2007 NewWindowRect.left - OldWindowRect.left,
2008 NewWindowRect.top - OldWindowRect.top);
2009 }
2010
2011 DceResetActiveDCEs(Window); // For WS_VISIBLE changes.
2012
2013 // Change or update, set send non-client paint flag.
2014 if ( Window->style & WS_VISIBLE &&
2015 (WinPos.flags & SWP_STATECHANGED || (!(Window->state2 & WNDS2_WIN31COMPAT) && WinPos.flags & SWP_NOREDRAW ) ) )
2016 {
2017 TRACE("Set WNDS_SENDNCPAINT %p\n",Window);
2018 Window->state |= WNDS_SENDNCPAINT;
2019 }
2020
2021 if (!(WinPos.flags & SWP_NOREDRAW) && ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE))
2022 {
2023 /* Determine the new visible region */
2025 (Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE);
2026
2027 if ( VisAfter != NULL &&
2028 REGION_Complexity(VisAfter) == NULLREGION )
2029 {
2030 REGION_Delete(VisAfter);
2031 VisAfter = NULL;
2032 }
2033 else if(VisAfter)
2034 {
2035 REGION_bOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top);
2036 }
2037
2038 /*
2039 * Determine which pixels can be copied from the old window position
2040 * to the new. Those pixels must be visible in both the old and new
2041 * position. Also, check the class style to see if the windows of this
2042 * class need to be completely repainted on (horizontal/vertical) size
2043 * change.
2044 */
2045 if ( ( VisBefore != NULL &&
2046 VisAfter != NULL &&
2047 !(WinPos.flags & SWP_NOCOPYBITS) &&
2048 ((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)) &&
2049 !(Window->ExStyle & WS_EX_TRANSPARENT) ) )
2050 {
2051
2052 /*
2053 * If this is (also) a window resize, the whole nonclient area
2054 * needs to be repainted. So we limit the copy to the client area,
2055 * 'cause there is no use in copying it (would possibly cause
2056 * "flashing" too). However, if the copy region is already empty,
2057 * we don't have to crop (can't take anything away from an empty
2058 * region...)
2059 */
2060
2061 CopyRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
2062 if ((WinPos.flags & SWP_NOSIZE) && (WinPos.flags & SWP_NOCLIENTSIZE))
2063 RgnType = IntGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND);
2064 else if (VisBeforeJustClient != NULL)
2065 {
2066 RgnType = IntGdiCombineRgn(CopyRgn, VisAfter, VisBeforeJustClient, RGN_AND);
2067 }
2068
2069 if (VisBeforeJustClient != NULL)
2070 {
2071 REGION_Delete(VisBeforeJustClient);
2072 }
2073
2074 /* Now use in copying bits which are in the update region. */
2075 if (Window->hrgnUpdate != NULL)
2076 {
2077 PREGION RgnUpdate = REGION_LockRgn(Window->hrgnUpdate);
2078 if (RgnUpdate)
2079 {
2080 REGION_bOffsetRgn(CopyRgn, NewWindowRect.left, NewWindowRect.top);
2082 REGION_bOffsetRgn(CopyRgn, -NewWindowRect.left, -NewWindowRect.top);
2083 REGION_UnlockRgn(RgnUpdate);
2084 }
2085 }
2086
2087 /*
2088 * Now, get the bounding box of the copy region. If it's empty
2089 * there's nothing to copy. Also, it's no use copying bits onto
2090 * themselves.
2091 */
2093 {
2094 /* Nothing to copy, clean up */
2096 CopyRgn = NULL;
2097 }
2098 else if ( OldWindowRect.left != NewWindowRect.left ||
2099 OldWindowRect.top != NewWindowRect.top ||
2100 (WinPos.flags & SWP_FRAMECHANGED) )
2101 {
2102 HRGN DcRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
2103 PREGION DcRgnObj = REGION_LockRgn(DcRgn);
2104
2105 /*
2106 * Small trick here: there is no function to bitblt a region. So
2107 * we set the region as the clipping region, take the bounding box
2108 * of the region and bitblt that. Since nothing outside the clipping
2109 * region is copied, this has the effect of bitblt'ing the region.
2110 *
2111 * Since NtUserGetDCEx takes ownership of the clip region, we need
2112 * to create a copy of CopyRgn and pass that. We need CopyRgn later
2113 */
2115 REGION_bOffsetRgn(DcRgnObj, NewWindowRect.left, NewWindowRect.top);
2116 REGION_UnlockRgn(DcRgnObj);
2117 Dc = UserGetDCEx( Window,
2118 DcRgn,
2119 DCX_WINDOW|DCX_CACHE|DCX_INTERSECTRGN|DCX_CLIPSIBLINGS|DCX_KEEPCLIPRGN); // DCX_WINDOW will set first, go read WinDC.c.
2120 NtGdiBitBlt( Dc,
2121 CopyRect.left, CopyRect.top,
2122 CopyRect.right - CopyRect.left,
2123 CopyRect.bottom - CopyRect.top,
2124 Dc,
2125 CopyRect.left + (OldWindowRect.left - NewWindowRect.left),
2126 CopyRect.top + (OldWindowRect.top - NewWindowRect.top),
2127 SRCCOPY,
2128 0,
2129 0);
2130
2133 GreDeleteObject(DcRgn);
2134 }
2135 }
2136 else
2137 {
2138 CopyRgn = NULL;
2139 }
2140
2141 /* We need to redraw what wasn't visible before or force a redraw */
2142 if (VisAfter != NULL)
2143 {
2144 PREGION DirtyRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
2145 if (DirtyRgn)
2146 {
2147 if (CopyRgn != NULL)
2148 {
2149 RgnType = IntGdiCombineRgn(DirtyRgn, VisAfter, CopyRgn, RGN_DIFF);
2150 }
2151 else
2152 {
2153 RgnType = IntGdiCombineRgn(DirtyRgn, VisAfter, 0, RGN_COPY);
2154 }
2155
2156 if (RgnType != ERROR && RgnType != NULLREGION) // Regions moved.
2157 {
2158 /* old code
2159 NtGdiOffsetRgn(DirtyRgn, Window->rcWindow.left, Window->rcWindow.top);
2160 IntInvalidateWindows( Window,
2161 DirtyRgn,
2162 RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
2163 }
2164 GreDeleteObject(DirtyRgn);
2165 */
2166
2167 PWND Parent = Window->spwndParent;
2168
2169 REGION_bOffsetRgn( DirtyRgn, Window->rcWindow.left, Window->rcWindow.top);
2170
2171 if ( (Window->style & WS_CHILD) && (Parent) && !(Parent->style & WS_CLIPCHILDREN))
2172 {
2175 }
2177 }
2178 else if ( RgnType != ERROR && RgnType == NULLREGION ) // Must be the same. See CORE-7166 & CORE-15934, NC HACK fix.
2179 {
2180 if ( !PosChanged &&
2181 !(WinPos.flags & SWP_DEFERERASE) &&
2182 (WinPos.flags & SWP_FRAMECHANGED) )
2183 {
2184 PWND pwnd = Window;
2185 PWND Parent = Window->spwndParent;
2186
2187 if ( pwnd->style & WS_CHILD ) // Fix ProgMan menu bar drawing.
2188 {
2189 TRACE("SWP_FRAMECHANGED win child %p Parent %p\n",pwnd,Parent);
2190 pwnd = Parent ? Parent : pwnd;
2191 }
2192
2193 if ( !(pwnd->style & WS_CHILD) )
2194 {
2195 /*
2196 * Check if we have these specific windows style bits set/reset.
2197 * FIXME: There may be other combinations of styles that need this handling as well.
2198 * This fixes the ReactOS Calculator buttons disappearing in CORE-16827.
2199 */
2200 if ((Window->style & WS_CLIPSIBLINGS) && !(Window->style & (WS_POPUP | WS_CLIPCHILDREN | WS_SIZEBOX)))
2201 {
2202 IntSendNCPaint(pwnd, HRGN_WINDOW); // Paint the whole frame.
2203 }
2204 else // Use region handling
2205 {
2206 HRGN DcRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
2207 PREGION DcRgnObj = REGION_LockRgn(DcRgn);
2208 TRACE("SWP_FRAMECHANGED win %p hRgn %p\n",pwnd, DcRgn);
2209 IntGdiCombineRgn(DcRgnObj, VisBefore, NULL, RGN_COPY);
2210 REGION_UnlockRgn(DcRgnObj);
2211 ForceNCPaintErase(pwnd, DcRgn, DcRgnObj);
2212 GreDeleteObject(DcRgn);
2213 }
2214 }
2215 }
2216 }
2217 REGION_Delete(DirtyRgn);
2218 }
2219 }
2220
2221 if (CopyRgn != NULL)
2222 {
2224 }
2225
2226 /* Expose what was covered before but not covered anymore */
2227 if ( VisBefore != NULL )
2228 {
2229 PREGION ExposedRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
2230 if (ExposedRgn)
2231 {
2232 RgnType = IntGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY);
2233 REGION_bOffsetRgn(ExposedRgn,
2234 OldWindowRect.left - NewWindowRect.left,
2235 OldWindowRect.top - NewWindowRect.top);
2236
2237 if ( VisAfter != NULL )
2238 RgnType = IntGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF);
2239
2240 if (RgnType != ERROR && RgnType != NULLREGION)
2241 {
2243 }
2244 REGION_Delete(ExposedRgn);
2245 }
2246 REGION_Delete(VisBefore);
2247 }
2248
2249 if (VisAfter != NULL)
2250 {
2251 REGION_Delete(VisAfter);
2252 }
2253 }
2254
2255 if (!(WinPos.flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW)))
2256 {
2257 if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2258 {
2260 }
2261 else
2262 {
2263 //ERR("SetWindowPos Set FG Window!\n");
2264 if ( pti->MessageQueue->spwndActive != Window ||
2265 pti->MessageQueue != gpqForeground )
2266 {
2267 //ERR("WPSWP : set active window\n");
2268 if (!(Window->state & WNDS_BEINGACTIVATED)) // Inside SAW?
2269 {
2270 co_IntSetForegroundWindow(Window); // Fixes SW_HIDE issues. Wine win test_SetActiveWindow & test_SetForegroundWindow.
2271 }
2272 }
2273 }
2274 }
2275
2276 if ( !PosChanged &&
2277 (WinPos.flags & SWP_FRAMECHANGED) &&
2278 !(WinPos.flags & SWP_DEFERERASE) && // Prevent sending WM_SYNCPAINT message.
2279 VisAfter )
2280 {
2281 PWND Parent = Window->spwndParent;
2282 if ( !(Window->style & WS_CHILD) && (Parent) && (Parent->style & WS_CLIPCHILDREN))
2283 {
2284 TRACE("SWP_FRAMECHANGED Parent %p WS_CLIPCHILDREN %p\n",Parent,Window);
2285 UserSyncAndPaintWindows( Parent, RDW_CLIPCHILDREN); // NC should redraw here, see NC HACK fix.
2286 }
2287 }
2288
2289 // Fix wine msg test_SetFocus, prevents sending WM_WINDOWPOSCHANGED.
2290 if ( VisBefore == NULL &&
2291 VisBeforeJustClient == NULL &&
2292 !(Window->ExStyle & WS_EX_TOPMOST) &&
2294 {
2295 TRACE("No drawing, set no Z order and no redraw!\n");
2297 }
2298
2299 if(!(flags & SWP_DEFERERASE))
2300 {
2301 /* erase parent when hiding or resizing child */
2302 if ((flags & SWP_HIDEWINDOW) ||
2303 (!(flags & SWP_SHOWWINDOW) &&
2305 {
2306 PWND Parent = Window->spwndParent;
2309 }
2310
2311 /* Give newly shown windows a chance to redraw */
2314 {
2316 }
2317 }
2318
2319 /* And last, send the WM_WINDOWPOSCHANGED message */
2320
2321 TRACE("\tstatus hwnd %p flags = %04x\n",Window?Window->head.h:NULL,WinPos.flags & SWP_AGG_STATUSFLAGS);
2322
2325 {
2326 /* WM_WINDOWPOSCHANGED is sent even if SWP_NOSENDCHANGING is set
2327 and always contains final window position.
2328 */
2329 WinPos.x = NewWindowRect.left;
2330 WinPos.y = NewWindowRect.top;
2331 WinPos.cx = NewWindowRect.right - NewWindowRect.left;
2332 WinPos.cy = NewWindowRect.bottom - NewWindowRect.top;
2333 TRACE("WM_WINDOWPOSCHANGED hwnd %p Flags %04x\n",WinPos.hwnd,WinPos.flags);
2335 }
2336
2337 if ( WinPos.flags & SWP_FRAMECHANGED || WinPos.flags & SWP_STATECHANGED ||
2338 !(WinPos.flags & SWP_NOCLIENTSIZE) || !(WinPos.flags & SWP_NOCLIENTMOVE) )
2339 {
2340 PWND pWnd = ValidateHwndNoErr(WinPos.hwnd);
2341 if (pWnd)
2342 IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
2343 }
2344
2345 /* Send WM_IME_SYSTEM:IMS_UPDATEIMEUI to the IME windows if necessary */
2346 if ((WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE))
2347 {
2348 if (IS_IMM_MODE())
2350 }
2351
2352 if(bPointerInWindow != IntPtInWindow(Window, gpsi->ptCursor.x, gpsi->ptCursor.y))
2353 {
2354 /* Generate mouse move message */
2355 MSG msg;
2356 msg.message = WM_MOUSEMOVE;
2357 msg.wParam = UserGetMouseButtonsState();
2358 msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
2359 msg.pt = gpsi->ptCursor;
2361 }
2362
2363 return TRUE;
2364}
#define msg(x)
Definition: auth_time.c:54
VOID FASTCALL DceResetActiveDCEs(PWND Window)
Definition: windc.c:816
PSERVERINFO gpsi
Definition: imm.c:18
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define ERROR(name)
Definition: error_private.h:53
BOOL FASTCALL IntCheckFullscreen(PWND Window)
Definition: focus.c:79
VOID FASTCALL UpdateShellHook(PWND Window)
Definition: focus.c:99
GLbitfield flags
Definition: glext.h:7161
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:644
#define WNDS_BEINGACTIVATED
Definition: ntuser.h:620
#define WNDS_SENDNCPAINT
Definition: ntuser.h:611
#define IS_IMM_MODE()
Definition: ntuser.h:1232
#define WEF_SETBYWNDPTI
Definition: ntuser.h:235
#define HRGN_WINDOW
Definition: ntuser.h:356
static HDC
Definition: imagelist.c:92
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
@ WM_ASYNC_SETWINDOWPOS
Definition: msgqueue.h:118
__kernel_entry W32KAPI BOOL APIENTRY NtGdiBitBlt(_In_ HDC hdcDst, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_opt_ HDC hdcSrc, _In_ INT xSrc, _In_ INT ySrc, _In_ DWORD rop4, _In_ DWORD crBackColor, _In_ FLONG fl)
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3980
static BOOL FASTCALL co_WinPosDoWinPosChanging(PWND Window, PWINDOWPOS WinPos, PRECTL WindowRect, PRECTL ClientRect)
Definition: winpos.c:1268
static BOOL FASTCALL WinPosFixupFlags(WINDOWPOS *WinPos, PWND Wnd)
Definition: winpos.c:1552
VOID ForceNCPaintErase(PWND Wnd, HRGN hRgn, PREGION pRgn)
Definition: winpos.c:1692
#define SWP_AGG_STATUSFLAGS
Definition: winpos.c:25
static VOID FASTCALL WinPosInternalMoveWindow(PWND Window, INT MoveX, INT MoveY)
Definition: winpos.c:1522
static BOOL IntValidateParent(PWND Child, PREGION ValidateRgn)
Definition: winpos.c:1058
static HWND FASTCALL WinPosDoOwnedPopups(PWND Window, HWND hWndInsertAfter)
Definition: winpos.c:1356
#define SWP_AGG_NOGEOMETRYCHANGE
Definition: winpos.c:21
#define SWP_AGG_NOPOSCHANGE
Definition: winpos.c:23
VOID SelectWindowRgn(PWND Window, HRGN hRgnClip)
Definition: winpos.c:260
static LONG FASTCALL co_WinPosDoNCCALCSize(PWND Window, PWINDOWPOS WinPos, RECTL *WindowRect, RECTL *ClientRect, RECTL *validRects)
Definition: winpos.c:1181
static VOID FASTCALL IntImeWindowPosChanged(VOID)
Definition: winpos.c:1748
#define RDW_CLIPCHILDREN
Definition: painting.h:15
#define WS_SIZEBOX
Definition: pedump.c:642
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
Definition: region.h:8
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t ULONG
Definition: typedefs.h:59
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:68
VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:620
VOID FASTCALL IntSendNCPaint(PWND pWnd, HRGN hRgn)
Definition: painting.c:348
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:642
HWND FASTCALL UserGetShellWindow(VOID)
Definition: window.c:3669
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
PREGION FASTCALL VIS_ComputeVisibleRegion(PWND Wnd, BOOLEAN ClientArea, BOOLEAN ClipChildren, BOOLEAN ClipSiblings)
Definition: vis.c:13
VOID FASTCALL co_VIS_WindowLayoutChanged(PWND Wnd, PREGION NewlyExposed)
Definition: vis.c:145
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
INT FASTCALL REGION_Complexity(PREGION prgn)
Definition: region.c:564
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2465
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2374
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2389
INT FASTCALL REGION_GetRgnBox(PREGION Rgn, PRECTL pRect)
Definition: region.c:2559
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2423
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2724
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2503
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1374
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1692
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
#define USERTAG_SWP
Definition: tags.h:281
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:176
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:977
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define CopyRgn(hrgnDst, hrgnSrc)
Definition: windowsx.h:73
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define RGN_DIFF
Definition: wingdi.h:358
#define NULLREGION
Definition: wingdi.h:361
#define RGN_COPY
Definition: wingdi.h:357
#define RGN_AND
Definition: wingdi.h:356
#define SRCCOPY
Definition: wingdi.h:333
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
#define DCX_CACHE
Definition: winuser.h:2104
#define DCX_WINDOW
Definition: winuser.h:2103
#define HSHELL_WINDOWDESTROYED
Definition: winuser.h:1246
#define WM_CHILDACTIVATE
Definition: winuser.h:1628
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1245
#define GA_PARENT
Definition: winuser.h:2778
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define RDW_ERASE
Definition: winuser.h:1201
#define RDW_NOCHILDREN
Definition: winuser.h:1212
#define SWP_DEFERERASE
Definition: winuser.h:1242
#define DCX_CLIPSIBLINGS
Definition: winuser.h:2106
#define DCX_INTERSECTRGN
Definition: winuser.h:2112
#define WVR_REDRAW
Definition: winuser.h:2511
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define RDW_ERASENOW
Definition: winuser.h:1209
#define RDW_FRAME
Definition: winuser.h:1202
#define RDW_NOFRAME
Definition: winuser.h:1206
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1652
#define RDW_INVALIDATE
Definition: winuser.h:1204

Referenced by co_IntSendActivateMessages(), co_IntSetForegroundMessageQueue(), co_IntSetParent(), co_IntShowDesktop(), co_UserCreateWindowEx(), co_UserDestroyWindow(), co_UserShowScrollBar(), co_WinPosArrangeIconicWindows(), co_WinPosShowWindow(), DefWndDoSizeMove(), DefWndHandleSetCursor(), DesktopWindowProc(), handle_internal_message(), IntActivateWindow(), IntDefWindowProc(), IntEndDeferWindowPosEx(), IntSetWindowPlacement(), IntUpdateLayeredWindowI(), MENU_ShowPopup(), NC_HandleNCLButtonDblClk(), NtUserCallHwndLock(), NtUserCallTwoParam(), NtUserSetMenu(), NtUserSetShellWindowEx(), NtUserSetWindowPos(), NtUserSetWindowRgn(), SpiNotifyNCMetricsChanged(), and WinPosDoOwnedPopups().

◆ co_WinPosShowWindow()

BOOLEAN FASTCALL co_WinPosShowWindow ( PWND  Wnd,
INT  Cmd 
)

Definition at line 2567 of file winpos.c.

2568{
2569 BOOLEAN WasVisible;
2570 UINT Swp = 0, EventMsg = 0;
2571 RECTL NewPos = {0, 0, 0, 0};
2572 BOOLEAN ShowFlag;
2573 LONG style;
2574 PWND Parent;
2575 PTHREADINFO pti;
2576 //HRGN VisibleRgn;
2577 BOOL ShowOwned = FALSE;
2578 BOOL FirstTime = FALSE;
2579 ASSERT_REFS_CO(Wnd);
2580 //KeRosDumpStackFrames(NULL, 20);
2582 WasVisible = (Wnd->style & WS_VISIBLE) != 0;
2583 style = Wnd->style;
2584
2585 TRACE("co_WinPosShowWindow START hwnd %p Cmd %d usicmd %u\n",
2586 Wnd->head.h, Cmd, pti->ppi->usi.wShowWindow);
2587
2588 if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
2589 {
2590 if ((Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
2591 {
2592 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
2593 {
2594 if (Wnd->spwndOwner == NULL)
2595 {
2596 if ( Cmd == SW_SHOWNORMAL || Cmd == SW_SHOW)
2597 {
2599 }
2600 FirstTime = TRUE;
2601 TRACE("co_WPSW FT 1\n");
2602 }
2603 }
2604 }
2605 }
2606
2607 if ( Cmd == SW_SHOWDEFAULT )
2608 {
2609 if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
2610 {
2611 Cmd = pti->ppi->usi.wShowWindow;
2612 FirstTime = TRUE;
2613 TRACE("co_WPSW FT 2\n");
2614 }
2615 }
2616
2617 if (FirstTime)
2618 {
2620 }
2621
2622 switch (Cmd)
2623 {
2624 case SW_HIDE:
2625 {
2626 if (!WasVisible)
2627 {
2628 //ERR("co_WinPosShowWindow Exit Bad\n");
2629 return FALSE;
2630 }
2632 if (Wnd != pti->MessageQueue->spwndActive)
2634 break;
2635 }
2636
2637 case SW_FORCEMINIMIZE: /* FIXME: Does not work if thread is hung. */
2638 case SW_SHOWMINNOACTIVE:
2640 /* Fall through. */
2641 case SW_SHOWMINIMIZED:
2642 case SW_MINIMIZE: /* CORE-15669: SW_MINIMIZE also shows */
2643 Swp |= SWP_SHOWWINDOW;
2644 {
2645 Swp |= SWP_NOACTIVATE;
2646 if (!(style & WS_MINIMIZE))
2647 {
2649 // Fix wine Win test_SetFocus todo #1 & #2,
2650 if (Cmd == SW_SHOWMINIMIZED)
2651 {
2652 //ERR("co_WinPosShowWindow Set focus 1\n");
2653 if ((style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2655 else
2656 co_UserSetFocus(0);
2657 }
2658
2659 Swp |= co_WinPosMinMaximize(Wnd, Cmd, &NewPos);
2660
2661 EventMsg = EVENT_SYSTEM_MINIMIZESTART;
2662 }
2663 else
2664 {
2665 if (WasVisible)
2666 {
2667 //ERR("co_WinPosShowWindow Exit Good\n");
2668 return TRUE;
2669 }
2670 Swp |= SWP_NOSIZE | SWP_NOMOVE;
2671 }
2672 break;
2673 }
2674
2675 case SW_SHOWMAXIMIZED:
2676 {
2677 Swp |= SWP_SHOWWINDOW;
2678 if (!(style & WS_MAXIMIZE))
2679 {
2680 ShowOwned = TRUE;
2681
2682 Swp |= co_WinPosMinMaximize(Wnd, SW_MAXIMIZE, &NewPos);
2683
2684 EventMsg = EVENT_SYSTEM_MINIMIZEEND;
2685 }
2686 else
2687 {
2688 if (WasVisible)
2689 {
2690 //ERR("co_WinPosShowWindow Exit Good 1\n");
2691 return TRUE;
2692 }
2693 Swp |= SWP_NOSIZE | SWP_NOMOVE;
2694 }
2695 break;
2696 }
2697
2698 case SW_SHOWNA:
2700 if (style & WS_CHILD && !(Wnd->ExStyle & WS_EX_MDICHILD)) Swp |= SWP_NOZORDER;
2701 break;
2702 case SW_SHOW:
2703 if (WasVisible) return(TRUE); // Nothing to do!
2705 /* Don't activate the topmost window. */
2706 if (style & WS_CHILD && !(Wnd->ExStyle & WS_EX_MDICHILD)) Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
2707 break;
2708
2709 case SW_SHOWNOACTIVATE:
2711 /* Fall through. */
2712 case SW_SHOWNORMAL:
2713 case SW_SHOWDEFAULT:
2714 case SW_RESTORE:
2715 if (!WasVisible) Swp |= SWP_SHOWWINDOW;
2716 if (style & (WS_MINIMIZE | WS_MAXIMIZE))
2717 {
2718 Swp |= co_WinPosMinMaximize(Wnd, Cmd, &NewPos);
2719 if (style & WS_MINIMIZE) EventMsg = EVENT_SYSTEM_MINIMIZEEND;
2720 }
2721 else
2722 {
2723 if (WasVisible)
2724 {
2725 //ERR("co_WinPosShowWindow Exit Good 3\n");
2726 return TRUE;
2727 }
2728 Swp |= SWP_NOSIZE | SWP_NOMOVE;
2729 }
2730 if ( style & WS_CHILD &&
2731 !(Wnd->ExStyle & WS_EX_MDICHILD) &&
2732 !(Swp & SWP_STATECHANGED))
2734 break;
2735
2736 default:
2737 //ERR("co_WinPosShowWindow Exit Good 4\n");
2738 return FALSE;
2739 }
2740
2741 ShowFlag = (Cmd != SW_HIDE);
2742
2743 if ((ShowFlag != WasVisible || Cmd == SW_SHOWNA) && Cmd != SW_SHOWMAXIMIZED && !(Swp & SWP_STATECHANGED))
2744 {
2745 co_IntSendMessageNoWait(Wnd->head.h, WM_SHOWWINDOW, ShowFlag, 0);
2746#if 0 // Fix wine msg test_SetParent:WmSetParentSeq_1:2
2747 if (!(Wnd->state2 & WNDS2_WIN31COMPAT)) // <------------- XP sets this bit!
2748 co_IntSendMessageNoWait(Wnd->head.h, WM_SETVISIBLE, ShowFlag, 0);
2749#endif
2750 if (!VerifyWnd(Wnd)) return WasVisible;
2751 }
2752
2753 /* We can't activate a child window */
2754 if ((Wnd->style & WS_CHILD) &&
2755 !(Wnd->ExStyle & WS_EX_MDICHILD) &&
2756 Cmd != SW_SHOWNA)
2757 {
2758 //ERR("SWP Child No active and ZOrder\n");
2760 }
2761
2762#if 0 // Explorer issues with common controls? Someone does not know how CS_SAVEBITS works.
2763 // Breaks startup and shutdown active window...
2764 if ((Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
2765 Wnd->pcls->style & CS_SAVEBITS &&
2766 ((Cmd == SW_SHOW) || (Cmd == SW_NORMAL)))
2767 {
2768 ERR("WinPosShowWindow Set active\n");
2769 //UserSetActiveWindow(Wnd);
2770 co_IntSetForegroundWindow(Wnd); // HACK
2772 }
2773#endif
2774
2775 if (IsChildVisible(Wnd) || Swp & SWP_STATECHANGED)
2776 {
2777 TRACE("Child is Vis %s or State changed %s. ShowFlag %s Swp %04x\n",
2778 (IsChildVisible(Wnd) ? "TRUE" : "FALSE"), (Swp & SWP_STATECHANGED ? "TRUE" : "FALSE"),
2779 (ShowFlag ? "TRUE" : "FALSE"),LOWORD(Swp));
2781 0 != (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP,
2782 NewPos.left,
2783 NewPos.top,
2784 NewPos.right, // NewPos.right - NewPos.left, when minimized and restore, the window becomes smaller.
2785 NewPos.bottom,// NewPos.bottom - NewPos.top,
2786 LOWORD(Swp));
2787 }
2788 else
2789 {
2790 TRACE("Parent Vis?\n");
2791 /* if parent is not visible simply toggle WS_VISIBLE and return */
2792 if (ShowFlag) IntSetStyle( Wnd, WS_VISIBLE, 0 );
2793 else IntSetStyle( Wnd, 0, WS_VISIBLE );
2794 }
2795
2796 if ( EventMsg ) IntNotifyWinEvent(EventMsg, Wnd, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
2797
2798 if ( ShowOwned ) IntShowOwnedPopups(Wnd, TRUE );
2799
2800 if ((Cmd == SW_HIDE) || (Cmd == SW_MINIMIZE))
2801 {
2802 if ( Wnd == pti->MessageQueue->spwndActive && pti->MessageQueue == IntGetFocusMessageQueue() )
2803 {
2805 {
2806 if (!ActivateOtherWindowMin(Wnd))
2807 {
2809 }
2810 }
2811 else
2812 {
2814 }
2815 }
2816
2817 /* Revert focus to parent */
2818 if (Wnd == pti->MessageQueue->spwndFocus)
2819 {
2820 Parent = Wnd->spwndParent;
2822 Parent = 0;
2824 }
2825 // Hide, just return.
2826 if (Cmd == SW_HIDE) return WasVisible;
2827 }
2828
2829 /* FIXME: Check for window destruction. */
2830
2831 if ((Wnd->state & WNDS_SENDSIZEMOVEMSGS) &&
2832 !(Wnd->state2 & WNDS2_INDESTROY))
2833 {
2835 }
2836
2837 /* if previous state was minimized Windows sets focus to the window */
2838 if (style & WS_MINIMIZE)
2839 {
2840 co_UserSetFocus(Wnd);
2841 // Fix wine Win test_SetFocus todo #3,
2843 }
2844 //ERR("co_WinPosShowWindow EXIT\n");
2845 return WasVisible;
2846}
unsigned char BOOLEAN
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1314
#define WNDS2_INDESTROY
Definition: ntuser.h:643
#define WNDS_SENDSIZEMOVEMSGS
Definition: ntuser.h:604
UINT FASTCALL co_WinPosMinMaximize(PWND Wnd, UINT ShowFlag, RECT *NewPos)
Definition: winpos.c:2416
VOID FASTCALL co_WinPosActivateOtherWindow(PWND Wnd)
Definition: winpos.c:398
BOOL FASTCALL IsChildVisible(PWND pWnd)
Definition: winpos.c:227
BOOL FASTCALL ActivateOtherWindowMin(PWND Wnd)
Definition: winpos.c:286
void FASTCALL co_WinPosSendSizeMove(PWND Wnd)
Definition: winpos.c:2382
#define LOWORD(l)
Definition: pedump.c:82
@ Cmd
Definition: sacdrv.h:278
UINT style
Definition: ntuser.h:575
USERSTARTUPINFO usi
Definition: win32.h:278
PPROCESSINFO ppi
Definition: win32.h:88
PCLS pcls
Definition: ntuser.h:715
DWORD state2
Definition: ntuser.h:697
WORD wShowWindow
Definition: win32.h:219
#define WM_SETVISIBLE
Definition: undocuser.h:31
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1307
#define STARTF_USEPOSITION
Definition: winbase.h:493
#define STARTF_USESHOWWINDOW
Definition: winbase.h:491
#define STARTF_USESIZE
Definition: winbase.h:492
#define SW_SHOWMAXIMIZED
Definition: winuser.h:767
#define SW_HIDE
Definition: winuser.h:762
#define HWND_TOPMOST
Definition: winuser.h:1198
#define WM_ACTIVATE
Definition: winuser.h:1602
#define WM_SHOWWINDOW
Definition: winuser.h:1618
#define HWND_TOP
Definition: winuser.h:1197
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define SW_SHOWNA
Definition: winuser.h:772
#define WA_ACTIVE
Definition: winuser.h:2613
#define CS_SAVEBITS
Definition: winuser.h:652
#define SW_SHOW
Definition: winuser.h:769
#define SW_NORMAL
Definition: winuser.h:763

Referenced by co_IntSetParent(), co_UserCreateWindowEx(), co_UserDestroyWindow(), co_UserShowScrollBar(), DefWndHandleSysCommand(), handle_internal_message(), IntDefWindowProc(), IntSetWindowPlacement(), NtUserMinMaximize(), and NtUserShowWindow().

◆ co_WinPosWindowFromPoint()

PWND APIENTRY co_WinPosWindowFromPoint ( IN PWND  ScopeWin,
IN POINT WinPoint,
IN OUT USHORT HitTest,
IN BOOL  Ignore 
)

Definition at line 2934 of file winpos.c.

2939{
2940 PWND Window;
2941 POINT Point = *WinPoint;
2943
2944 if( ScopeWin == NULL )
2945 {
2946 ScopeWin = UserGetDesktopWindow();
2947 if(ScopeWin == NULL)
2948 return NULL;
2949 }
2950
2951 *HitTest = HTNOWHERE;
2952
2953 ASSERT_REFS_CO(ScopeWin);
2954 UserRefObjectCo(ScopeWin, &Ref);
2955
2956 Window = co_WinPosSearchChildren(ScopeWin, &Point, HitTest, Ignore);
2957
2958 UserDerefObjectCo(ScopeWin);
2959 if (Window)
2961 ASSERT_REFS_CO(ScopeWin);
2962
2963 return Window;
2964}

Referenced by co_IntProcessMouseMessage(), and NtUserWindowFromPoint().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserWinpos  )

◆ FixClientRect()

static VOID FASTCALL FixClientRect ( PRECTL  ClientRect,
PRECTL  WindowRect 
)
static

Definition at line 1082 of file winpos.c.

1083{
1084 if (ClientRect->left < WindowRect->left)
1085 {
1086 ClientRect->left = WindowRect->left;
1087 }
1088 else if (WindowRect->right < ClientRect->left)
1089 {
1090 ClientRect->left = WindowRect->right;
1091 }
1092 if (ClientRect->right < WindowRect->left)
1093 {
1094 ClientRect->right = WindowRect->left;
1095 }
1096 else if (WindowRect->right < ClientRect->right)
1097 {
1098 ClientRect->right = WindowRect->right;
1099 }
1100 if (ClientRect->top < WindowRect->top)
1101 {
1102 ClientRect->top = WindowRect->top;
1103 }
1104 else if (WindowRect->bottom < ClientRect->top)
1105 {
1106 ClientRect->top = WindowRect->bottom;
1107 }
1108 if (ClientRect->bottom < WindowRect->top)
1109 {
1110 ClientRect->bottom = WindowRect->top;
1111 }
1112 else if (WindowRect->bottom < ClientRect->bottom)
1113 {
1114 ClientRect->bottom = WindowRect->bottom;
1115 }
1116}

Referenced by co_WinPosDoNCCALCSize(), and co_WinPosGetNonClientSize().

◆ ForceNCPaintErase()

VOID ForceNCPaintErase ( PWND  Wnd,
HRGN  hRgn,
PREGION  pRgn 
)

Definition at line 1692 of file winpos.c.

1693{
1694 HDC hDC;
1695 PREGION RgnUpdate;
1696 UINT RgnType;
1697 BOOL Create = FALSE;
1698
1699 if (Wnd->hrgnUpdate == NULL)
1700 {
1701 Wnd->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0);
1703 Create = TRUE;
1704 }
1705
1706 if (Wnd->hrgnUpdate != HRGN_WINDOW)
1707 {
1708 RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
1709 if (RgnUpdate)
1710 {
1711 RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, pRgn, RGN_OR);
1712 REGION_UnlockRgn(RgnUpdate);
1713 if (RgnType == NULLREGION)
1714 {
1717 Wnd->hrgnUpdate = NULL;
1718 Create = FALSE;
1719 }
1720 }
1721 }
1722
1723 IntSendNCPaint( Wnd, hRgn ); // Region can be deleted by the application.
1724
1725 if (Wnd->hrgnUpdate)
1726 {
1727 hDC = UserGetDCEx( Wnd,
1728 Wnd->hrgnUpdate,
1730
1732 // Kill the loop, so Clear before we send.
1734 {
1736 }
1737 UserReleaseDC(Wnd, hDC, FALSE);
1738 }
1739
1740 if (Create)
1741 {
1744 Wnd->hrgnUpdate = NULL;
1745 }
1746}
static HDC hDC
Definition: 3dtext.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
@ Create
Definition: registry.c:563
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:610
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:609
static HRGN hRgn
Definition: mapping.c:33
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
HRGN hrgnUpdate
Definition: ntuser.h:716
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2475
#define RGN_OR
Definition: wingdi.h:359
#define WM_ERASEBKGND
Definition: winuser.h:1615

Referenced by co_WinPosSetWindowPos().

◆ get_valid_rects()

static VOID FASTCALL get_valid_rects ( RECTL old_client,
RECTL new_client,
UINT  flags,
RECTL valid 
)
static

Definition at line 1125 of file winpos.c.

1126{
1127 int cx, cy;
1128
1129 if (flags & WVR_REDRAW)
1130 {
1133 return;
1134 }
1135
1136 if (flags & WVR_VALIDRECTS)
1137 {
1138 if (!RECTL_bIntersectRect( &valid[0], &valid[0], new_client ) ||
1139 !RECTL_bIntersectRect( &valid[1], &valid[1], old_client ))
1140 {
1143 return;
1144 }
1146 }
1147 else
1148 {
1149 valid[0] = *new_client;
1150 valid[1] = *old_client;
1151 }
1152
1153 /* make sure the rectangles have the same size */
1154 cx = min( valid[0].right - valid[0].left, valid[1].right - valid[1].left );
1155 cy = min( valid[0].bottom - valid[0].top, valid[1].bottom - valid[1].top );
1156
1157 if (flags & WVR_ALIGNBOTTOM)
1158 {
1159 valid[0].top = valid[0].bottom - cy;
1160 valid[1].top = valid[1].bottom - cy;
1161 }
1162 else
1163 {
1164 valid[0].bottom = valid[0].top + cy;
1165 valid[1].bottom = valid[1].top + cy;
1166 }
1167 if (flags & WVR_ALIGNRIGHT)
1168 {
1169 valid[0].left = valid[0].right - cx;
1170 valid[1].left = valid[1].right - cx;
1171 }
1172 else
1173 {
1174 valid[0].right = valid[0].left + cx;
1175 valid[1].right = valid[1].left + cx;
1176 }
1177}
BOOLEAN valid
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
#define min(a, b)
Definition: monoChain.cc:55
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
#define WVR_VALIDRECTS
Definition: winuser.h:2512
#define WVR_ALIGNTOP
Definition: winuser.h:2505
#define WVR_ALIGNLEFT
Definition: winuser.h:2506
#define WVR_ALIGNRIGHT
Definition: winuser.h:2508
#define WVR_ALIGNBOTTOM
Definition: winuser.h:2507

Referenced by co_WinPosDoNCCALCSize().

◆ IntChildWindowFromPointEx()

PWND APIENTRY IntChildWindowFromPointEx ( PWND  Parent,
LONG  x,
LONG  y,
UINT  uiFlags 
)

Definition at line 3011 of file winpos.c.

3012{
3013 POINTL Pt;
3014 HWND *List, *phWnd;
3015 PWND pwndHit = NULL;
3016
3017 Pt.x = x;
3018 Pt.y = y;
3019
3021 {
3022 if (Parent->ExStyle & WS_EX_LAYOUTRTL)
3023 Pt.x = Parent->rcClient.right - Pt.x;
3024 else
3025 Pt.x += Parent->rcClient.left;
3026 Pt.y += Parent->rcClient.top;
3027 }
3028
3029 if (!IntPtInWindow(Parent, Pt.x, Pt.y)) return NULL;
3030
3032 {
3033 for (phWnd = List; *phWnd; phWnd++)
3034 {
3035 PWND Child;
3036 if ((Child = ValidateHwndNoErr(*phWnd)))
3037 {
3038 if (uiFlags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED))
3039 {
3040 if (!(Child->style & WS_VISIBLE) && (uiFlags & CWP_SKIPINVISIBLE)) continue;
3041 if ((Child->style & WS_DISABLED) && (uiFlags & CWP_SKIPDISABLED)) continue;
3042 }
3043
3044 if (uiFlags & CWP_SKIPTRANSPARENT)
3045 {
3046 if (Child->ExStyle & WS_EX_TRANSPARENT) continue;
3047 }
3048
3049 if (IntPtInWindow(Child, Pt.x, Pt.y))
3050 {
3051 pwndHit = Child;
3052 break;
3053 }
3054 }
3055 }
3057 }
3058 return pwndHit ? pwndHit : Parent;
3059}
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define CWP_SKIPTRANSPARENT
Definition: winuser.h:210
#define CWP_SKIPDISABLED
Definition: winuser.h:209
#define CWP_SKIPINVISIBLE
Definition: winuser.h:208

Referenced by NtUserChildWindowFromPointEx().

◆ IntClientToScreen()

BOOL FASTCALL IntClientToScreen ( PWND  Wnd,
LPPOINT  lpPoint 
)

Definition at line 200 of file winpos.c.

201{
202 if (Wnd && Wnd->fnid != FNID_DESKTOP )
203 {
204 if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
205 lpPoint->x = Wnd->rcClient.right - lpPoint->x;
206 else
207 lpPoint->x += Wnd->rcClient.left;
208 lpPoint->y += Wnd->rcClient.top;
209 }
210 return TRUE;
211}
#define FNID_DESKTOP
Definition: ntuser.h:857
DWORD fnid
Definition: ntuser.h:704

Referenced by IntDefWindowProc(), NC_GetSysPopupPos(), and WinPosFixupFlags().

◆ IntDeferWindowPos()

HDWP FASTCALL IntDeferWindowPos ( HDWP  hdwp,
HWND  hwnd,
HWND  hwndAfter,
INT  x,
INT  y,
INT  cx,
INT  cy,
UINT  flags 
)

Definition at line 3064 of file winpos.c.

3072{
3073 PSMWP pDWP;
3074 int i;
3075 HDWP retvalue = hdwp;
3076
3077 TRACE("hdwp %p, hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
3078 hdwp, hwnd, hwndAfter, x, y, cx, cy, flags);
3079
3080 if (flags & ~(SWP_NOSIZE | SWP_NOMOVE |
3085 {
3087 return NULL;
3088 }
3089
3090 if (!(pDWP = (PSMWP)UserGetObject(gHandleTable, hdwp, TYPE_SETWINDOWPOS)))
3091 {
3093 return NULL;
3094 }
3095
3096 for (i = 0; i < pDWP->ccvr; i++)
3097 {
3098 if (pDWP->acvr[i].pos.hwnd == hwnd)
3099 {
3100 /* Merge with the other changes */
3101 if (!(flags & SWP_NOZORDER))
3102 {
3103 pDWP->acvr[i].pos.hwndInsertAfter = hwndAfter;
3104 }
3105 if (!(flags & SWP_NOMOVE))
3106 {
3107 pDWP->acvr[i].pos.x = x;
3108 pDWP->acvr[i].pos.y = y;
3109 }
3110 if (!(flags & SWP_NOSIZE))
3111 {
3112 pDWP->acvr[i].pos.cx = cx;
3113 pDWP->acvr[i].pos.cy = cy;
3114 }
3115 pDWP->acvr[i].pos.flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
3121 goto END;
3122 }
3123 }
3124 if (pDWP->ccvr >= pDWP->ccvrAlloc)
3125 {
3126 PCVR newpos = ExAllocatePoolWithTag(PagedPool, pDWP->ccvrAlloc * 2 * sizeof(CVR), USERTAG_SWP);
3127 if (!newpos)
3128 {
3129 retvalue = NULL;
3130 goto END;
3131 }
3132 RtlZeroMemory(newpos, pDWP->ccvrAlloc * 2 * sizeof(CVR));
3133 RtlCopyMemory(newpos, pDWP->acvr, pDWP->ccvrAlloc * sizeof(CVR));
3135 pDWP->ccvrAlloc *= 2;
3136 pDWP->acvr = newpos;
3137 }
3138 pDWP->acvr[pDWP->ccvr].pos.hwnd = hwnd;
3139 pDWP->acvr[pDWP->ccvr].pos.hwndInsertAfter = hwndAfter;
3140 pDWP->acvr[pDWP->ccvr].pos.x = x;
3141 pDWP->acvr[pDWP->ccvr].pos.y = y;
3142 pDWP->acvr[pDWP->ccvr].pos.cx = cx;
3143 pDWP->acvr[pDWP->ccvr].pos.cy = cy;
3144 pDWP->acvr[pDWP->ccvr].pos.flags = flags;
3145 pDWP->acvr[pDWP->ccvr].hrgnClip = NULL;
3146 pDWP->acvr[pDWP->ccvr].hrgnInterMonitor = NULL;
3147 pDWP->ccvr++;
3148END:
3149 return retvalue;
3150}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
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
@ TYPE_SETWINDOWPOS
Definition: ntuser.h:44
#define END
Definition: options.h:105
Definition: winpos.h:4
WINDOWPOS pos
Definition: winpos.h:5
HRGN hrgnClip
Definition: winpos.h:16
HRGN hrgnInterMonitor
Definition: winpos.h:17
Definition: winpos.h:21
PCVR acvr
Definition: winpos.h:27
INT ccvr
Definition: winpos.h:25
INT ccvrAlloc
Definition: winpos.h:26
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:495
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define ERROR_INVALID_DWP_HANDLE
Definition: winerror.h:886
#define SWP_NOOWNERZORDER
Definition: winuser.h:1239

Referenced by NtUserDeferWindowPos().

◆ IntEndDeferWindowPosEx()

BOOL FASTCALL IntEndDeferWindowPosEx ( HDWP  hdwp,
BOOL  bAsync 
)

Definition at line 3153 of file winpos.c.

3154{
3155 PSMWP pDWP;
3156 PCVR winpos;
3157 BOOL res = TRUE;
3158 int i;
3159
3160 TRACE("%p\n", hdwp);
3161
3162 if (!(pDWP = (PSMWP)UserGetObject(gHandleTable, hdwp, TYPE_SETWINDOWPOS)))
3163 {
3165 return FALSE;
3166 }
3167
3168 for (i = 0, winpos = pDWP->acvr; res && i < pDWP->ccvr; i++, winpos++)
3169 {
3170 PWND pwnd;
3172
3173 TRACE("hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
3174 winpos->pos.hwnd, winpos->pos.hwndInsertAfter, winpos->pos.x, winpos->pos.y,
3175 winpos->pos.cx, winpos->pos.cy, winpos->pos.flags);
3176
3177 pwnd = ValidateHwndNoErr(winpos->pos.hwnd);
3178 if (!pwnd)
3179 continue;
3180
3181 UserRefObjectCo(pwnd, &Ref);
3182
3183 if (bAsync)
3184 {
3185 LRESULT lRes;
3187 if ( ppos )
3188 {
3189 *ppos = winpos->pos;
3190 /* Yes it's a pointer inside Win32k! */
3191 lRes = co_IntSendMessageNoWait( winpos->pos.hwnd, WM_ASYNC_SETWINDOWPOS, 0, (LPARAM)ppos);
3192 /* We handle this the same way as Event Hooks and Hooks. */
3193 if ( !lRes )
3194 {
3196 }
3197 }
3198 }
3199 else
3200 res = co_WinPosSetWindowPos( pwnd,
3201 winpos->pos.hwndInsertAfter,
3202 winpos->pos.x,
3203 winpos->pos.y,
3204 winpos->pos.cx,
3205 winpos->pos.cy,
3206 winpos->pos.flags);
3207
3208 // Hack to pass tests.... Must have some work to do so clear the error.
3209 if (res && (winpos->pos.flags & (SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER)) == SWP_NOZORDER )
3211
3212 UserDerefObjectCo(pwnd);
3213 }
3214
3218 return res;
3219}
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint res
Definition: glext.h:9613
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:717

Referenced by NtUserEndDeferWindowPosEx().

◆ IntGetClientOrigin()

BOOL FASTCALL IntGetClientOrigin ( PWND Window  OPTIONAL,
LPPOINT  Point 
)

Definition at line 72 of file winpos.c.

73{
75 if (Window == NULL)
76 {
77 Point->x = Point->y = 0;
78 return FALSE;
79 }
80 Point->x = Window->rcClient.left;
81 Point->y = Window->rcClient.top;
82
83 return TRUE;
84}

Referenced by co_IntFixCaret(), and IntScrollWindowEx().

◆ IntGetClientRect()

VOID FASTCALL IntGetClientRect ( PWND  Wnd,
RECTL Rect 
)

Internal function. Returns client window rectangle relative to the upper-left corner of client area.

Note
Does not check the validity of the parameters

Definition at line 93 of file winpos.c.

94{
95 ASSERT( Wnd );
96 ASSERT( Rect );
97 if (Wnd->style & WS_MINIMIZED)
98 {
99 Rect->left = Rect->top = 0;
102 return;
103 }
104 if (!UserIsDesktopWindow(Wnd))
105 {
106 *Rect = Wnd->rcClient;
108 }
109 else
110 {
111 Rect->left = Rect->top = 0;
112 Rect->right = Wnd->rcClient.right;
113 Rect->bottom = Wnd->rcClient.bottom;
114 /* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
115 Rect->right = UserGetSystemMetrics(SM_CXSCREEN);
116 Rect->bottom = UserGetSystemMetrics(SM_CYSCREEN);
117 */
118 }
119}
#define ASSERT(a)
Definition: mode.c:44
#define WS_MINIMIZED
Definition: undocuser.h:18

Referenced by co_IntDrawCaret(), co_WinPosArrangeIconicWindows(), co_WinPosGetMinMaxInfo(), co_WinPosSendSizeMove(), DefWndDoSizeMove(), DefWndHandleWindowPosChanged(), IntBeginPaint(), IntCalculateThumb(), IntDefWindowProc(), IntFillWindow(), IntGetScrollBarRect(), IntScrollWindowEx(), MENU_DrawPopupMenu(), MENU_EnsureMenuItemVisible(), NC_DoNCPaint(), and WinPosFindIconPos().

◆ IntGetLastTopMostWindow()

PWND FASTCALL IntGetLastTopMostWindow ( VOID  )

Definition at line 239 of file winpos.c.

240{
241 PWND pWnd;
242 PDESKTOP rpdesk = gptiCurrent->rpdesk;
243
244 if ( rpdesk &&
245 (pWnd = rpdesk->pDeskInfo->spwnd->spwndChild) &&
246 pWnd->ExStyle & WS_EX_TOPMOST)
247 {
248 for (;;)
249 {
250 if (!pWnd->spwndNext) break;
251 if (!(pWnd->spwndNext->ExStyle & WS_EX_TOPMOST)) break;
252 pWnd = pWnd->spwndNext;
253 }
254 return pWnd;
255 }
256 return NULL;
257}
struct _WND * spwnd
Definition: ntuser.h:137
PDESKTOPINFO pDeskInfo
Definition: desktop.h:8
struct _DESKTOP * rpdesk
Definition: win32.h:92

Referenced by ActivateOtherWindowMin().

◆ IntGetWindowBorderMeasures()

VOID FASTCALL IntGetWindowBorderMeasures ( PWND  Wnd,
UINT cx,
UINT cy 
)

Definition at line 862 of file winpos.c.

863{
864 if(HAS_DLGFRAME(Wnd->style, Wnd->ExStyle) && !(Wnd->style & WS_MINIMIZE))
865 {
868 }
869 else
870 {
871 if(HAS_THICKFRAME(Wnd->style, Wnd->ExStyle)&& !(Wnd->style & WS_MINIMIZE))
872 {
875 }
876 else if(HAS_THINFRAME(Wnd->style, Wnd->ExStyle))
877 {
880 }
881 else
882 {
883 *cx = *cy = 0;
884 }
885 }
886}
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:9
#define HAS_THINFRAME(Style, ExStyle)
Definition: window.h:17
#define HAS_THICKFRAME(Style, ExStyle)
Definition: window.h:13

◆ IntGetWindowBorders()

DWORD IntGetWindowBorders ( DWORD  Style,
DWORD  ExStyle 
)

Definition at line 916 of file winpos.c.

917{
918 DWORD adjust = 0;
919
920 if ( ExStyle & WS_EX_WINDOWEDGE ) // 1st
921 adjust = 2; /* outer */
922 else if ( ExStyle & WS_EX_STATICEDGE ) // 2nd
923 adjust = 1; /* for the outer frame always present */
924
926 adjust += 2;
927
929 adjust++; /* The other border */
930
931 return adjust;
932}
const DWORD Style
Definition: appswitch.c:71
const DWORD ExStyle
Definition: appswitch.c:72
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384

Referenced by co_WinPosGetMinMaxInfo().

◆ IntGetWindowPlacement()

BOOL FASTCALL IntGetWindowPlacement ( PWND  Wnd,
WINDOWPLACEMENT lpwndpl 
)

Definition at line 560 of file winpos.c.

561{
562 if (!Wnd) return FALSE;
563
564 if(lpwndpl->length != sizeof(WINDOWPLACEMENT))
565 {
566 return FALSE;
567 }
568
569 lpwndpl->flags = 0;
570
572
573 lpwndpl->showCmd = SW_HIDE;
574
575 if ( Wnd->style & WS_MINIMIZE )
576 lpwndpl->showCmd = SW_SHOWMINIMIZED;
577 else
578 lpwndpl->showCmd = ( Wnd->style & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
579
580 lpwndpl->rcNormalPosition = Wnd->InternalPos.NormalRect;
581
582 if (Wnd->InternalPos.flags & WPF_MININIT) // Return if it was set!
583 {
584 lpwndpl->ptMinPosition.x = Wnd->InternalPos.IconPos.x;
585 lpwndpl->ptMinPosition.y = Wnd->InternalPos.IconPos.y;
586 }
587 else
588 lpwndpl->ptMinPosition.x = lpwndpl->ptMinPosition.y = -1;
589
590 if ( Wnd->InternalPos.flags & WPF_MAXINIT && // Return if set and not maximized to monitor!
592 {
593 lpwndpl->ptMaxPosition.x = Wnd->InternalPos.MaxPos.x;
594 lpwndpl->ptMaxPosition.y = Wnd->InternalPos.MaxPos.y;
595 }
596 else
597 lpwndpl->ptMaxPosition.x = lpwndpl->ptMaxPosition.y = -1;
598
599 if ( Wnd->spwndParent == Wnd->head.rpdesk->pDeskInfo->spwnd &&
600 !(Wnd->ExStyle & WS_EX_TOOLWINDOW))
601 {
602 PMONITOR pmonitor = UserMonitorFromRect(&lpwndpl->rcNormalPosition, MONITOR_DEFAULTTOPRIMARY );
603
604 // FIXME: support DPI aware, rcWorkDPI/Real etc..
605 if (Wnd->InternalPos.flags & WPF_MININIT)
606 {
607 lpwndpl->ptMinPosition.x -= (pmonitor->rcWork.left - pmonitor->rcMonitor.left);
608 lpwndpl->ptMinPosition.y -= (pmonitor->rcWork.top - pmonitor->rcMonitor.top);
609 }
611 pmonitor->rcMonitor.left - pmonitor->rcWork.left,
612 pmonitor->rcMonitor.top - pmonitor->rcWork.top);
613 }
614
615 if ( Wnd->InternalPos.flags & WPF_RESTORETOMAXIMIZED || Wnd->style & WS_MAXIMIZE )
616 lpwndpl->flags |= WPF_RESTORETOMAXIMIZED;
617
618 if ( ((Wnd->style & (WS_CHILD|WS_POPUP)) == WS_CHILD) && Wnd->InternalPos.flags & WPF_SETMINPOSITION)
619 lpwndpl->flags |= WPF_SETMINPOSITION;
620
621 return TRUE;
622}
#define WPF_MAXINIT
Definition: ntuser.h:682
VOID FASTCALL WinPosInitInternalPos(PWND Wnd, RECTL *RestoreRect)
Definition: winpos.c:481
struct _DESKTOP * rpdesk
Definition: ntuser.h:194
RECT rcWindow
Definition: ntuser.h:711
PMONITOR NTAPI UserMonitorFromRect(PRECTL pRect, DWORD dwFlags)
Definition: monitor.c:405

Referenced by co_WinPosMinMaximize(), NtUserGetInternalWindowPos(), and NtUserGetWindowPlacement().

◆ IntGetWindowRect()

BOOL FASTCALL IntGetWindowRect ( PWND  Wnd,
RECTL Rect 
)

Definition at line 122 of file winpos.c.

123{
124 ASSERT( Wnd );
125 ASSERT( Rect );
126 if (!Wnd) return FALSE;
127 if (!UserIsDesktopWindow(Wnd))
128 {
129 *Rect = Wnd->rcWindow;
130 }
131 else
132 {
133 Rect->left = Rect->top = 0;
134 Rect->right = Wnd->rcWindow.right;
135 Rect->bottom = Wnd->rcWindow.bottom;
136/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
137 Rect->right = GetSystemMetrics(SM_CXSCREEN);
138 Rect->bottom = GetSystemMetrics(SM_CYSCREEN);
139*/ }
140 return TRUE;
141}

Referenced by DefWndScreenshot(), IntGetNCUpdateRgn(), IntIsWindowFullscreen(), MENU_FindItemByCoords(), MENU_ShowSubPopup(), NC_DoNCPaint(), NC_GetSysPopupPos(), UserDrawCaptionBar(), and UserDrawCaptionButtonWnd().

◆ IntImeWindowPosChanged()

static VOID FASTCALL IntImeWindowPosChanged ( VOID  )
static

Definition at line 1748 of file winpos.c.

1749{
1750 HWND *phwnd;
1751 PWND pwndNode, pwndDesktop = UserGetDesktopWindow();
1752 PWINDOWLIST pWL;
1754
1755 if (!pwndDesktop)
1756 return;
1757
1758 /* Enumerate the windows to get the IME windows (of default and non-default) */
1759 pWL = IntBuildHwndList(pwndDesktop->spwndChild, IACE_LIST, gptiCurrent);
1760 if (!pWL)
1761 return;
1762
1763 for (phwnd = pWL->ahwnd; *phwnd != HWND_TERMINATOR; ++phwnd)
1764 {
1766 break;
1767
1768 pwndNode = ValidateHwndNoErr(*phwnd);
1769 if (pwndNode == NULL ||
1770 pwndNode->head.pti != gptiCurrent ||
1772 {
1773 continue;
1774 }
1775
1776 /* Now hwndNode is an IME window of the current thread */
1777 UserRefObjectCo(pwndNode, &Ref);
1779 UserDerefObjectCo(pwndNode);
1780 }
1781
1782 IntFreeHwndList(pWL);
1783}
#define IMS_UPDATEIMEUI
Definition: immdev.h:29
#define ICLS_IME
Definition: ntuser.h:922
#define TIF_INCLEANUP
Definition: ntuser.h:262
RTL_ATOM atomClassName
Definition: ntuser.h:563
FLONG TIF_flags
Definition: win32.h:95
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1055
HWND ahwnd[ANYSIZE_ARRAY]
Definition: window.h:91
#define WM_IME_SYSTEM
Definition: undocuser.h:60
VOID FASTCALL IntFreeHwndList(PWINDOWLIST pwlTarget)
Definition: window.c:1456
PWINDOWLIST FASTCALL IntBuildHwndList(PWND pwnd, DWORD dwFlags, PTHREADINFO pti)
Definition: window.c:1410
#define HWND_TERMINATOR
Definition: window.h:83
#define IACE_LIST
Definition: window.h:106

Referenced by co_WinPosSetWindowPos().

◆ IntMapWindowPoints()

INT FASTCALL IntMapWindowPoints ( PWND  FromWnd,
PWND  ToWnd,
LPPOINT  lpPoints,
UINT  cPoints 
)

Definition at line 145 of file winpos.c.

146{
147 BOOL mirror_from, mirror_to;
148 POINT Delta;
149 UINT i;
150 int Change = 1;
151
152 /* Note: Desktop Top and Left is always 0! */
153 Delta.x = Delta.y = 0;
154 mirror_from = mirror_to = FALSE;
155
156 if (FromWnd && !UserIsDesktopWindow(FromWnd))
157 {
158 if (FromWnd->ExStyle & WS_EX_LAYOUTRTL)
159 {
160 mirror_from = TRUE;
161 Change = -Change;
162 Delta.x = -FromWnd->rcClient.right;
163 }
164 else
165 Delta.x = FromWnd->rcClient.left;
166 Delta.y = FromWnd->rcClient.top;
167 }
168
169 if (ToWnd && !UserIsDesktopWindow(ToWnd))
170 {
171 if (ToWnd->ExStyle & WS_EX_LAYOUTRTL)
172 {
173 mirror_to = TRUE;
174 Change = -Change;
175 Delta.x += Change * ToWnd->rcClient.right;
176 }
177 else
178 Delta.x -= Change * ToWnd->rcClient.left;
179 Delta.y -= ToWnd->rcClient.top;
180 }
181
182 for (i = 0; i != cPoints; i++)
183 {
184 lpPoints[i].x += Delta.x;
185 lpPoints[i].x *= Change;
186 lpPoints[i].y += Delta.y;
187 }
188
189 if ((mirror_from || mirror_to) && cPoints == 2) /* special case for rectangle */
190 {
191 int tmp = min(lpPoints[0].x, lpPoints[1].x);
192 lpPoints[1].x = max(lpPoints[0].x, lpPoints[1].x);
193 lpPoints[0].x = tmp;
194 }
195
196 return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y));
197}
static ULONG Delta
Definition: xboxvideo.c:33

Referenced by DefWndDoSizeMove(), and DefWndHandleWindowPosChanged().

◆ IntRealChildWindowFromPoint()

PWND FASTCALL IntRealChildWindowFromPoint ( PWND  Parent,
LONG  x,
LONG  y 
)

Definition at line 2968 of file winpos.c.

2969{
2970 POINTL Pt;
2971 HWND *List, *phWnd;
2972 PWND pwndHit = NULL;
2973
2974 Pt.x = x;
2975 Pt.y = y;
2976
2978 {
2979 Pt.x += Parent->rcClient.left;
2980 Pt.y += Parent->rcClient.top;
2981 }
2982
2983 if (!IntPtInWindow(Parent, Pt.x, Pt.y)) return NULL;
2984
2986 {
2987 for (phWnd = List; *phWnd; phWnd++)
2988 {
2989 PWND Child;
2990 if ((Child = ValidateHwndNoErr(*phWnd)))
2991 {
2992 if ( Child->style & WS_VISIBLE && IntPtInWindow(Child, Pt.x, Pt.y) )
2993 {
2994 if ( Child->pcls->atomClassName != gpsi->atomSysClass[ICLS_BUTTON] ||
2995 (Child->style & BS_TYPEMASK) != BS_GROUPBOX )
2996 {
2998 return Child;
2999 }
3000 pwndHit = Child;
3001 }
3002 }
3003 }
3005 }
3006 return pwndHit ? pwndHit : Parent;
3007}
#define ICLS_BUTTON
Definition: ntuser.h:907
#define BS_GROUPBOX
Definition: pedump.c:658
#define BS_TYPEMASK
Definition: winuser.h:270

Referenced by NtUserRealChildWindowFromPoint().

◆ IntScreenToClient()

BOOL FASTCALL IntScreenToClient ( PWND  Wnd,
LPPOINT  lpPoint 
)

Definition at line 214 of file winpos.c.

215{
216 if (Wnd && Wnd->fnid != FNID_DESKTOP )
217 {
218 if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
219 lpPoint->x = Wnd->rcClient.right - lpPoint->x;
220 else
221 lpPoint->x -= Wnd->rcClient.left;
222 lpPoint->y -= Wnd->rcClient.top;
223 }
224 return TRUE;
225}

Referenced by co_IntSetParent(), IntDefWindowProc(), and MENU_TrackMouseMenuBar().

◆ IntSetWindowPlacement()

BOOL FASTCALL IntSetWindowPlacement ( PWND  Wnd,
WINDOWPLACEMENT wpl,
UINT  Flags 
)

Definition at line 666 of file winpos.c.

667{
668 BOOL sAsync;
669 UINT SWP_Flags;
670
674
675 if (!Wnd || Wnd == Wnd->head.rpdesk->pDeskInfo->spwnd) return FALSE;
676
677 if ( Flags & PLACE_MIN ) Wnd->InternalPos.IconPos = wpl->ptMinPosition;
678 if ( Flags & PLACE_MAX ) Wnd->InternalPos.MaxPos = wpl->ptMaxPosition;
679 if ( Flags & PLACE_RECT) Wnd->InternalPos.NormalRect = wpl->rcNormalPosition;
680
681 SWP_Flags = SWP_NOZORDER | SWP_NOACTIVATE | ((wpl->flags & WPF_ASYNCWINDOWPLACEMENT) ? SWP_ASYNCWINDOWPOS : 0);
682
683 if (Wnd->style & WS_MINIMIZE )
684 {
685 if (Flags & PLACE_MIN || Wnd->InternalPos.flags & WPF_SETMINPOSITION)
686 {
688 wpl->ptMinPosition.x, wpl->ptMinPosition.y, 0, 0,
689 SWP_NOSIZE | SWP_Flags);
690 Wnd->InternalPos.flags |= WPF_MININIT;
691 }
692 }
693 else if (Wnd->style & WS_MAXIMIZE )
694 {
695 if (Flags & PLACE_MAX)
696 {
698 wpl->ptMaxPosition.x, wpl->ptMaxPosition.y, 0, 0,
699 SWP_NOSIZE | SWP_Flags);
700 Wnd->InternalPos.flags |= WPF_MAXINIT;
701 }
702 }
703 else if (Flags & PLACE_RECT)
704 {
709 SWP_Flags);
710 }
711
712 sAsync = (Wnd->head.pti->MessageQueue != gptiCurrent->MessageQueue && wpl->flags & WPF_ASYNCWINDOWPLACEMENT);
713
714 if ( sAsync )
716 else
717 co_WinPosShowWindow(Wnd, wpl->showCmd);
718
719 if ( Wnd->style & WS_MINIMIZE && !sAsync )
720 {
721 if ( wpl->flags & WPF_SETMINPOSITION )
722 Wnd->InternalPos.flags |= WPF_SETMINPOSITION;
723
724 if ( wpl->flags & WPF_RESTORETOMAXIMIZED )
726 }
727 return TRUE;
728}
@ WM_ASYNC_SHOWWINDOW
Definition: msgqueue.h:117
static void make_point_onscreen(POINT *pt)
Definition: winpos.c:655
static void make_rect_onscreen(RECT *rect)
Definition: winpos.c:625
#define PLACE_RECT
Definition: winpos.c:33
#define PLACE_MAX
Definition: winpos.c:32
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2567
#define PLACE_MIN
Definition: winpos.c:31
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by NtUserSetInternalWindowPos(), and NtUserSetWindowPlacement().

◆ IntValidateParent()

static BOOL IntValidateParent ( PWND  Child,
PREGION  ValidateRgn 
)
static

Definition at line 1058 of file winpos.c.

1059{
1060 PWND ParentWnd = Child->spwndParent;
1061
1062 while (ParentWnd)
1063 {
1064 if (ParentWnd->style & WS_CLIPCHILDREN)
1065 break;
1066
1067 if (ParentWnd->hrgnUpdate != 0)
1068 {
1069 IntInvalidateWindows( ParentWnd,
1072 }
1073
1074 ParentWnd = ParentWnd->spwndParent;
1075 }
1076
1077 return TRUE;
1078}
BOOL WINAPI ValidateRgn(_In_ HWND, _In_opt_ HRGN)

Referenced by co_WinPosSetWindowPos().

◆ IsChildVisible()

BOOL FASTCALL IsChildVisible ( PWND  pWnd)

Definition at line 227 of file winpos.c.

228{
229 do
230 {
231 if ( (pWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD ||
232 !(pWnd = pWnd->spwndParent) )
233 return TRUE;
234 }
235 while (pWnd->style & WS_VISIBLE);
236 return FALSE;
237}

Referenced by co_WinPosShowWindow().

◆ make_point_onscreen()

static void make_point_onscreen ( POINT pt)
static

Definition at line 655 of file winpos.c.

656{
657 RECT rect;
658
659 RECTL_vSetRect( &rect, pt->x, pt->y, pt->x + 1, pt->y + 1 );
661 pt->x = rect.left;
662 pt->y = rect.top;
663}
#define pt(x, y)
Definition: drawing.c:79
& rect
Definition: startmenu.cpp:1413

Referenced by IntSetWindowPlacement().

◆ make_rect_onscreen()

static void make_rect_onscreen ( RECT rect)
static

Definition at line 625 of file winpos.c.

626{
627 PMONITOR pmonitor = UserMonitorFromRect( rect, MONITOR_DEFAULTTONEAREST ); // Wine uses this.
628
629 // FIXME: support DPI aware, rcWorkDPI/Real etc..
630 if (!pmonitor) return;
631 /* FIXME: map coordinates from rcWork to rcMonitor */
632 if (rect->right <= pmonitor->rcWork.left)
633 {
634 rect->right += pmonitor->rcWork.left - rect->left;
635 rect->left = pmonitor->rcWork.left;
636 }
637 else if (rect->left >= pmonitor->rcWork.right)
638 {
639 rect->left += pmonitor->rcWork.right - rect->right;
640 rect->right = pmonitor->rcWork.right;
641 }
642 if (rect->bottom <= pmonitor->rcWork.top)
643 {
644 rect->bottom += pmonitor->rcWork.top - rect->top;
645 rect->top = pmonitor->rcWork.top;
646 }
647 else if (rect->top >= pmonitor->rcWork.bottom)
648 {
649 rect->top += pmonitor->rcWork.bottom - rect->bottom;
650 rect->bottom = pmonitor->rcWork.bottom;
651 }
652}

Referenced by IntSetWindowPlacement(), and make_point_onscreen().

◆ NtUserChildWindowFromPointEx()

HWND APIENTRY NtUserChildWindowFromPointEx ( HWND  hwndParent,
LONG  x,
LONG  y,
UINT  uiFlags 
)

Definition at line 3225 of file winpos.c.

3229{
3230 PWND pwndParent;
3231 TRACE("Enter NtUserChildWindowFromPointEx\n");
3233 if ((pwndParent = UserGetWindowObject(hwndParent)))
3234 {
3235 pwndParent = IntChildWindowFromPointEx(pwndParent, x, y, uiFlags);
3236 }
3237 UserLeave();
3238 TRACE("Leave NtUserChildWindowFromPointEx\n");
3239 return pwndParent ? UserHMGetHandle(pwndParent) : NULL;
3240}
static HWND hwndParent
Definition: cryptui.c:300
PWND APIENTRY IntChildWindowFromPointEx(PWND Parent, LONG x, LONG y, UINT uiFlags)
Definition: winpos.c:3011
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:254
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:245
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122

Referenced by ChildWindowFromPoint(), and ChildWindowFromPointEx().

◆ NtUserDeferWindowPos()

HDWP APIENTRY NtUserDeferWindowPos ( HDWP  WinPosInfo,
HWND  Wnd,
HWND  WndInsertAfter,
int  x,
int  y,
int  cx,
int  cy,
UINT  Flags 
)

Definition at line 3262 of file winpos.c.

3270{
3271 PWND pWnd, pWndIA;
3272 HDWP Ret = NULL;
3276
3277 TRACE("Enter NtUserDeferWindowPos\n");
3279
3280 if ( Flags & Tmp )
3281 {
3283 goto Exit;
3284 }
3285
3286 pWnd = UserGetWindowObject(Wnd);
3287 if (!pWnd || UserIsDesktopWindow(pWnd) || UserIsMessageWindow(pWnd))
3288 {
3289 goto Exit;
3290 }
3291
3292 if ( WndInsertAfter &&
3293 WndInsertAfter != HWND_BOTTOM &&
3294 WndInsertAfter != HWND_TOPMOST &&
3295 WndInsertAfter != HWND_NOTOPMOST )
3296 {
3297 pWndIA = UserGetWindowObject(WndInsertAfter);
3298 if (!pWndIA || UserIsDesktopWindow(pWndIA) || UserIsMessageWindow(pWndIA))
3299 {
3300 goto Exit;
3301 }
3302 }
3303
3304 Ret = IntDeferWindowPos(WinPosInfo, Wnd, WndInsertAfter, x, y, cx, cy, Flags);
3305
3306Exit:
3307 TRACE("Leave NtUserDeferWindowPos, ret=%p\n", Ret);
3308 UserLeave();
3309 return Ret;
3310}
HDWP FASTCALL IntDeferWindowPos(HDWP hdwp, HWND hwnd, HWND hwndAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:3064
static void Exit(void)
Definition: sock.c:1330
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:197
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define SWP_NOREPOSITION
Definition: winuser.h:1240
#define HWND_NOTOPMOST
Definition: winuser.h:1196
#define HWND_BOTTOM
Definition: winuser.h:1195

Referenced by DeferWindowPos().

◆ NtUserEndDeferWindowPosEx()

BOOL APIENTRY NtUserEndDeferWindowPosEx ( HDWP  WinPosInfo,
BOOL  bAsync 
)

Definition at line 3246 of file winpos.c.

3248{
3249 BOOL Ret;
3250 TRACE("Enter NtUserEndDeferWindowPosEx\n");
3252 Ret = IntEndDeferWindowPosEx(WinPosInfo, bAsync);
3253 TRACE("Leave NtUserEndDeferWindowPosEx, ret=%i\n", Ret);
3254 UserLeave();
3255 return Ret;
3256}
BOOL FASTCALL IntEndDeferWindowPosEx(HDWP hdwp, BOOL bAsync)
Definition: winpos.c:3153

Referenced by CascadeWindows(), EndDeferWindowPos(), and TileWindows().

◆ NtUserGetInternalWindowPos()

DWORD APIENTRY NtUserGetInternalWindowPos ( HWND  hWnd,
LPRECT  rectWnd,
LPPOINT  ptIcon 
)

Definition at line 3316 of file winpos.c.

3319{
3320 PWND Window;
3321 DWORD Ret = 0;
3322 BOOL Hit = FALSE;
3323 WINDOWPLACEMENT wndpl;
3324
3326
3328 {
3329 Hit = FALSE;
3330 goto Exit;
3331 }
3332
3333 _SEH2_TRY
3334 {
3335 if(rectWnd)
3336 {
3337 ProbeForWrite(rectWnd,
3338 sizeof(RECT),
3339 1);
3340 }
3341 if(ptIcon)
3342 {
3343 ProbeForWrite(ptIcon,
3344 sizeof(POINT),
3345 1);
3346 }
3347
3348 }
3350 {
3352 Hit = TRUE;
3353 }
3354 _SEH2_END;
3355
3356 wndpl.length = sizeof(WINDOWPLACEMENT);
3357
3358 if (IntGetWindowPlacement(Window, &wndpl) && !Hit)
3359 {
3360 _SEH2_TRY
3361 {
3362 if (rectWnd)
3363 {
3364 RtlCopyMemory(rectWnd, &wndpl.rcNormalPosition , sizeof(RECT));
3365 }
3366 if (ptIcon)
3367 {
3368 RtlCopyMemory(ptIcon, &wndpl.ptMinPosition, sizeof(POINT));
3369 }
3370
3371 }
3373 {
3375 Hit = TRUE;
3376 }
3377 _SEH2_END;
3378
3379 if (!Hit) Ret = wndpl.showCmd;
3380 }
3381Exit:
3382 UserLeave();
3383 return Ret;
3384}
HWND hWnd
Definition: settings.c:17
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:238
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
struct _WINDOWPLACEMENT WINDOWPLACEMENT

◆ NtUserGetWindowPlacement()

BOOL APIENTRY NtUserGetWindowPlacement ( HWND  hWnd,
WINDOWPLACEMENT lpwndpl 
)

Definition at line 3390 of file winpos.c.

3392{
3393 PWND Wnd;
3394 WINDOWPLACEMENT Safepl;
3397
3398 TRACE("Enter NtUserGetWindowPlacement\n");
3400
3401 if (!(Wnd = UserGetWindowObject(hWnd)))
3402 {
3403 RETURN( FALSE);
3404 }
3405
3406 Status = MmCopyFromCaller(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT));
3407 if (!NT_SUCCESS(Status))
3408 {
3410 RETURN( FALSE);
3411 }
3412
3413 Safepl.length = sizeof(WINDOWPLACEMENT);
3414
3415 IntGetWindowPlacement(Wnd, &Safepl);
3416
3417 Status = MmCopyToCaller(lpwndpl, &Safepl, sizeof(WINDOWPLACEMENT));
3418 if (!NT_SUCCESS(Status))
3419 {
3421 RETURN( FALSE);
3422 }
3423
3424 RETURN( TRUE);
3425
3426CLEANUP:
3427 TRACE("Leave NtUserGetWindowPlacement, ret=%i\n",_ret_);
3428 UserLeave();
3430}
#define RETURN(x)
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define CLEANUP
Definition: ntuser.h:5
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetWindowPlacement().

◆ NtUserMinMaximize()

DWORD APIENTRY NtUserMinMaximize ( HWND  hWnd,
UINT  cmd,
BOOL  Hide 
)

Definition at line 3434 of file winpos.c.

3438{
3439 PWND pWnd;
3440
3441 TRACE("Enter NtUserMinMaximize\n");
3443
3444 pWnd = UserGetWindowObject(hWnd);
3445 if (!pWnd || UserIsDesktopWindow(pWnd) || UserIsMessageWindow(pWnd))
3446 {
3447 goto Exit;
3448 }
3449
3450 if ( cmd > SW_MAX || pWnd->state2 & WNDS2_INDESTROY)
3451 {
3453 goto Exit;
3454 }
3455
3456 cmd |= Hide ? SW_HIDE : 0;
3457
3458 co_WinPosShowWindow(pWnd, cmd);
3459
3460Exit:
3461 TRACE("Leave NtUserMinMaximize\n");
3462 UserLeave();
3463 return 0; // Always NULL?
3464}
Definition: ftp_var.h:139
#define SW_MAX
Definition: winuser.h:776

◆ NtUserMoveWindow()

BOOL APIENTRY NtUserMoveWindow ( HWND  hWnd,
int  X,
int  Y,
int  nWidth,
int  nHeight,
BOOL  bRepaint 
)

Definition at line 3470 of file winpos.c.

3477{
3478 return NtUserSetWindowPos(hWnd, 0, X, Y, nWidth, nHeight,
3479 (bRepaint ? SWP_NOZORDER | SWP_NOACTIVATE :
3481}
BOOL APIENTRY NtUserSetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
Definition: winpos.c:3507

Referenced by MoveWindow().

◆ NtUserRealChildWindowFromPoint()

HWND APIENTRY NtUserRealChildWindowFromPoint ( HWND  Parent,
LONG  x,
LONG  y 
)

Definition at line 3487 of file winpos.c.

3490{
3491 PWND pwndParent;
3492 TRACE("Enter NtUserRealChildWindowFromPoint\n");
3494 if ((pwndParent = UserGetWindowObject(Parent)))
3495 {
3496 pwndParent = IntRealChildWindowFromPoint(pwndParent, x, y);
3497 }
3498 UserLeave();
3499 TRACE("Leave NtUserRealChildWindowFromPoint\n");
3500 return pwndParent ? UserHMGetHandle(pwndParent) : NULL;
3501}
PWND FASTCALL IntRealChildWindowFromPoint(PWND Parent, LONG x, LONG y)
Definition: winpos.c:2968

Referenced by RealChildWindowFromPoint().

◆ NtUserSetInternalWindowPos()

DWORD APIENTRY NtUserSetInternalWindowPos ( HWND  hwnd,
UINT  showCmd,
LPRECT  lprect,
LPPOINT  lppt 
)

Definition at line 3633 of file winpos.c.

3638{
3639 WINDOWPLACEMENT wndpl;
3640 UINT flags;
3641 PWND Wnd;
3642 RECT rect;
3643 POINT pt = {0};
3646
3647 TRACE("Enter NtUserSetWindowPlacement\n");
3649
3650 if (!(Wnd = UserGetWindowObject(hwnd)) || // FIXME:
3652 {
3653 RETURN( FALSE);
3654 }
3655
3656 _SEH2_TRY
3657 {
3658 if (lppt)
3659 {
3660 ProbeForRead(lppt, sizeof(POINT), 1);
3661 RtlCopyMemory(&pt, lppt, sizeof(POINT));
3662 }
3663 if (lprect)
3664 {
3665 ProbeForRead(lprect, sizeof(RECT), 1);
3666 RtlCopyMemory(&rect, lprect, sizeof(RECT));
3667 }
3668 }
3670 {
3673 }
3674 _SEH2_END
3675
3676 wndpl.length = sizeof(wndpl);
3677 wndpl.showCmd = showCmd;
3678 wndpl.flags = flags = 0;
3679
3680 if ( lppt )
3681 {
3682 flags |= PLACE_MIN;
3683 wndpl.flags |= WPF_SETMINPOSITION;
3684 wndpl.ptMinPosition = pt;
3685 }
3686 if ( lprect )
3687 {
3688 flags |= PLACE_RECT;
3689 wndpl.rcNormalPosition = rect;
3690 }
3691
3692 UserRefObjectCo(Wnd, &Ref);
3693 IntSetWindowPlacement(Wnd, &wndpl, flags);
3694 UserDerefObjectCo(Wnd);
3695 RETURN(TRUE);
3696
3697CLEANUP:
3698 TRACE("Leave NtUserSetWindowPlacement, ret=%i\n",_ret_);
3699 UserLeave();
3701}
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
BOOL FASTCALL IntSetWindowPlacement(PWND Wnd, WINDOWPLACEMENT *wpl, UINT Flags)
Definition: winpos.c:666
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162

◆ NtUserSetWindowPlacement()

BOOL APIENTRY NtUserSetWindowPlacement ( HWND  hWnd,
WINDOWPLACEMENT lpwndpl 
)

Definition at line 3707 of file winpos.c.

3709{
3710 PWND Wnd;
3711 WINDOWPLACEMENT Safepl;
3712 UINT Flags;
3715
3716 TRACE("Enter NtUserSetWindowPlacement\n");
3718
3719 if (!(Wnd = UserGetWindowObject(hWnd)) ||
3721 {
3722 RETURN( FALSE);
3723 }
3724
3725 _SEH2_TRY
3726 {
3727 ProbeForRead(lpwndpl, sizeof(WINDOWPLACEMENT), 1);
3728 RtlCopyMemory(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT));
3729 }
3731 {
3734 }
3735 _SEH2_END
3736
3737 if(Safepl.length != sizeof(WINDOWPLACEMENT))
3738 {
3739 RETURN( FALSE);
3740 }
3741
3743 if (Safepl.flags & WPF_SETMINPOSITION) Flags |= PLACE_MIN;
3744 UserRefObjectCo(Wnd, &Ref);
3745 IntSetWindowPlacement(Wnd, &Safepl, Flags);
3746 UserDerefObjectCo(Wnd);
3747 RETURN(TRUE);
3748
3749CLEANUP:
3750 TRACE("Leave NtUserSetWindowPlacement, ret=%i\n",_ret_);
3751 UserLeave();
3753}

Referenced by SetWindowPlacement().

◆ NtUserSetWindowPos()

BOOL APIENTRY NtUserSetWindowPos ( HWND  hWnd,
HWND  hWndInsertAfter,
int  X,
int  Y,
int  cx,
int  cy,
UINT  uFlags 
)

Definition at line 3507 of file winpos.c.

3515{
3517 PWND Window, pWndIA;
3518 BOOL ret;
3520
3521 TRACE("Enter NtUserSetWindowPos\n");
3523
3524 if (!(Window = UserGetWindowObject(hWnd)) ||
3526 {
3527 ERR("NtUserSetWindowPos bad window handle!\n");
3528 RETURN(FALSE);
3529 }
3530
3531 if ( hWndInsertAfter != HWND_TOP &&
3532 hWndInsertAfter != HWND_BOTTOM &&
3533 hWndInsertAfter != HWND_TOPMOST &&
3534 hWndInsertAfter != HWND_NOTOPMOST )
3535 {
3536 if (!(pWndIA = UserGetWindowObject(hWndInsertAfter)) ||
3537 UserIsDesktopWindow(pWndIA) || UserIsMessageWindow(pWndIA))
3538 {
3539 ERR("NtUserSetWindowPos bad insert window handle!\n");
3540 RETURN(FALSE);
3541 }
3542 }
3543
3544 /* First make sure that coordinates are valid for WM_WINDOWPOSCHANGING */
3545 if (!(uFlags & SWP_NOMOVE))
3546 {
3547 if (X < -32768) X = -32768;
3548 else if (X > 32767) X = 32767;
3549 if (Y < -32768) Y = -32768;
3550 else if (Y > 32767) Y = 32767;
3551 }
3552 if (!(uFlags & SWP_NOSIZE))
3553 {
3554 if (cx < 0) cx = 0;
3555 else if (cx > 32767) cx = 32767;
3556 if (cy < 0) cy = 0;
3557 else if (cy > 32767) cy = 32767;
3558 }
3559
3560 UserRefObjectCo(Window, &Ref);
3561 ret = co_WinPosSetWindowPos(Window, hWndInsertAfter, X, Y, cx, cy, uFlags);
3563
3564 RETURN(ret);
3565
3566CLEANUP:
3567 TRACE("Leave NtUserSetWindowPos, ret=%i\n",_ret_);
3568 UserLeave();
3570}
UINT uFlags
Definition: api.c:59
int ret

Referenced by BringWindowToTop(), NtUserMoveWindow(), and SetWindowPos().

◆ NtUserSetWindowRgn()

INT APIENTRY NtUserSetWindowRgn ( HWND  hWnd,
HRGN  hRgn,
BOOL  bRedraw 
)

Definition at line 3576 of file winpos.c.

3580{
3581 HRGN hrgnCopy = NULL;
3582 PWND Window;
3584 BOOLEAN Ret = FALSE;
3586
3587 TRACE("Enter NtUserSetWindowRgn\n");
3589
3590 if (!(Window = UserGetWindowObject(hWnd)) ||
3592 {
3593 RETURN( 0);
3594 }
3595
3596 if (hRgn) // The region will be deleted in user32.
3597 {
3599 {
3600 hrgnCopy = NtGdiCreateRectRgn(0, 0, 0, 0);
3601 /* The coordinates of a window's window region are relative to the
3602 upper-left corner of the window, not the client area of the window. */
3603 NtGdiCombineRgn( hrgnCopy, hRgn, 0, RGN_COPY);
3604 }
3605 else
3606 RETURN( 0);
3607 }
3608
3610 if (hrgnCopy)
3611 {
3612 Window->hrgnNewFrame = hrgnCopy; // Should be PSMWP->acvr->hrgnClip
3613 }
3614 else
3615 {
3616 Window->hrgnNewFrame = HRGN_WINDOW;
3617 }
3619 Ret = co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, bRedraw ? flags : (flags|SWP_NOREDRAW) );
3620
3621 RETURN( (INT)Ret);
3622
3623CLEANUP:
3624 TRACE("Leave NtUserSetWindowRgn, ret=%i\n",_ret_);
3625 UserLeave();
3627}
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146

Referenced by ResetUserApiHook(), and SetWindowRgn().

◆ NtUserShowWindow()

BOOL APIENTRY NtUserShowWindow ( HWND  hWnd,
LONG  nCmdShow 
)

Definition at line 3798 of file winpos.c.

3799{
3800 PWND Window;
3801 BOOL ret;
3804
3805 TRACE("Enter NtUserShowWindow hWnd %p SW_ %d\n",hWnd, nCmdShow);
3807
3808 if (!(Window = UserGetWindowObject(hWnd)) ||
3810 {
3811 RETURN(FALSE);
3812 }
3813
3814 if ( nCmdShow > SW_MAX || Window->state2 & WNDS2_INDESTROY)
3815 {
3817 RETURN(FALSE);
3818 }
3819
3820 UserRefObjectCo(Window, &Ref);
3821 ret = co_WinPosShowWindow(Window, nCmdShow);
3823
3824 RETURN(ret);
3825
3826CLEANUP:
3827 TRACE("Leave NtUserShowWindow, ret=%i\n",_ret_);
3828 UserLeave();
3830}

Referenced by ShowWindow().

◆ NtUserShowWindowAsync()

BOOL APIENTRY NtUserShowWindowAsync ( HWND  hWnd,
LONG  nCmdShow 
)

Definition at line 3759 of file winpos.c.

3760{
3761 PWND Window;
3762 BOOL ret;
3765
3766 TRACE("Enter NtUserShowWindowAsync\n");
3768
3769 if (!(Window = UserGetWindowObject(hWnd)) ||
3771 {
3772 RETURN(FALSE);
3773 }
3774
3775 if ( nCmdShow > SW_MAX )
3776 {
3778 RETURN(FALSE);
3779 }
3780
3781 UserRefObjectCo(Window, &Ref);
3784 if (-1 == (int) ret || !ret) ret = FALSE;
3785
3786 RETURN(ret);
3787
3788CLEANUP:
3789 TRACE("Leave NtUserShowWindowAsync, ret=%i\n",_ret_);
3790 UserLeave();
3792}

Referenced by ShowWindowAsync().

◆ NtUserWindowFromPoint()

HWND APIENTRY NtUserWindowFromPoint ( LONG  X,
LONG  Y 
)

Definition at line 3837 of file winpos.c.

3838{
3839 POINT pt;
3840 HWND Ret;
3842 USHORT hittest;
3845
3846 TRACE("Enter NtUserWindowFromPoint\n");
3848
3850 {
3851 //PTHREADINFO pti;
3852
3853 pt.x = X;
3854 pt.y = Y;
3855
3856 // Hmm... Threads live on desktops thus we have a reference on the desktop and indirectly the desktop window.
3857 // It is possible this referencing is useless, though it should not hurt...
3859
3860 //pti = PsGetCurrentThreadWin32Thread();
3862
3863 if (Window)
3864 {
3865 Ret = UserHMGetHandle(Window);
3866
3867 RETURN( Ret);
3868 }
3869 }
3870
3871 RETURN( NULL);
3872
3873CLEANUP:
3875
3876 TRACE("Leave NtUserWindowFromPoint, ret=%p\n", _ret_);
3877 UserLeave();
3879}
PWND APIENTRY co_WinPosWindowFromPoint(IN PWND ScopeWin, IN POINT *WinPoint, IN OUT USHORT *HitTest, IN BOOL Ignore)
Definition: winpos.c:2934
Implementation of the Explorer desktop window.
Definition: desktop.h:52

Referenced by WindowFromPoint().

◆ SelectWindowRgn()

VOID SelectWindowRgn ( PWND  Window,
HRGN  hRgnClip 
)

Definition at line 260 of file winpos.c.

261{
262 if (Window->hrgnClip)
263 {
264 /* Delete no longer needed region handle */
266 GreDeleteObject(Window->hrgnClip);
267 Window->hrgnClip = NULL;
268 }
269
270 if (hRgnClip > HRGN_WINDOW)
271 {
272 /*if (!UserIsDesktopWindow(Window))
273 {
274 NtGdiOffsetRgn(hRgnClip, Window->rcWindow.left, Window->rcWindow.top);
275 }*/
276 /* Set public ownership */
278
279 Window->hrgnClip = hRgnClip;
280 }
281}

Referenced by co_WinPosSetWindowPos().

◆ UserGetWindowBorders()

VOID UserGetWindowBorders ( DWORD  Style,
DWORD  ExStyle,
SIZE Size,
BOOL  WithClient 
)

Definition at line 889 of file winpos.c.

890{
891 DWORD Border = 0;
892
894 Border += 2;
896 Border += 1; /* for the outer frame always present */
897 if ((ExStyle & WS_EX_CLIENTEDGE) && WithClient)
898 Border += 2;
900 Border ++; /* The other border */
901 Size->cx = Size->cy = Border;
902 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE)) /* The resize border */
903 {
906 }
909}
BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: winpos.c:845

Referenced by GetWindowInfo(), NC_HandleNCCalcSize(), RealAdjustWindowRectEx(), and UserDrawCaptionButtonWnd().

◆ UserHasWindowEdge()

BOOL UserHasWindowEdge ( DWORD  Style,
DWORD  ExStyle 
)

Definition at line 845 of file winpos.c.

846{
847 if (Style & WS_MINIMIZE)
848 return TRUE;
850 return TRUE;
852 return FALSE;
853 if (Style & WS_THICKFRAME)
854 return TRUE;
855 Style &= WS_CAPTION;
856 if (Style == WS_DLGFRAME || Style == WS_CAPTION)
857 return TRUE;
858 return FALSE;
859}

Referenced by UserGetWindowBorders().

◆ WinPosDoOwnedPopups()

static HWND FASTCALL WinPosDoOwnedPopups ( PWND  Window,
HWND  hWndInsertAfter 
)
static

Definition at line 1356 of file winpos.c.

1357{
1358 HWND *List = NULL;
1359 HWND Owner;
1360 LONG Style;
1361 PWND DesktopWindow, ChildObject;
1362 int i;
1363
1364 TRACE("(%p) hInsertAfter = %p\n", Window, hWndInsertAfter );
1365
1366 Style = Window->style;
1367
1368 if (Style & WS_CHILD)
1369 {
1370 TRACE("Window is child\n");
1371 return hWndInsertAfter;
1372 }
1373
1374 Owner = Window->spwndOwner ? Window->spwndOwner->head.h : NULL;
1375
1376 if (Owner)
1377 {
1378 /* Make sure this popup stays above the owner */
1379
1380 if (hWndInsertAfter != HWND_TOPMOST)
1381 {
1384
1385 if (List != NULL)
1386 {
1387 for (i = 0; List[i]; i++)
1388 {
1389 BOOL topmost = FALSE;
1390
1391 ChildObject = ValidateHwndNoErr(List[i]);
1392 if (ChildObject)
1393 {
1394 topmost = (ChildObject->ExStyle & WS_EX_TOPMOST) != 0;
1395 }
1396
1397 if (List[i] == Owner)
1398 {
1399 /* We found its Owner, so we must handle it here. */
1400 if (i > 0)
1401 {
1402