2 * Window position related functions.
4 * Copyright 1993, 1994, 1995 Alexandre Julliard
5 * 1995,1996 Alex Korobka
10 #include <X11/Xatom.h>
11 #include "sysmetrics.h"
19 #include "stackframe.h"
23 #include "nonclient.h"
25 /* #define DEBUG_WIN */
28 #define SWP_AGG_NOGEOMETRYCHANGE \
29 (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
30 #define SWP_AGG_NOPOSCHANGE \
31 (SWP_AGG_NOGEOMETRYCHANGE | SWP_NOZORDER)
32 #define SWP_AGG_STATUSFLAGS \
33 (SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
35 /* ----- external functions ----- */
37 extern void FOCUS_SwitchFocus( HWND
, HWND
);
38 extern HRGN
DCE_GetVisRgn( HWND
, WORD
);
39 extern HWND
CARET_GetHwnd();
40 extern BOOL
DCE_InvalidateDCE(WND
*, RECT16
* );
42 /* ----- internal variables ----- */
44 static HWND hwndActive
= 0; /* Currently active window */
45 static HWND hwndPrevActive
= 0; /* Previously active window */
47 /***********************************************************************
50 * Find a suitable place for an iconic window.
51 * The new position is stored into wndPtr->ptIconPos.
53 void WINPOS_FindIconPos( HWND hwnd
)
56 short x
, y
, xspacing
, yspacing
;
57 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
59 if (!wndPtr
|| !wndPtr
->parent
) return;
60 GetClientRect16( wndPtr
->parent
->hwndSelf
, &rectParent
);
61 if ((wndPtr
->ptIconPos
.x
>= rectParent
.left
) &&
62 (wndPtr
->ptIconPos
.x
+ SYSMETRICS_CXICON
< rectParent
.right
) &&
63 (wndPtr
->ptIconPos
.y
>= rectParent
.top
) &&
64 (wndPtr
->ptIconPos
.y
+ SYSMETRICS_CYICON
< rectParent
.bottom
))
65 return; /* The icon already has a suitable position */
67 xspacing
= yspacing
= 70; /* FIXME: This should come from WIN.INI */
68 y
= rectParent
.bottom
;
71 for (x
= rectParent
.left
; x
<=rectParent
.right
-xspacing
; x
+= xspacing
)
73 /* Check if another icon already occupies this spot */
74 WND
*childPtr
= wndPtr
->parent
->child
;
77 if ((childPtr
->dwStyle
& WS_MINIMIZE
) && (childPtr
!= wndPtr
))
79 if ((childPtr
->rectWindow
.left
< x
+ xspacing
) &&
80 (childPtr
->rectWindow
.right
>= x
) &&
81 (childPtr
->rectWindow
.top
<= y
) &&
82 (childPtr
->rectWindow
.bottom
> y
- yspacing
))
83 break; /* There's a window in there */
85 childPtr
= childPtr
->next
;
89 /* No window was found, so it's OK for us */
90 wndPtr
->ptIconPos
.x
= x
+ (xspacing
- SYSMETRICS_CXICON
) / 2;
91 wndPtr
->ptIconPos
.y
= y
- (yspacing
+ SYSMETRICS_CYICON
) / 2;
100 /***********************************************************************
101 * ArrangeIconicWindows (USER.170)
103 UINT
ArrangeIconicWindows( HWND parent
)
107 INT x
, y
, xspacing
, yspacing
;
109 GetClientRect16( parent
, &rectParent
);
111 y
= rectParent
.bottom
;
112 xspacing
= yspacing
= 70; /* FIXME: This should come from WIN.INI */
113 hwndChild
= GetWindow( parent
, GW_CHILD
);
116 if (IsIconic( hwndChild
))
118 SetWindowPos( hwndChild
, 0, x
+ (xspacing
- SYSMETRICS_CXICON
) / 2,
119 y
- (yspacing
+ SYSMETRICS_CYICON
) / 2, 0, 0,
120 SWP_NOSIZE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
121 if (x
<= rectParent
.right
- xspacing
) x
+= xspacing
;
128 hwndChild
= GetWindow( hwndChild
, GW_HWNDNEXT
);
134 /***********************************************************************
135 * GetWindowRect16 (USER.32)
137 void GetWindowRect16( HWND16 hwnd
, LPRECT16 rect
)
139 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
142 *rect
= wndPtr
->rectWindow
;
143 if (wndPtr
->dwStyle
& WS_CHILD
)
144 MapWindowPoints16( wndPtr
->parent
->hwndSelf
, 0, (POINT16
*)rect
, 2 );
148 /***********************************************************************
149 * GetWindowRect32 (USER.32)
151 void GetWindowRect32( HWND32 hwnd
, LPRECT32 rect
)
153 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
156 CONV_RECT16TO32( &wndPtr
->rectWindow
, rect
);
157 if (wndPtr
->dwStyle
& WS_CHILD
)
158 MapWindowPoints32( wndPtr
->parent
->hwndSelf
, 0, (POINT32
*)rect
, 2 );
162 /***********************************************************************
163 * GetClientRect16 (USER.33)
165 void GetClientRect16( HWND16 hwnd
, LPRECT16 rect
)
167 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
169 rect
->left
= rect
->top
= rect
->right
= rect
->bottom
= 0;
172 rect
->right
= wndPtr
->rectClient
.right
- wndPtr
->rectClient
.left
;
173 rect
->bottom
= wndPtr
->rectClient
.bottom
- wndPtr
->rectClient
.top
;
178 /***********************************************************************
179 * GetClientRect32 (USER32.219)
181 void GetClientRect32( HWND32 hwnd
, LPRECT32 rect
)
183 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
185 rect
->left
= rect
->top
= rect
->right
= rect
->bottom
= 0;
188 rect
->right
= wndPtr
->rectClient
.right
- wndPtr
->rectClient
.left
;
189 rect
->bottom
= wndPtr
->rectClient
.bottom
- wndPtr
->rectClient
.top
;
194 /*******************************************************************
195 * ClientToScreen16 (USER.28)
197 BOOL16
ClientToScreen16( HWND16 hwnd
, LPPOINT16 lppnt
)
199 MapWindowPoints16( hwnd
, 0, lppnt
, 1 );
204 /*******************************************************************
205 * ClientToScreen32 (USER32.51)
207 BOOL32
ClientToScreen32( HWND32 hwnd
, LPPOINT32 lppnt
)
209 MapWindowPoints32( hwnd
, 0, lppnt
, 1 );
214 /*******************************************************************
215 * ScreenToClient16 (USER.29)
217 void ScreenToClient16( HWND16 hwnd
, LPPOINT16 lppnt
)
219 MapWindowPoints16( 0, hwnd
, lppnt
, 1 );
223 /*******************************************************************
224 * ScreenToClient32 (USER32.446)
226 void ScreenToClient32( HWND32 hwnd
, LPPOINT32 lppnt
)
228 MapWindowPoints32( 0, hwnd
, lppnt
, 1 );
232 /***********************************************************************
233 * WINPOS_WindowFromPoint
235 * Find the window and hittest for a given point.
237 INT16
WINPOS_WindowFromPoint( POINT16 pt
, WND
**ppWnd
)
240 INT16 hittest
= HTERROR
;
246 wndPtr
= WIN_GetDesktop()->child
;
251 /* If point is in window, and window is visible, and it */
252 /* is enabled (or it's a top-level window), then explore */
253 /* its children. Otherwise, go to the next window. */
255 if ((wndPtr
->dwStyle
& WS_VISIBLE
) &&
256 (!(wndPtr
->dwStyle
& WS_DISABLED
) ||
257 ((wndPtr
->dwStyle
& (WS_POPUP
| WS_CHILD
)) != WS_CHILD
)) &&
258 (x
>= wndPtr
->rectWindow
.left
) &&
259 (x
< wndPtr
->rectWindow
.right
) &&
260 (y
>= wndPtr
->rectWindow
.top
) &&
261 (y
< wndPtr
->rectWindow
.bottom
))
263 *ppWnd
= wndPtr
; /* Got a suitable window */
265 /* If window is minimized or disabled, return at once */
266 if (wndPtr
->dwStyle
& WS_MINIMIZE
) return HTCAPTION
;
267 if (wndPtr
->dwStyle
& WS_DISABLED
) return HTERROR
;
269 /* If point is not in client area, ignore the children */
270 if ((x
< wndPtr
->rectClient
.left
) ||
271 (x
>= wndPtr
->rectClient
.right
) ||
272 (y
< wndPtr
->rectClient
.top
) ||
273 (y
>= wndPtr
->rectClient
.bottom
)) break;
275 x
-= wndPtr
->rectClient
.left
;
276 y
-= wndPtr
->rectClient
.top
;
277 wndPtr
= wndPtr
->child
;
279 else wndPtr
= wndPtr
->next
;
282 /* If nothing found, return the desktop window */
285 *ppWnd
= WIN_GetDesktop();
289 /* Send the WM_NCHITTEST message (only if to the same task) */
290 if ((*ppWnd
)->hmemTaskQ
!= GetTaskQueue(0)) return HTCLIENT
;
291 hittest
= (INT
)SendMessage16( (*ppWnd
)->hwndSelf
, WM_NCHITTEST
, 0,
292 MAKELONG( pt
.x
, pt
.y
) );
293 if (hittest
!= HTTRANSPARENT
) return hittest
; /* Found the window */
295 /* If no children found in last search, make point relative to parent*/
298 x
+= (*ppWnd
)->rectClient
.left
;
299 y
+= (*ppWnd
)->rectClient
.top
;
302 /* Restart the search from the next sibling */
303 wndPtr
= (*ppWnd
)->next
;
304 *ppWnd
= (*ppWnd
)->parent
;
309 /*******************************************************************
310 * WindowFromPoint16 (USER.30)
312 HWND16
WindowFromPoint16( POINT16 pt
)
315 WINPOS_WindowFromPoint( pt
, &pWnd
);
316 return pWnd
->hwndSelf
;
320 /*******************************************************************
321 * WindowFromPoint32 (USER32.581)
323 HWND32
WindowFromPoint32( POINT32 pt
)
327 CONV_POINT32TO16( &pt
, &pt16
);
328 WINPOS_WindowFromPoint( pt16
, &pWnd
);
329 return (HWND32
)pWnd
->hwndSelf
;
333 /*******************************************************************
334 * ChildWindowFromPoint16 (USER.191)
336 HWND16
ChildWindowFromPoint16( HWND16 hwndParent
, POINT16 pt
)
338 /* pt is in the client coordinates */
340 WND
* wnd
= WIN_FindWndPtr(hwndParent
);
345 /* get client rect fast */
346 rect
.top
= rect
.left
= 0;
347 rect
.right
= wnd
->rectClient
.right
- wnd
->rectClient
.left
;
348 rect
.bottom
= wnd
->rectClient
.bottom
- wnd
->rectClient
.top
;
350 if (!PtInRect16( &rect
, pt
)) return 0;
355 if (PtInRect16( &wnd
->rectWindow
, pt
)) return wnd
->hwndSelf
;
362 /*******************************************************************
363 * ChildWindowFromPoint32 (USER32.)
365 HWND32
ChildWindowFromPoint32( HWND32 hwndParent
, POINT32 pt
)
368 CONV_POINT32TO16( &pt
, &pt16
);
369 return (HWND32
)ChildWindowFromPoint16( hwndParent
, pt16
);
373 /*******************************************************************
374 * WINPOS_GetWinOffset
376 * Calculate the offset between the origin of the two windows. Used
377 * to implement MapWindowPoints.
379 static void WINPOS_GetWinOffset( HWND32 hwndFrom
, HWND32 hwndTo
,
384 offset
->x
= offset
->y
= 0;
385 if (hwndFrom
== hwndTo
) return;
387 /* Translate source window origin to screen coords */
390 if (!(wndPtr
= WIN_FindWndPtr( hwndFrom
)))
392 fprintf(stderr
,"MapWindowPoints: bad hwndFrom = %04x\n",hwndFrom
);
395 while (wndPtr
->parent
)
397 offset
->x
+= wndPtr
->rectClient
.left
;
398 offset
->y
+= wndPtr
->rectClient
.top
;
399 wndPtr
= wndPtr
->parent
;
403 /* Translate origin to destination window coords */
406 if (!(wndPtr
= WIN_FindWndPtr( hwndTo
)))
408 fprintf(stderr
,"MapWindowPoints: bad hwndTo = %04x\n", hwndTo
);
411 while (wndPtr
->parent
)
413 offset
->x
-= wndPtr
->rectClient
.left
;
414 offset
->y
-= wndPtr
->rectClient
.top
;
415 wndPtr
= wndPtr
->parent
;
421 /*******************************************************************
422 * MapWindowPoints16 (USER.258)
424 void MapWindowPoints16( HWND16 hwndFrom
, HWND16 hwndTo
,
425 LPPOINT16 lppt
, UINT16 count
)
429 WINPOS_GetWinOffset( hwndFrom
, hwndTo
, &offset
);
439 /*******************************************************************
440 * MapWindowPoints32 (USER32.385)
442 void MapWindowPoints32( HWND32 hwndFrom
, HWND32 hwndTo
,
443 LPPOINT32 lppt
, UINT32 count
)
447 WINPOS_GetWinOffset( hwndFrom
, hwndTo
, &offset
);
457 /***********************************************************************
460 BOOL
IsIconic(HWND hWnd
)
462 WND
* wndPtr
= WIN_FindWndPtr(hWnd
);
463 if (wndPtr
== NULL
) return FALSE
;
464 return (wndPtr
->dwStyle
& WS_MINIMIZE
) != 0;
468 /***********************************************************************
469 * IsZoomed (USER.272)
471 BOOL
IsZoomed(HWND hWnd
)
473 WND
* wndPtr
= WIN_FindWndPtr(hWnd
);
474 if (wndPtr
== NULL
) return FALSE
;
475 return (wndPtr
->dwStyle
& WS_MAXIMIZE
) != 0;
479 /*******************************************************************
480 * GetActiveWindow (USER.60)
482 HWND
GetActiveWindow()
488 /*******************************************************************
489 * SetActiveWindow (USER.59)
491 HWND
SetActiveWindow( HWND hwnd
)
493 HWND prev
= hwndActive
;
494 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
496 if (!wndPtr
|| (wndPtr
->dwStyle
& WS_DISABLED
) ||
497 !(wndPtr
->dwStyle
& WS_VISIBLE
)) return 0;
499 WINPOS_SetActiveWindow( hwnd
, 0, 0 );
504 /***********************************************************************
505 * BringWindowToTop (USER.45)
507 BOOL
BringWindowToTop( HWND hwnd
)
509 return SetWindowPos( hwnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
);
513 /***********************************************************************
514 * MoveWindow (USER.56)
516 BOOL
MoveWindow( HWND hwnd
, short x
, short y
, short cx
, short cy
, BOOL repaint
)
518 int flags
= SWP_NOZORDER
| SWP_NOACTIVATE
;
519 if (!repaint
) flags
|= SWP_NOREDRAW
;
520 dprintf_win(stddeb
, "MoveWindow: %04x %d,%d %dx%d %d\n",
521 hwnd
, x
, y
, cx
, cy
, repaint
);
522 return SetWindowPos( hwnd
, 0, x
, y
, cx
, cy
, flags
);
526 /***********************************************************************
527 * ShowWindow (USER.42)
529 BOOL
ShowWindow( HWND hwnd
, int cmd
)
531 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
532 BOOL32 wasVisible
, showFlag
;
535 short x
= 0, y
= 0, cx
= 0, cy
= 0;
537 if (!wndPtr
) return FALSE
;
539 dprintf_win(stddeb
,"ShowWindow: hwnd=%04x, cmd=%d\n", hwnd
, cmd
);
541 wasVisible
= (wndPtr
->dwStyle
& WS_VISIBLE
) != 0;
546 if (!wasVisible
) return FALSE
;
547 swpflags
|= SWP_HIDEWINDOW
| SWP_NOSIZE
| SWP_NOMOVE
|
548 SWP_NOACTIVATE
| SWP_NOZORDER
;
551 case SW_SHOWMINNOACTIVE
:
552 swpflags
|= SWP_NOACTIVATE
| SWP_NOZORDER
;
554 case SW_SHOWMINIMIZED
:
555 swpflags
|= SWP_SHOWWINDOW
;
558 swpflags
|= SWP_FRAMECHANGED
;
559 if (!(wndPtr
->dwStyle
& WS_MINIMIZE
))
561 if (wndPtr
->dwStyle
& WS_MAXIMIZE
)
563 wndPtr
->flags
|= WIN_RESTORE_MAX
;
564 wndPtr
->dwStyle
&= ~WS_MAXIMIZE
;
568 wndPtr
->flags
&= ~WIN_RESTORE_MAX
;
569 wndPtr
->rectNormal
= wndPtr
->rectWindow
;
571 wndPtr
->dwStyle
|= WS_MINIMIZE
;
572 WINPOS_FindIconPos( hwnd
);
573 x
= wndPtr
->ptIconPos
.x
;
574 y
= wndPtr
->ptIconPos
.y
;
575 cx
= SYSMETRICS_CXICON
;
576 cy
= SYSMETRICS_CYICON
;
578 else swpflags
|= SWP_NOSIZE
| SWP_NOMOVE
;
581 case SW_SHOWMAXIMIZED
: /* same as SW_MAXIMIZE: */
582 swpflags
|= SWP_SHOWWINDOW
| SWP_FRAMECHANGED
;
583 if (!(wndPtr
->dwStyle
& WS_MAXIMIZE
))
585 /* Store the current position and find the maximized size */
586 if (!(wndPtr
->dwStyle
& WS_MINIMIZE
))
587 wndPtr
->rectNormal
= wndPtr
->rectWindow
;
589 NC_GetMinMaxInfo( hwnd
, &maxSize
,
590 &wndPtr
->ptMaxPos
, NULL
, NULL
);
591 x
= wndPtr
->ptMaxPos
.x
;
592 y
= wndPtr
->ptMaxPos
.y
;
594 if( wndPtr
->dwStyle
& WS_MINIMIZE
)
595 if( !SendMessage16( hwnd
, WM_QUERYOPEN
, 0, 0L ) )
597 swpflags
|= SWP_NOSIZE
| SWP_NOMOVE
;
603 wndPtr
->dwStyle
&= ~WS_MINIMIZE
;
604 wndPtr
->dwStyle
|= WS_MAXIMIZE
;
606 else swpflags
|= SWP_NOSIZE
| SWP_NOMOVE
;
610 swpflags
|= SWP_NOACTIVATE
| SWP_NOZORDER
;
613 swpflags
|= SWP_SHOWWINDOW
| SWP_NOSIZE
| SWP_NOMOVE
;
616 case SW_SHOWNOACTIVATE
:
617 swpflags
|= SWP_NOZORDER
;
618 if (GetActiveWindow()) swpflags
|= SWP_NOACTIVATE
;
620 case SW_SHOWNORMAL
: /* same as SW_NORMAL: */
621 case SW_SHOWDEFAULT
: /* FIXME: should have its own handler */
623 swpflags
|= SWP_SHOWWINDOW
| SWP_FRAMECHANGED
;
625 if (wndPtr
->dwStyle
& WS_MINIMIZE
)
627 if( !SendMessage16( hwnd
, WM_QUERYOPEN
, 0, 0L) )
629 swpflags
|= SWP_NOSIZE
| SWP_NOMOVE
;
632 wndPtr
->ptIconPos
.x
= wndPtr
->rectWindow
.left
;
633 wndPtr
->ptIconPos
.y
= wndPtr
->rectWindow
.top
;
634 wndPtr
->dwStyle
&= ~WS_MINIMIZE
;
635 if (wndPtr
->flags
& WIN_RESTORE_MAX
)
637 /* Restore to maximized position */
638 NC_GetMinMaxInfo( hwnd
, &maxSize
, &wndPtr
->ptMaxPos
,
640 x
= wndPtr
->ptMaxPos
.x
;
641 y
= wndPtr
->ptMaxPos
.y
;
644 wndPtr
->dwStyle
|= WS_MAXIMIZE
;
646 else /* Restore to normal position */
648 x
= wndPtr
->rectNormal
.left
;
649 y
= wndPtr
->rectNormal
.top
;
650 cx
= wndPtr
->rectNormal
.right
- wndPtr
->rectNormal
.left
;
651 cy
= wndPtr
->rectNormal
.bottom
- wndPtr
->rectNormal
.top
;
654 else if (wndPtr
->dwStyle
& WS_MAXIMIZE
)
656 wndPtr
->ptMaxPos
.x
= wndPtr
->rectWindow
.left
;
657 wndPtr
->ptMaxPos
.y
= wndPtr
->rectWindow
.top
;
658 wndPtr
->dwStyle
&= ~WS_MAXIMIZE
;
659 x
= wndPtr
->rectNormal
.left
;
660 y
= wndPtr
->rectNormal
.top
;
661 cx
= wndPtr
->rectNormal
.right
- wndPtr
->rectNormal
.left
;
662 cy
= wndPtr
->rectNormal
.bottom
- wndPtr
->rectNormal
.top
;
664 else swpflags
|= SWP_NOSIZE
| SWP_NOMOVE
;
668 showFlag
= (cmd
!= SW_HIDE
);
669 if (showFlag
!= wasVisible
)
671 SendMessage16( hwnd
, WM_SHOWWINDOW
, showFlag
, 0 );
672 if (!IsWindow( hwnd
)) return wasVisible
;
675 if ((wndPtr
->dwStyle
& WS_CHILD
) &&
676 !IsWindowVisible( wndPtr
->parent
->hwndSelf
) &&
677 (swpflags
& SWP_NOSIZE
) && (swpflags
& SWP_NOMOVE
))
679 /* Don't call SetWindowPos() on invisible child windows */
680 if (cmd
== SW_HIDE
) wndPtr
->dwStyle
&= ~WS_VISIBLE
;
681 else wndPtr
->dwStyle
|= WS_VISIBLE
;
685 /* We can't activate a child window */
686 if (wndPtr
->dwStyle
& WS_CHILD
)
687 swpflags
|= SWP_NOACTIVATE
| SWP_NOZORDER
;
688 SetWindowPos( hwnd
, HWND_TOP
, x
, y
, cx
, cy
, swpflags
);
689 if (!IsWindow( hwnd
)) return wasVisible
;
692 if (wndPtr
->flags
& WIN_NEED_SIZE
)
694 /* should happen only in CreateWindowEx() */
695 int wParam
= SIZE_RESTORED
;
697 wndPtr
->flags
&= ~WIN_NEED_SIZE
;
698 if (wndPtr
->dwStyle
& WS_MAXIMIZE
) wParam
= SIZE_MAXIMIZED
;
699 else if (wndPtr
->dwStyle
& WS_MINIMIZE
) wParam
= SIZE_MINIMIZED
;
700 SendMessage16( hwnd
, WM_SIZE
, wParam
,
701 MAKELONG(wndPtr
->rectClient
.right
-wndPtr
->rectClient
.left
,
702 wndPtr
->rectClient
.bottom
-wndPtr
->rectClient
.top
));
703 SendMessage16( hwnd
, WM_MOVE
, 0,
704 MAKELONG(wndPtr
->rectClient
.left
, wndPtr
->rectClient
.top
) );
707 if (hwnd
== GetFocus())
709 SetFocus( (wndPtr
->dwStyle
& WS_CHILD
)? wndPtr
->parent
->hwndSelf
: 0 );
710 if (hwnd
== CARET_GetHwnd()) DestroyCaret();
717 /***********************************************************************
718 * GetInternalWindowPos16 (USER.460)
720 UINT16
GetInternalWindowPos16( HWND16 hwnd
, LPRECT16 rectWnd
, LPPOINT16 ptIcon
)
722 WINDOWPLACEMENT16 wndpl
;
723 if (!GetWindowPlacement16( hwnd
, &wndpl
)) return 0;
724 if (rectWnd
) *rectWnd
= wndpl
.rcNormalPosition
;
725 if (ptIcon
) *ptIcon
= wndpl
.ptMinPosition
;
726 return wndpl
.showCmd
;
730 /***********************************************************************
731 * GetInternalWindowPos32 (USER32.244)
733 UINT32
GetInternalWindowPos32( HWND32 hwnd
, LPRECT32 rectWnd
, LPPOINT32 ptIcon
)
735 WINDOWPLACEMENT32 wndpl
;
736 if (!GetWindowPlacement32( hwnd
, &wndpl
)) return 0;
737 if (rectWnd
) *rectWnd
= wndpl
.rcNormalPosition
;
738 if (ptIcon
) *ptIcon
= wndpl
.ptMinPosition
;
739 return wndpl
.showCmd
;
743 /***********************************************************************
744 * SetInternalWindowPos16 (USER.461)
746 void SetInternalWindowPos16( HWND16 hwnd
, UINT16 showCmd
,
747 LPRECT16 rect
, LPPOINT16 pt
)
749 WINDOWPLACEMENT16 wndpl
;
750 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
752 wndpl
.length
= sizeof(wndpl
);
753 wndpl
.flags
= (pt
!= NULL
) ? WPF_SETMINPOSITION
: 0;
754 wndpl
.showCmd
= showCmd
;
755 if (pt
) wndpl
.ptMinPosition
= *pt
;
756 wndpl
.rcNormalPosition
= (rect
!= NULL
) ? *rect
: wndPtr
->rectNormal
;
757 wndpl
.ptMaxPosition
= wndPtr
->ptMaxPos
;
758 SetWindowPlacement16( hwnd
, &wndpl
);
762 /***********************************************************************
763 * SetInternalWindowPos32 (USER32.482)
765 void SetInternalWindowPos32( HWND32 hwnd
, UINT32 showCmd
,
766 LPRECT32 rect
, LPPOINT32 pt
)
768 WINDOWPLACEMENT32 wndpl
;
769 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
771 wndpl
.length
= sizeof(wndpl
);
772 wndpl
.flags
= (pt
!= NULL
) ? WPF_SETMINPOSITION
: 0;
773 wndpl
.showCmd
= showCmd
;
774 if (pt
) wndpl
.ptMinPosition
= *pt
;
775 if (rect
) wndpl
.rcNormalPosition
= *rect
;
776 else CONV_RECT16TO32( &wndPtr
->rectNormal
, &wndpl
.rcNormalPosition
);
777 CONV_POINT16TO32( &wndPtr
->ptMaxPos
, &wndpl
.ptMaxPosition
);
778 SetWindowPlacement32( hwnd
, &wndpl
);
782 /***********************************************************************
783 * GetWindowPlacement16 (USER.370)
785 BOOL16
GetWindowPlacement16( HWND16 hwnd
, WINDOWPLACEMENT16
*wndpl
)
787 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
788 if (!wndPtr
) return FALSE
;
790 wndpl
->length
= sizeof(*wndpl
);
792 wndpl
->showCmd
= IsZoomed(hwnd
) ? SW_SHOWMAXIMIZED
:
793 (IsIconic(hwnd
) ? SW_SHOWMINIMIZED
: SW_SHOWNORMAL
);
794 wndpl
->ptMinPosition
= wndPtr
->ptIconPos
;
795 wndpl
->ptMaxPosition
= wndPtr
->ptMaxPos
;
796 wndpl
->rcNormalPosition
= wndPtr
->rectNormal
;
801 /***********************************************************************
802 * GetWindowPlacement32 (USER32.306)
804 BOOL32
GetWindowPlacement32( HWND32 hwnd
, WINDOWPLACEMENT32
*wndpl
)
806 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
807 if (!wndPtr
) return FALSE
;
809 wndpl
->length
= sizeof(*wndpl
);
811 wndpl
->showCmd
= IsZoomed(hwnd
) ? SW_SHOWMAXIMIZED
:
812 (IsIconic(hwnd
) ? SW_SHOWMINIMIZED
: SW_SHOWNORMAL
);
813 CONV_POINT16TO32( &wndPtr
->ptIconPos
, &wndpl
->ptMinPosition
);
814 CONV_POINT16TO32( &wndPtr
->ptMaxPos
, &wndpl
->ptMaxPosition
);
815 CONV_RECT16TO32( &wndPtr
->rectNormal
, &wndpl
->rcNormalPosition
);
820 /***********************************************************************
821 * SetWindowPlacement16 (USER.371)
823 BOOL16
SetWindowPlacement16( HWND16 hwnd
, const WINDOWPLACEMENT16
*wndpl
)
825 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
826 if (!wndPtr
) return FALSE
;
828 if (wndpl
->flags
& WPF_SETMINPOSITION
)
829 wndPtr
->ptIconPos
= wndpl
->ptMinPosition
;
830 if ((wndpl
->flags
& WPF_RESTORETOMAXIMIZED
) &&
831 (wndpl
->showCmd
== SW_SHOWMINIMIZED
)) wndPtr
->flags
|= WIN_RESTORE_MAX
;
832 wndPtr
->ptMaxPos
= wndpl
->ptMaxPosition
;
833 wndPtr
->rectNormal
= wndpl
->rcNormalPosition
;
834 ShowWindow( hwnd
, wndpl
->showCmd
);
839 /***********************************************************************
840 * SetWindowPlacement32 (USER32.518)
842 BOOL32
SetWindowPlacement32( HWND32 hwnd
, const WINDOWPLACEMENT32
*wndpl
)
844 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
845 if (!wndPtr
) return FALSE
;
847 if (wndpl
->flags
& WPF_SETMINPOSITION
)
848 CONV_POINT32TO16( &wndpl
->ptMinPosition
, &wndPtr
->ptIconPos
);
849 if ((wndpl
->flags
& WPF_RESTORETOMAXIMIZED
) &&
850 (wndpl
->showCmd
== SW_SHOWMINIMIZED
)) wndPtr
->flags
|= WIN_RESTORE_MAX
;
851 CONV_POINT32TO16( &wndpl
->ptMaxPosition
, &wndPtr
->ptMaxPos
);
852 CONV_RECT32TO16( &wndpl
->rcNormalPosition
, &wndPtr
->rectNormal
);
853 ShowWindow( hwnd
, wndpl
->showCmd
);
858 /*******************************************************************
859 * WINPOS_SetActiveWindow
861 * back-end to SetActiveWindow
863 BOOL
WINPOS_SetActiveWindow( HWND hWnd
, BOOL fMouse
, BOOL fChangeFocus
)
865 WND
*wndPtr
= WIN_FindWndPtr(hWnd
);
866 WND
*wndTemp
= WIN_FindWndPtr(hwndActive
);
867 CBTACTIVATESTRUCT16
*cbtStruct
;
870 /* FIXME: When proper support for cooperative multitasking is in place
871 * hActiveQ will be global
876 /* paranoid checks */
877 if( !hWnd
|| hWnd
== GetDesktopWindow() || hWnd
== hwndActive
)
880 if( GetTaskQueue(0) != wndPtr
->hmemTaskQ
)
884 wIconized
= HIWORD(wndTemp
->dwStyle
& WS_MINIMIZE
);
886 dprintf_win(stddeb
,"WINPOS_ActivateWindow: no current active window.\n");
888 /* call CBT hook chain */
889 if ((cbtStruct
= SEGPTR_NEW(CBTACTIVATESTRUCT16
)))
892 cbtStruct
->fMouse
= fMouse
;
893 cbtStruct
->hWndActive
= hwndActive
;
894 wRet
= HOOK_CallHooks( WH_CBT
, HCBT_ACTIVATE
, (WPARAM
)hWnd
,
895 (LPARAM
)SEGPTR_GET(cbtStruct
) );
896 SEGPTR_FREE(cbtStruct
);
897 if (wRet
) return wRet
;
900 /* set prev active wnd to current active wnd and send notification */
901 if ((hwndPrevActive
= hwndActive
) && IsWindow(hwndPrevActive
))
903 if (!SendMessage16( hwndPrevActive
, WM_NCACTIVATE
, FALSE
, 0 ))
905 if (GetSysModalWindow16() != hWnd
) return 0;
906 /* disregard refusal if hWnd is sysmodal */
909 SendMessage32A( hwndPrevActive
, WM_ACTIVATE
,
910 MAKEWPARAM( WA_INACTIVE
, wIconized
),
913 /* check if something happened during message processing */
914 if( hwndPrevActive
!= hwndActive
) return 0;
920 /* send palette messages */
921 if( SendMessage16( hWnd
, WM_QUERYNEWPALETTE
, 0, 0L) )
922 SendMessage16((HWND16
)-1, WM_PALETTEISCHANGING
, (WPARAM
)hWnd
, 0L );
924 /* if prev wnd is minimized redraw icon title
927 wndTemp = WIN_FindWndPtr( WIN_GetTopParent( hwndPrevActive ) );
929 if(wndTemp->dwStyle & WS_MINIMIZE)
930 RedrawIconTitle(hwndPrevActive);
934 /* managed windows will get ConfigureNotify event */
935 if (!(wndPtr
->dwStyle
& WS_CHILD
) && !(wndPtr
->flags
& WIN_MANAGED
))
937 /* check Z-order and bring hWnd to the top */
938 for (wndTemp
= WIN_GetDesktop()->child
; wndTemp
; wndTemp
= wndTemp
->next
)
939 if (wndTemp
->dwStyle
& WS_VISIBLE
) break;
941 if( wndTemp
!= wndPtr
)
942 SetWindowPos(hWnd
, HWND_TOP
, 0,0,0,0,
943 SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
);
946 if( !IsWindow(hWnd
) ) return 0;
950 wndTemp
= WIN_FindWndPtr( hwndPrevActive
);
951 if (wndTemp
) hActiveQ
= wndTemp
->hmemTaskQ
;
954 /* send WM_ACTIVATEAPP if necessary */
955 if (hActiveQ
!= wndPtr
->hmemTaskQ
)
959 if ((list
= WIN_BuildWinArray( WIN_GetDesktop() )))
961 for (ppWnd
= list
; *ppWnd
; ppWnd
++)
963 /* Make sure that the window still exists */
964 if (!IsWindow( (*ppWnd
)->hwndSelf
)) continue;
965 if ((*ppWnd
)->hmemTaskQ
!= hActiveQ
) continue;
966 SendMessage16( (*ppWnd
)->hwndSelf
, WM_ACTIVATEAPP
,
967 0, QUEUE_GetQueueTask(wndPtr
->hmemTaskQ
) );
969 HeapFree( SystemHeap
, 0, list
);
972 if ((list
= WIN_BuildWinArray( WIN_GetDesktop() )))
974 for (ppWnd
= list
; *ppWnd
; ppWnd
++)
976 /* Make sure that the window still exists */
977 if (!IsWindow( (*ppWnd
)->hwndSelf
)) continue;
978 if ((*ppWnd
)->hmemTaskQ
!= wndPtr
->hmemTaskQ
) continue;
979 SendMessage16( (*ppWnd
)->hwndSelf
, WM_ACTIVATEAPP
,
980 1, QUEUE_GetQueueTask( hActiveQ
) );
982 HeapFree( SystemHeap
, 0, list
);
984 if (!IsWindow(hWnd
)) return 0;
987 /* walk up to the first unowned window */
989 while (wndTemp
->owner
) wndTemp
= wndTemp
->owner
;
990 /* and set last active owned popup */
991 wndTemp
->hwndLastActive
= hWnd
;
993 wIconized
= HIWORD(wndTemp
->dwStyle
& WS_MINIMIZE
);
994 SendMessage16( hWnd
, WM_NCACTIVATE
, TRUE
, 0 );
995 SendMessage32A( hWnd
, WM_ACTIVATE
,
996 MAKEWPARAM( (fMouse
) ? WA_CLICKACTIVE
: WA_ACTIVE
, wIconized
),
997 (LPARAM
)hwndPrevActive
);
999 if( !IsWindow(hWnd
) ) return 0;
1001 /* change focus if possible */
1002 if( fChangeFocus
&& GetFocus() )
1003 if( WIN_GetTopParent(GetFocus()) != hwndActive
)
1004 FOCUS_SwitchFocus( GetFocus(),
1005 (wndPtr
->dwStyle
& WS_MINIMIZE
)? 0: hwndActive
);
1007 /* if active wnd is minimized redraw icon title
1010 wndPtr = WIN_FindWndPtr(hwndActive);
1011 if(wndPtr->dwStyle & WS_MINIMIZE)
1012 RedrawIconTitle(hwndActive);
1015 return (hWnd
== hwndActive
);
1019 /*******************************************************************
1020 * WINPOS_ChangeActiveWindow
1023 BOOL
WINPOS_ChangeActiveWindow( HWND hWnd
, BOOL mouseMsg
)
1025 WND
*wndPtr
= WIN_FindWndPtr(hWnd
);
1027 if( !wndPtr
) return FALSE
;
1029 /* child windows get WM_CHILDACTIVATE message */
1030 if( (wndPtr
->dwStyle
& (WS_CHILD
| WS_POPUP
)) == WS_CHILD
)
1031 return SendMessage16(hWnd
, WM_CHILDACTIVATE
, 0, 0L);
1033 /* owned popups imply owner activation - not sure */
1034 if ((wndPtr
->dwStyle
& WS_POPUP
) && wndPtr
->owner
&&
1035 !(wndPtr
->owner
->dwStyle
& WS_DISABLED
))
1037 if (!(wndPtr
= wndPtr
->owner
)) return FALSE
;
1038 hWnd
= wndPtr
->hwndSelf
;
1041 if( hWnd
== hwndActive
) return FALSE
;
1043 if( !WINPOS_SetActiveWindow(hWnd
,mouseMsg
,TRUE
) )
1046 /* switch desktop queue to current active */
1047 if( wndPtr
->parent
== WIN_GetDesktop())
1048 WIN_GetDesktop()->hmemTaskQ
= wndPtr
->hmemTaskQ
;
1054 /***********************************************************************
1055 * WINPOS_SendNCCalcSize
1057 * Send a WM_NCCALCSIZE message to a window.
1058 * All parameters are read-only except newClientRect.
1059 * oldWindowRect, oldClientRect and winpos must be non-NULL only
1060 * when calcValidRect is TRUE.
1062 LONG
WINPOS_SendNCCalcSize( HWND hwnd
, BOOL calcValidRect
,
1063 RECT16
*newWindowRect
, RECT16
*oldWindowRect
,
1064 RECT16
*oldClientRect
, SEGPTR winpos
,
1065 RECT16
*newClientRect
)
1067 NCCALCSIZE_PARAMS16
*params
;
1070 if (!(params
= SEGPTR_NEW(NCCALCSIZE_PARAMS16
))) return 0;
1071 params
->rgrc
[0] = *newWindowRect
;
1074 params
->rgrc
[1] = *oldWindowRect
;
1075 params
->rgrc
[2] = *oldClientRect
;
1076 params
->lppos
= winpos
;
1078 result
= SendMessage16( hwnd
, WM_NCCALCSIZE
, calcValidRect
,
1079 (LPARAM
)SEGPTR_GET( params
) );
1080 dprintf_win(stddeb
, "WINPOS_SendNCCalcSize: %d %d %d %d\n",
1081 (int)params
->rgrc
[0].top
, (int)params
->rgrc
[0].left
,
1082 (int)params
->rgrc
[0].bottom
, (int)params
->rgrc
[0].right
);
1083 *newClientRect
= params
->rgrc
[0];
1084 SEGPTR_FREE(params
);
1089 /***********************************************************************
1090 * WINPOS_HandleWindowPosChanging16
1092 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1094 LONG
WINPOS_HandleWindowPosChanging16( WND
*wndPtr
, WINDOWPOS16
*winpos
)
1097 if (winpos
->flags
& SWP_NOSIZE
) return 0;
1098 if ((wndPtr
->dwStyle
& WS_THICKFRAME
) ||
1099 ((wndPtr
->dwStyle
& (WS_POPUP
| WS_CHILD
)) == 0))
1101 NC_GetMinMaxInfo( winpos
->hwnd
, &maxSize
, NULL
, NULL
, NULL
);
1102 winpos
->cx
= MIN( winpos
->cx
, maxSize
.x
);
1103 winpos
->cy
= MIN( winpos
->cy
, maxSize
.y
);
1109 /***********************************************************************
1110 * WINPOS_HandleWindowPosChanging32
1112 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1114 LONG
WINPOS_HandleWindowPosChanging32( WND
*wndPtr
, WINDOWPOS32
*winpos
)
1117 if (winpos
->flags
& SWP_NOSIZE
) return 0;
1118 if ((wndPtr
->dwStyle
& WS_THICKFRAME
) ||
1119 ((wndPtr
->dwStyle
& (WS_POPUP
| WS_CHILD
)) == 0))
1121 NC_GetMinMaxInfo( winpos
->hwnd
, &maxSize
, NULL
, NULL
, NULL
);
1122 winpos
->cx
= MIN( winpos
->cx
, maxSize
.x
);
1123 winpos
->cy
= MIN( winpos
->cy
, maxSize
.y
);
1129 /***********************************************************************
1130 * WINPOS_MoveWindowZOrder
1132 * Move a window in Z order, invalidating everything that needs it.
1133 * Only necessary for windows without associated X window.
1135 static void WINPOS_MoveWindowZOrder( HWND hwnd
, HWND hwndAfter
)
1138 WND
*pWndAfter
, *pWndCur
, *wndPtr
= WIN_FindWndPtr( hwnd
);
1140 /* We have two possible cases:
1141 * - The window is moving up: we have to invalidate all areas
1142 * of the window that were covered by other windows
1143 * - The window is moving down: we have to invalidate areas
1144 * of other windows covered by this one.
1147 if (hwndAfter
== HWND_TOP
)
1151 else if (hwndAfter
== HWND_BOTTOM
)
1153 if (!wndPtr
->next
) return; /* Already at the bottom */
1158 if (!(pWndAfter
= WIN_FindWndPtr( hwndAfter
))) return;
1159 if (wndPtr
->next
== pWndAfter
) return; /* Already placed right */
1161 /* Determine which window we encounter first in Z-order */
1162 pWndCur
= wndPtr
->parent
->child
;
1163 while ((pWndCur
!= wndPtr
) && (pWndCur
!= pWndAfter
))
1164 pWndCur
= pWndCur
->next
;
1165 movingUp
= (pWndCur
== pWndAfter
);
1170 WND
*pWndPrevAfter
= wndPtr
->next
;
1171 WIN_UnlinkWindow( hwnd
);
1172 WIN_LinkWindow( hwnd
, hwndAfter
);
1173 pWndCur
= wndPtr
->next
;
1174 while (pWndCur
!= pWndPrevAfter
)
1176 RECT16 rect
= pWndCur
->rectWindow
;
1177 OffsetRect16( &rect
, -wndPtr
->rectClient
.left
,
1178 -wndPtr
->rectClient
.top
);
1179 RedrawWindow16( hwnd
, &rect
, 0, RDW_INVALIDATE
| RDW_ALLCHILDREN
|
1180 RDW_FRAME
| RDW_ERASE
);
1181 pWndCur
= pWndCur
->next
;
1184 else /* Moving down */
1186 pWndCur
= wndPtr
->next
;
1187 WIN_UnlinkWindow( hwnd
);
1188 WIN_LinkWindow( hwnd
, hwndAfter
);
1189 while (pWndCur
!= wndPtr
)
1191 RECT16 rect
= wndPtr
->rectWindow
;
1192 OffsetRect16( &rect
, -pWndCur
->rectClient
.left
,
1193 -pWndCur
->rectClient
.top
);
1194 RedrawWindow16( pWndCur
->hwndSelf
, &rect
, 0, RDW_INVALIDATE
|
1195 RDW_ALLCHILDREN
| RDW_FRAME
| RDW_ERASE
);
1196 pWndCur
= pWndCur
->next
;
1201 /***********************************************************************
1202 * WINPOS_ReorderOwnedPopups
1204 * fix Z order taking into account owned popups -
1205 * basically we need to maintain them above owner window
1207 HWND
WINPOS_ReorderOwnedPopups(HWND hwndInsertAfter
, WND
* wndPtr
, WORD flags
)
1209 WND
* w
= WIN_GetDesktop();
1213 /* if we are dealing with owned popup...
1215 if( wndPtr
->dwStyle
& WS_POPUP
&& wndPtr
->owner
&& hwndInsertAfter
!= HWND_TOP
)
1217 BOOL bFound
= FALSE
;
1218 HWND hwndLocalPrev
= HWND_TOP
;
1219 HWND hwndNewAfter
= 0;
1223 if( !bFound
&& hwndInsertAfter
== hwndLocalPrev
)
1224 hwndInsertAfter
= HWND_TOP
;
1226 if( w
->dwStyle
& WS_POPUP
&& w
->owner
== wndPtr
->owner
)
1230 if( hwndInsertAfter
== HWND_TOP
)
1232 hwndInsertAfter
= hwndLocalPrev
;
1235 hwndNewAfter
= hwndLocalPrev
;
1238 if( w
== wndPtr
->owner
)
1240 /* basically HWND_BOTTOM */
1241 hwndInsertAfter
= hwndLocalPrev
;
1244 hwndInsertAfter
= hwndNewAfter
;
1249 hwndLocalPrev
= w
->hwndSelf
;
1255 /* or overlapped top-level window...
1257 if( !(wndPtr
->dwStyle
& WS_CHILD
) )
1260 if( w
== wndPtr
) break;
1262 if( w
->dwStyle
& WS_POPUP
&& w
->owner
== wndPtr
)
1264 SetWindowPos(w
->hwndSelf
, hwndInsertAfter
, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
|
1265 SWP_NOACTIVATE
| SWP_NOSENDCHANGING
| SWP_DEFERERASE
);
1266 hwndInsertAfter
= w
->hwndSelf
;
1271 return hwndInsertAfter
;
1274 /***********************************************************************
1275 * WINPOS_SizeMoveClean
1277 * Make window look nice without excessive repainting
1281 * visible regions are in window coordinates
1282 * update regions are in window client coordinates
1283 * client and window rectangles are in parent client coordinates
1285 static void WINPOS_SizeMoveClean(WND
* Wnd
, HRGN oldVisRgn
, LPRECT16 lpOldWndRect
, LPRECT16 lpOldClientRect
, BOOL bNoCopy
)
1287 HRGN newVisRgn
= DCE_GetVisRgn(Wnd
->hwndSelf
, DCX_WINDOW
| DCX_CLIPSIBLINGS
);
1288 HRGN dirtyRgn
= CreateRectRgn(0,0,0,0);
1291 dprintf_win(stddeb
,"cleaning up...new wnd=(%i %i-%i %i) old wnd=(%i %i-%i %i)\n\
1292 \t\tnew client=(%i %i-%i %i) old client=(%i %i-%i %i)\n",
1293 Wnd
->rectWindow
.left
, Wnd
->rectWindow
.top
, Wnd
->rectWindow
.right
, Wnd
->rectWindow
.bottom
,
1294 lpOldWndRect
->left
, lpOldWndRect
->top
, lpOldWndRect
->right
, lpOldWndRect
->bottom
,
1295 Wnd
->rectClient
.left
,Wnd
->rectClient
.top
,Wnd
->rectClient
.right
,Wnd
->rectClient
.bottom
,
1296 lpOldClientRect
->left
,lpOldClientRect
->top
,lpOldClientRect
->right
,lpOldClientRect
->bottom
);
1298 CombineRgn( dirtyRgn
, newVisRgn
, 0, RGN_COPY
);
1302 HRGN hRgn
= CreateRectRgn( lpOldClientRect
->left
- lpOldWndRect
->left
, lpOldClientRect
->top
- lpOldWndRect
->top
,
1303 lpOldClientRect
->right
- lpOldWndRect
->left
, lpOldClientRect
->bottom
- lpOldWndRect
->top
);
1304 CombineRgn( newVisRgn
, newVisRgn
, oldVisRgn
, RGN_AND
);
1305 CombineRgn( newVisRgn
, newVisRgn
, hRgn
, RGN_AND
);
1309 /* map regions to the parent client area */
1311 OffsetRgn(dirtyRgn
, Wnd
->rectWindow
.left
, Wnd
->rectWindow
.top
);
1312 OffsetRgn(oldVisRgn
, lpOldWndRect
->left
, lpOldWndRect
->top
);
1314 /* compute invalidated region outside Wnd - (in client coordinates of the parent window) */
1316 other
= CombineRgn(dirtyRgn
, oldVisRgn
, dirtyRgn
, RGN_DIFF
);
1318 /* map visible region to the Wnd client area */
1320 OffsetRgn( newVisRgn
, Wnd
->rectWindow
.left
- Wnd
->rectClient
.left
,
1321 Wnd
->rectWindow
.top
- Wnd
->rectClient
.top
);
1323 /* substract previously invalidated region from the Wnd visible region */
1325 my
= (Wnd
->hrgnUpdate
> 1)? CombineRgn( newVisRgn
, newVisRgn
, Wnd
->hrgnUpdate
, RGN_DIFF
)
1328 if( bNoCopy
) /* invalidate Wnd visible region */
1330 if (my
!= NULLREGION
) RedrawWindow32( Wnd
->hwndSelf
, NULL
, newVisRgn
, RDW_INVALIDATE
|
1331 RDW_FRAME
| RDW_ALLCHILDREN
| RDW_ERASE
);
1333 else /* bitblt old client area */
1341 updateRgn
= CreateRectRgn( 0,0, Wnd
->rectClient
.right
- Wnd
->rectClient
.left
,
1342 Wnd
->rectClient
.bottom
- Wnd
->rectClient
.top
);
1344 /* clip visible region with client rect */
1346 my
= CombineRgn( newVisRgn
, newVisRgn
, updateRgn
, RGN_AND
);
1348 /* substract result from client rect to get region that won't be copied */
1350 update
= CombineRgn( updateRgn
, updateRgn
, newVisRgn
, RGN_DIFF
);
1352 /* Blt valid bits using parent window DC */
1354 if( my
!= NULLREGION
)
1356 int xfrom
= lpOldClientRect
->left
;
1357 int yfrom
= lpOldClientRect
->top
;
1358 int xto
= Wnd
->rectClient
.left
;
1359 int yto
= Wnd
->rectClient
.top
;
1361 /* check if we can skip copying */
1363 if( xfrom
!= xto
|| yfrom
!= yto
)
1365 /* compute clipping region in parent client coordinates */
1367 OffsetRgn( newVisRgn
, Wnd
->rectClient
.left
, Wnd
->rectClient
.top
);
1368 CombineRgn( oldVisRgn
, oldVisRgn
, newVisRgn
, RGN_OR
);
1370 hDC
= GetDCEx( Wnd
->parent
->hwndSelf
, oldVisRgn
, DCX_KEEPCLIPRGN
| DCX_INTERSECTRGN
| DCX_CACHE
| DCX_CLIPSIBLINGS
);
1372 BitBlt(hDC
, xto
, yto
, lpOldClientRect
->right
- lpOldClientRect
->left
,
1373 lpOldClientRect
->bottom
- lpOldClientRect
->top
,
1374 hDC
, xfrom
, yfrom
, SRCCOPY
);
1376 ReleaseDC( Wnd
->parent
->hwndSelf
, hDC
);
1380 if( update
!= NULLREGION
)
1381 RedrawWindow32( Wnd
->hwndSelf
, NULL
, updateRgn
, RDW_INVALIDATE
|
1382 RDW_FRAME
| RDW_ALLCHILDREN
| RDW_ERASE
);
1383 DeleteObject( updateRgn
);
1386 /* erase uncovered areas */
1388 if( other
!= NULLREGION
)
1389 RedrawWindow32( Wnd
->parent
->hwndSelf
, NULL
, dirtyRgn
,
1390 RDW_INVALIDATE
| RDW_ALLCHILDREN
| RDW_ERASE
);
1392 DeleteObject(dirtyRgn
);
1393 DeleteObject(newVisRgn
);
1397 /***********************************************************************
1398 * WINPOS_ForceXWindowRaise
1400 void WINPOS_ForceXWindowRaise( WND
* pWnd
)
1402 XWindowChanges winChanges
;
1403 WND
*wndStop
, *wndLast
;
1405 if (!pWnd
->window
) return;
1407 wndLast
= wndStop
= pWnd
;
1408 winChanges
.stack_mode
= Above
;
1409 XReconfigureWMWindow( display
, pWnd
->window
, 0, CWStackMode
, &winChanges
);
1411 /* Recursively raise owned popups according to their z-order
1412 * (it would be easier with sibling-related Below but it doesn't
1413 * work very well with SGI mwm for instance)
1417 WND
*wnd
= WIN_GetDesktop()->child
;
1419 while (wnd
!= wndStop
)
1421 if (wnd
->owner
== pWnd
&&
1422 (wnd
->dwStyle
& WS_POPUP
) &&
1423 (wnd
->dwStyle
& WS_VISIBLE
))
1429 WINPOS_ForceXWindowRaise( wndLast
);
1436 /***********************************************************************
1437 * WINPOS_SetXWindowPos
1439 * SetWindowPos() for an X window. Used by the real SetWindowPos().
1441 static void WINPOS_SetXWindowPos( WINDOWPOS16
*winpos
)
1443 XWindowChanges winChanges
;
1445 WND
*wndPtr
= WIN_FindWndPtr( winpos
->hwnd
);
1447 if (!(winpos
->flags
& SWP_NOSIZE
))
1449 winChanges
.width
= winpos
->cx
;
1450 winChanges
.height
= winpos
->cy
;
1451 changeMask
|= CWWidth
| CWHeight
;
1453 /* Tweak dialog window size hints */
1455 if ((wndPtr
->flags
& WIN_MANAGED
) &&
1456 (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
))
1458 XSizeHints
*size_hints
= XAllocSizeHints();
1462 long supplied_return
;
1464 XGetWMSizeHints( display
, wndPtr
->window
, size_hints
,
1465 &supplied_return
, XA_WM_NORMAL_HINTS
);
1466 size_hints
->min_width
= size_hints
->max_width
= winpos
->cx
;
1467 size_hints
->min_height
= size_hints
->max_height
= winpos
->cy
;
1468 XSetWMSizeHints( display
, wndPtr
->window
, size_hints
,
1469 XA_WM_NORMAL_HINTS
);
1474 if (!(winpos
->flags
& SWP_NOMOVE
))
1476 winChanges
.x
= winpos
->x
;
1477 winChanges
.y
= winpos
->y
;
1478 changeMask
|= CWX
| CWY
;
1480 if (!(winpos
->flags
& SWP_NOZORDER
))
1482 if (winpos
->hwndInsertAfter
== HWND_TOP
) winChanges
.stack_mode
= Above
;
1483 else winChanges
.stack_mode
= Below
;
1484 if ((winpos
->hwndInsertAfter
!= HWND_TOP
) &&
1485 (winpos
->hwndInsertAfter
!= HWND_BOTTOM
))
1487 WND
* insertPtr
= WIN_FindWndPtr( winpos
->hwndInsertAfter
);
1488 winChanges
.sibling
= insertPtr
->window
;
1489 changeMask
|= CWSibling
;
1491 changeMask
|= CWStackMode
;
1493 if (!changeMask
) return;
1494 if (wndPtr
->flags
& WIN_MANAGED
)
1495 XReconfigureWMWindow( display
, wndPtr
->window
, 0,
1496 changeMask
, &winChanges
);
1497 else XConfigureWindow( display
, wndPtr
->window
, changeMask
, &winChanges
);
1501 /***********************************************************************
1502 * SetWindowPos (USER.232)
1504 BOOL
SetWindowPos( HWND hwnd
, HWND hwndInsertAfter
, INT x
, INT y
,
1505 INT cx
, INT cy
, WORD flags
)
1509 RECT16 newWindowRect
, newClientRect
;
1513 dprintf_win(stddeb
,"SetWindowPos: hwnd %04x, (%i,%i)-(%i,%i) flags %08x\n",
1514 hwnd
, x
, y
, x
+cx
, y
+cy
, flags
);
1515 /* Check window handle */
1517 if (hwnd
== GetDesktopWindow()) return FALSE
;
1518 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) return FALSE
;
1520 if (wndPtr
->dwStyle
& WS_VISIBLE
) flags
&= ~SWP_SHOWWINDOW
;
1523 flags
&= ~SWP_HIDEWINDOW
;
1524 if (!(flags
& SWP_SHOWWINDOW
)) flags
|= SWP_NOREDRAW
;
1527 /* Check for windows that may not be resized
1528 FIXME: this should be done only for Windows 3.0 programs
1529 */ if (flags
& (SWP_SHOWWINDOW
| SWP_HIDEWINDOW
) )
1530 flags
|= SWP_NOSIZE
| SWP_NOMOVE
;
1532 /* Check dimensions */
1534 if (cx
<= 0) cx
= 1;
1535 if (cy
<= 0) cy
= 1;
1539 if (hwnd
== hwndActive
) flags
|= SWP_NOACTIVATE
; /* Already active */
1540 if ((wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
== cx
) &&
1541 (wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
== cy
))
1542 flags
|= SWP_NOSIZE
; /* Already the right size */
1543 if ((wndPtr
->rectWindow
.left
== x
) && (wndPtr
->rectWindow
.top
== y
))
1544 flags
|= SWP_NOMOVE
; /* Already the right position */
1546 /* Check hwndInsertAfter */
1548 if (!(flags
& (SWP_NOZORDER
| SWP_NOACTIVATE
)))
1550 /* Ignore TOPMOST flags when activating a window */
1551 /* _and_ moving it in Z order. */
1552 if ((hwndInsertAfter
== HWND_TOPMOST
) ||
1553 (hwndInsertAfter
== HWND_NOTOPMOST
))
1554 hwndInsertAfter
= HWND_TOP
;
1556 /* TOPMOST not supported yet */
1557 if ((hwndInsertAfter
== HWND_TOPMOST
) ||
1558 (hwndInsertAfter
== HWND_NOTOPMOST
)) hwndInsertAfter
= HWND_TOP
;
1560 /* hwndInsertAfter must be a sibling of the window */
1561 if ((hwndInsertAfter
!= HWND_TOP
) && (hwndInsertAfter
!= HWND_BOTTOM
))
1563 WND
* wnd
= WIN_FindWndPtr(hwndInsertAfter
);
1564 if( wnd
->parent
!= wndPtr
->parent
) return FALSE
;
1565 if( wnd
->next
== wndPtr
) flags
|= SWP_NOZORDER
;
1568 if (hwndInsertAfter
== HWND_TOP
)
1569 flags
|= ( wndPtr
->parent
->child
== wndPtr
)? SWP_NOZORDER
: 0;
1570 else /* HWND_BOTTOM */
1571 flags
|= ( wndPtr
->next
)? 0: SWP_NOZORDER
;
1573 /* Fill the WINDOWPOS structure */
1576 winpos
.hwndInsertAfter
= hwndInsertAfter
;
1581 winpos
.flags
= flags
;
1583 /* Send WM_WINDOWPOSCHANGING message */
1585 if (!(flags
& SWP_NOSENDCHANGING
))
1586 SendMessage16( hwnd
, WM_WINDOWPOSCHANGING
, 0, (LPARAM
)MAKE_SEGPTR(&winpos
) );
1588 /* Calculate new position and size */
1590 newWindowRect
= wndPtr
->rectWindow
;
1591 newClientRect
= wndPtr
->rectClient
;
1593 if (!(winpos
.flags
& SWP_NOSIZE
))
1595 newWindowRect
.right
= newWindowRect
.left
+ winpos
.cx
;
1596 newWindowRect
.bottom
= newWindowRect
.top
+ winpos
.cy
;
1598 if (!(winpos
.flags
& SWP_NOMOVE
))
1600 newWindowRect
.left
= winpos
.x
;
1601 newWindowRect
.top
= winpos
.y
;
1602 newWindowRect
.right
+= winpos
.x
- wndPtr
->rectWindow
.left
;
1603 newWindowRect
.bottom
+= winpos
.y
- wndPtr
->rectWindow
.top
;
1605 OffsetRect16( &newClientRect
, winpos
.x
- wndPtr
->rectWindow
.left
,
1606 winpos
.y
- wndPtr
->rectWindow
.top
);
1609 winpos
.flags
|= SWP_NOCLIENTMOVE
| SWP_NOCLIENTSIZE
;
1611 /* Reposition window in Z order */
1613 if (!(winpos
.flags
& SWP_NOZORDER
))
1615 /* reorder owned popups if hwnd is top-level window
1617 if( wndPtr
->parent
== WIN_GetDesktop() )
1618 hwndInsertAfter
= WINPOS_ReorderOwnedPopups( hwndInsertAfter
,
1623 WIN_UnlinkWindow( winpos
.hwnd
);
1624 WIN_LinkWindow( winpos
.hwnd
, hwndInsertAfter
);
1626 else WINPOS_MoveWindowZOrder( winpos
.hwnd
, hwndInsertAfter
);
1629 if ( !wndPtr
->window
&& !(flags
& SWP_NOREDRAW
) &&
1630 (!(flags
& SWP_NOMOVE
) || !(flags
& SWP_NOSIZE
) || (flags
& SWP_FRAMECHANGED
)) )
1631 visRgn
= DCE_GetVisRgn(hwnd
, DCX_WINDOW
| DCX_CLIPSIBLINGS
);
1634 /* Send WM_NCCALCSIZE message to get new client area */
1635 if( (flags
& (SWP_FRAMECHANGED
| SWP_NOSIZE
)) != SWP_NOSIZE
)
1637 result
= WINPOS_SendNCCalcSize( winpos
.hwnd
, TRUE
, &newWindowRect
,
1638 &wndPtr
->rectWindow
, &wndPtr
->rectClient
,
1639 MAKE_SEGPTR(&winpos
), &newClientRect
);
1641 /* FIXME: WVR_ALIGNxxx */
1643 if( newClientRect
.left
!= wndPtr
->rectClient
.left
||
1644 newClientRect
.top
!= wndPtr
->rectClient
.top
)
1645 winpos
.flags
&= ~SWP_NOCLIENTMOVE
;
1647 if( (newClientRect
.right
- newClientRect
.left
!=
1648 wndPtr
->rectClient
.right
- wndPtr
->rectClient
.left
) ||
1649 (newClientRect
.bottom
- newClientRect
.top
!=
1650 wndPtr
->rectClient
.bottom
- wndPtr
->rectClient
.top
) )
1651 winpos
.flags
&= ~SWP_NOCLIENTSIZE
;
1654 if( !(flags
& SWP_NOMOVE
) && (newClientRect
.left
!= wndPtr
->rectClient
.left
||
1655 newClientRect
.top
!= wndPtr
->rectClient
.top
) )
1656 winpos
.flags
&= ~SWP_NOCLIENTMOVE
;
1658 /* Update active DCEs */
1660 if( !(flags
& SWP_NOZORDER
) || (flags
& SWP_HIDEWINDOW
) || (flags
& SWP_SHOWWINDOW
)
1661 || (memcmp(&newWindowRect
,&wndPtr
->rectWindow
,sizeof(RECT16
))
1662 && wndPtr
->dwStyle
& WS_VISIBLE
) )
1666 UnionRect16(&rect
,&newWindowRect
,&wndPtr
->rectWindow
);
1667 DCE_InvalidateDCE(wndPtr
->parent
, &rect
);
1670 /* Perform the moving and resizing */
1674 RECT16 oldWindowRect
= wndPtr
->rectWindow
;
1675 RECT16 oldClientRect
= wndPtr
->rectClient
;
1677 HWND bogusInsertAfter
= winpos
.hwndInsertAfter
;
1679 winpos
.hwndInsertAfter
= hwndInsertAfter
;
1680 WINPOS_SetXWindowPos( &winpos
);
1682 wndPtr
->rectWindow
= newWindowRect
;
1683 wndPtr
->rectClient
= newClientRect
;
1684 winpos
.hwndInsertAfter
= bogusInsertAfter
;
1686 /* FIXME: should do something like WINPOS_SizeMoveClean */
1688 if( (oldClientRect
.left
- oldWindowRect
.left
!=
1689 newClientRect
.left
- newWindowRect
.left
) ||
1690 (oldClientRect
.top
- oldWindowRect
.top
!=
1691 newClientRect
.top
- newWindowRect
.top
) )
1693 RedrawWindow32( wndPtr
->hwndSelf
, NULL
, 0, RDW_INVALIDATE
|
1694 RDW_ALLCHILDREN
| RDW_FRAME
| RDW_ERASE
);
1696 if( winpos
.flags
& SWP_FRAMECHANGED
)
1701 if( oldClientRect
.right
> newClientRect
.right
)
1703 rect
.left
= newClientRect
.right
; rect
.top
= newClientRect
.top
;
1704 rect
.right
= oldClientRect
.right
; rect
.bottom
= newClientRect
.bottom
;
1706 RedrawWindow32( wndPtr
->hwndSelf
, &rect
, 0,
1707 RDW_INVALIDATE
| RDW_FRAME
| RDW_ALLCHILDREN
);
1709 if( oldClientRect
.bottom
> newClientRect
.bottom
)
1711 rect
.left
= newClientRect
.left
; rect
.top
= newClientRect
.bottom
;
1712 rect
.right
= (wErase
)?oldClientRect
.right
:newClientRect
.right
;
1713 rect
.bottom
= oldClientRect
.bottom
;
1715 RedrawWindow32( wndPtr
->hwndSelf
, &rect
, 0,
1716 RDW_INVALIDATE
| RDW_FRAME
| RDW_ALLCHILDREN
);
1718 if( !wErase
) wndPtr
->flags
|= WIN_NEEDS_NCPAINT
;
1723 RECT16 oldWindowRect
= wndPtr
->rectWindow
;
1724 RECT16 oldClientRect
= wndPtr
->rectClient
;
1726 wndPtr
->rectWindow
= newWindowRect
;
1727 wndPtr
->rectClient
= newClientRect
;
1729 if( !(flags
& SWP_NOREDRAW
) )
1731 BOOL bNoCopy
= (flags
& SWP_NOCOPYBITS
) ||
1732 (result
>= WVR_HREDRAW
&& result
< WVR_VALIDRECTS
);
1734 if( (winpos
.flags
& SWP_AGG_NOGEOMETRYCHANGE
) != SWP_AGG_NOGEOMETRYCHANGE
)
1735 /* optimize cleanup by BitBlt'ing where possible */
1737 WINPOS_SizeMoveClean(wndPtr
, visRgn
, &oldWindowRect
, &oldClientRect
, bNoCopy
);
1739 if( winpos
.flags
& SWP_FRAMECHANGED
)
1740 RedrawWindow32( winpos
.hwnd
, NULL
, 0, RDW_NOCHILDREN
| RDW_FRAME
);
1743 DeleteObject(visRgn
);
1746 if (flags
& SWP_SHOWWINDOW
)
1748 wndPtr
->dwStyle
|= WS_VISIBLE
;
1751 XMapWindow( display
, wndPtr
->window
);
1755 if (!(flags
& SWP_NOREDRAW
))
1756 RedrawWindow32( winpos
.hwnd
, NULL
, 0,
1757 RDW_INVALIDATE
| RDW_ALLCHILDREN
|
1758 RDW_FRAME
| RDW_ERASE
);
1761 else if (flags
& SWP_HIDEWINDOW
)
1763 wndPtr
->dwStyle
&= ~WS_VISIBLE
;
1766 XUnmapWindow( display
, wndPtr
->window
);
1770 if (!(flags
& SWP_NOREDRAW
))
1771 RedrawWindow16( wndPtr
->parent
->hwndSelf
, &wndPtr
->rectWindow
, 0,
1772 RDW_INVALIDATE
| RDW_ALLCHILDREN
| RDW_ERASE
);
1775 if ((winpos
.hwnd
== GetFocus()) || IsChild(winpos
.hwnd
, GetFocus()))
1776 SetFocus( GetParent(winpos
.hwnd
) ); /* Revert focus to parent */
1778 if (winpos
.hwnd
== hwndActive
)
1780 /* Activate previously active window if possible */
1781 HWND newActive
= hwndPrevActive
;
1782 if (!IsWindow(newActive
) || (newActive
== winpos
.hwnd
))
1784 newActive
= GetTopWindow( GetDesktopWindow() );
1785 if (newActive
== winpos
.hwnd
)
1786 newActive
= wndPtr
->next
? wndPtr
->next
->hwndSelf
: 0;
1788 WINPOS_ChangeActiveWindow( newActive
, FALSE
);
1792 /* Activate the window */
1794 if (!(flags
& SWP_NOACTIVATE
))
1795 WINPOS_ChangeActiveWindow( winpos
.hwnd
, FALSE
);
1797 /* Repaint the window */
1799 if (wndPtr
->window
) EVENT_Synchronize(); /* Wait for all expose events */
1801 EVENT_DummyMotionNotify(); /* Simulate a mouse event to set the cursor */
1803 if (!(flags
& SWP_DEFERERASE
))
1804 RedrawWindow32( wndPtr
->parent
->hwndSelf
, NULL
, 0,
1805 RDW_ALLCHILDREN
| RDW_ERASENOW
);
1807 /* And last, send the WM_WINDOWPOSCHANGED message */
1809 dprintf_win(stddeb
,"\tstatus flags = %04x\n", winpos
.flags
& SWP_AGG_STATUSFLAGS
);
1811 if ( ((winpos
.flags
& SWP_AGG_STATUSFLAGS
) != SWP_AGG_NOPOSCHANGE
) &&
1812 !(winpos
.flags
& SWP_NOSENDCHANGING
))
1813 SendMessage16( winpos
.hwnd
, WM_WINDOWPOSCHANGED
,
1814 0, (LPARAM
)MAKE_SEGPTR(&winpos
) );
1820 /***********************************************************************
1821 * BeginDeferWindowPos (USER.259)
1823 HDWP16
BeginDeferWindowPos( INT count
)
1828 if (count
<= 0) return 0;
1829 handle
= USER_HEAP_ALLOC( sizeof(DWP
) + (count
-1)*sizeof(WINDOWPOS16
) );
1830 if (!handle
) return 0;
1831 pDWP
= (DWP
*) USER_HEAP_LIN_ADDR( handle
);
1832 pDWP
->actualCount
= 0;
1833 pDWP
->suggestedCount
= count
;
1835 pDWP
->wMagic
= DWP_MAGIC
;
1836 pDWP
->hwndParent
= 0;
1841 /***********************************************************************
1842 * DeferWindowPos (USER.260)
1844 HDWP16
DeferWindowPos( HDWP16 hdwp
, HWND hwnd
, HWND hwndAfter
, INT x
, INT y
,
1845 INT cx
, INT cy
, UINT flags
)
1849 HDWP16 newhdwp
= hdwp
;
1852 pDWP
= (DWP
*) USER_HEAP_LIN_ADDR( hdwp
);
1853 if (!pDWP
) return 0;
1854 if (hwnd
== GetDesktopWindow()) return 0;
1856 /* All the windows of a DeferWindowPos() must have the same parent */
1858 parent
= WIN_FindWndPtr( hwnd
)->parent
->hwndSelf
;
1859 if (pDWP
->actualCount
== 0) pDWP
->hwndParent
= parent
;
1860 else if (parent
!= pDWP
->hwndParent
)
1862 USER_HEAP_FREE( hdwp
);
1866 for (i
= 0; i
< pDWP
->actualCount
; i
++)
1868 if (pDWP
->winPos
[i
].hwnd
== hwnd
)
1870 /* Merge with the other changes */
1871 if (!(flags
& SWP_NOZORDER
))
1873 pDWP
->winPos
[i
].hwndInsertAfter
= hwndAfter
;
1875 if (!(flags
& SWP_NOMOVE
))
1877 pDWP
->winPos
[i
].x
= x
;
1878 pDWP
->winPos
[i
].y
= y
;
1880 if (!(flags
& SWP_NOSIZE
))
1882 pDWP
->winPos
[i
].cx
= cx
;
1883 pDWP
->winPos
[i
].cy
= cy
;
1885 pDWP
->winPos
[i
].flags
&= flags
& (SWP_NOSIZE
| SWP_NOMOVE
|
1886 SWP_NOZORDER
| SWP_NOREDRAW
|
1887 SWP_NOACTIVATE
| SWP_NOCOPYBITS
|
1889 pDWP
->winPos
[i
].flags
|= flags
& (SWP_SHOWWINDOW
| SWP_HIDEWINDOW
|
1894 if (pDWP
->actualCount
>= pDWP
->suggestedCount
)
1896 newhdwp
= USER_HEAP_REALLOC( hdwp
,
1897 sizeof(DWP
) + pDWP
->suggestedCount
*sizeof(WINDOWPOS16
) );
1898 if (!newhdwp
) return 0;
1899 pDWP
= (DWP
*) USER_HEAP_LIN_ADDR( newhdwp
);
1900 pDWP
->suggestedCount
++;
1902 pDWP
->winPos
[pDWP
->actualCount
].hwnd
= hwnd
;
1903 pDWP
->winPos
[pDWP
->actualCount
].hwndInsertAfter
= hwndAfter
;
1904 pDWP
->winPos
[pDWP
->actualCount
].x
= x
;
1905 pDWP
->winPos
[pDWP
->actualCount
].y
= y
;
1906 pDWP
->winPos
[pDWP
->actualCount
].cx
= cx
;
1907 pDWP
->winPos
[pDWP
->actualCount
].cy
= cy
;
1908 pDWP
->winPos
[pDWP
->actualCount
].flags
= flags
;
1909 pDWP
->actualCount
++;
1914 /***********************************************************************
1915 * EndDeferWindowPos (USER.261)
1917 BOOL
EndDeferWindowPos( HDWP16 hdwp
)
1920 WINDOWPOS16
*winpos
;
1924 pDWP
= (DWP
*) USER_HEAP_LIN_ADDR( hdwp
);
1925 if (!pDWP
) return FALSE
;
1926 for (i
= 0, winpos
= pDWP
->winPos
; i
< pDWP
->actualCount
; i
++, winpos
++)
1928 if (!(res
= SetWindowPos( winpos
->hwnd
, winpos
->hwndInsertAfter
,
1929 winpos
->x
, winpos
->y
, winpos
->cx
, winpos
->cy
,
1930 winpos
->flags
))) break;
1932 USER_HEAP_FREE( hdwp
);
1937 /***********************************************************************
1938 * TileChildWindows (USER.199)
1940 void TileChildWindows( HWND parent
, WORD action
)
1942 printf("STUB TileChildWindows(%04x, %d)\n", parent
, action
);
1945 /***********************************************************************
1946 * CascageChildWindows (USER.198)
1948 void CascadeChildWindows( HWND parent
, WORD action
)
1950 printf("STUB CascadeChildWindows(%04x, %d)\n", parent
, action
);