Fix a few region debug messages.
[wine.git] / windows / winpos.c
blob4140a8d79dfff75cf60cf98f154c86b7255f1100
1 /*
2 * Window position related functions.
4 * Copyright 1993, 1994, 1995 Alexandre Julliard
5 * 1995, 1996, 1999 Alex Korobka
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
23 #include "wine/port.h"
25 #include <stdarg.h>
26 #include <string.h>
27 #include "winerror.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winerror.h"
32 #include "wine/winuser16.h"
33 #include "wine/server.h"
34 #include "controls.h"
35 #include "user.h"
36 #include "win.h"
37 #include "message.h"
38 #include "winpos.h"
39 #include "nonclient.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(win);
44 #define HAS_DLGFRAME(style,exStyle) \
45 (((exStyle) & WS_EX_DLGMODALFRAME) || \
46 (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
48 #define HAS_THICKFRAME(style) \
49 (((style) & WS_THICKFRAME) && \
50 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
52 #define EMPTYPOINT(pt) ((*(LONG*)&(pt)) == -1)
54 #define PLACE_MIN 0x0001
55 #define PLACE_MAX 0x0002
56 #define PLACE_RECT 0x0004
59 #define DWP_MAGIC ((INT)('W' | ('P' << 8) | ('O' << 16) | ('S' << 24)))
61 typedef struct
63 INT actualCount;
64 INT suggestedCount;
65 BOOL valid;
66 INT wMagic;
67 HWND hwndParent;
68 WINDOWPOS winPos[1];
69 } DWP;
71 /* ----- internal variables ----- */
73 static LPCSTR atomInternalPos;
76 /***********************************************************************
77 * WINPOS_CreateInternalPosAtom
79 BOOL WINPOS_CreateInternalPosAtom()
81 LPCSTR str = "SysIP";
82 atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str);
83 return (atomInternalPos) ? TRUE : FALSE;
86 /***********************************************************************
87 * WINPOS_CheckInternalPos
89 * Called when a window is destroyed.
91 void WINPOS_CheckInternalPos( HWND hwnd )
93 LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
95 if( lpPos )
97 if( IsWindow(lpPos->hwndIconTitle) )
98 DestroyWindow( lpPos->hwndIconTitle );
99 HeapFree( GetProcessHeap(), 0, lpPos );
103 /***********************************************************************
104 * ArrangeIconicWindows (USER32.@)
106 UINT WINAPI ArrangeIconicWindows( HWND parent )
108 RECT rectParent;
109 HWND hwndChild;
110 INT x, y, xspacing, yspacing;
112 GetClientRect( parent, &rectParent );
113 x = rectParent.left;
114 y = rectParent.bottom;
115 xspacing = GetSystemMetrics(SM_CXICONSPACING);
116 yspacing = GetSystemMetrics(SM_CYICONSPACING);
118 hwndChild = GetWindow( parent, GW_CHILD );
119 while (hwndChild)
121 if( IsIconic( hwndChild ) )
123 WINPOS_ShowIconTitle( hwndChild, FALSE );
125 SetWindowPos( hwndChild, 0, x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
126 y - yspacing - GetSystemMetrics(SM_CYICON)/2, 0, 0,
127 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
128 if( IsWindow(hwndChild) )
129 WINPOS_ShowIconTitle(hwndChild , TRUE );
131 if (x <= rectParent.right - xspacing) x += xspacing;
132 else
134 x = rectParent.left;
135 y -= yspacing;
138 hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
140 return yspacing;
144 /***********************************************************************
145 * SwitchToThisWindow (USER32.@)
147 void WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
149 ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
153 /***********************************************************************
154 * GetWindowRect (USER32.@)
156 BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
158 BOOL ret = WIN_GetRectangles( hwnd, rect, NULL );
159 if (ret)
161 MapWindowPoints( GetAncestor( hwnd, GA_PARENT ), 0, (POINT *)rect, 2 );
162 TRACE( "hwnd %p (%ld,%ld)-(%ld,%ld)\n",
163 hwnd, rect->left, rect->top, rect->right, rect->bottom);
165 return ret;
169 /***********************************************************************
170 * GetWindowRgn (USER32.@)
172 int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
174 int nRet = ERROR;
175 HRGN win_rgn = 0;
176 RGNDATA *data;
177 size_t size = 256;
178 BOOL retry = FALSE;
182 if (!(data = HeapAlloc( GetProcessHeap(), 0, sizeof(*data) + size - 1 )))
184 SetLastError( ERROR_OUTOFMEMORY );
185 return ERROR;
187 SERVER_START_REQ( get_window_region )
189 req->window = hwnd;
190 wine_server_set_reply( req, data->Buffer, size );
191 if (!wine_server_call_err( req ))
193 if (!reply->total_size) retry = FALSE; /* no region at all */
194 else if (reply->total_size <= size)
196 size_t reply_size = wine_server_reply_size( reply );
197 data->rdh.dwSize = sizeof(data->rdh);
198 data->rdh.iType = RDH_RECTANGLES;
199 data->rdh.nCount = reply_size / sizeof(RECT);
200 data->rdh.nRgnSize = reply_size;
201 win_rgn = ExtCreateRegion( NULL, size, data );
202 retry = FALSE;
204 else
206 size = reply->total_size;
207 retry = TRUE;
211 SERVER_END_REQ;
212 HeapFree( GetProcessHeap(), 0, data );
213 } while (retry);
215 if (win_rgn)
217 nRet = CombineRgn( hrgn, win_rgn, 0, RGN_COPY );
218 DeleteObject( win_rgn );
220 return nRet;
224 /***********************************************************************
225 * SetWindowRgn (USER32.@)
227 int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
229 static const RECT empty_rect;
230 WND *wndPtr;
231 BOOL ret;
233 if (hrgn)
235 RGNDATA *data;
236 DWORD size;
238 if (!(size = GetRegionData( hrgn, 0, NULL ))) return FALSE;
239 if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
240 if (!GetRegionData( hrgn, size, data ))
242 HeapFree( GetProcessHeap(), 0, data );
243 return FALSE;
245 SERVER_START_REQ( set_window_region )
247 req->window = hwnd;
248 if (data->rdh.nCount)
249 wine_server_add_data( req, data->Buffer, data->rdh.nCount * sizeof(RECT) );
250 else
251 wine_server_add_data( req, &empty_rect, sizeof(empty_rect) );
252 ret = !wine_server_call_err( req );
254 SERVER_END_REQ;
256 else /* clear existing region */
258 SERVER_START_REQ( set_window_region )
260 req->window = hwnd;
261 ret = !wine_server_call_err( req );
263 SERVER_END_REQ;
266 if (!ret) return FALSE;
268 if ((wndPtr = WIN_GetPtr( hwnd )) == WND_OTHER_PROCESS)
270 if (IsWindow( hwnd ))
271 FIXME( "not properly supported on other process window %p\n", hwnd );
272 wndPtr = NULL;
274 if (!wndPtr)
276 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
277 return FALSE;
280 if (wndPtr->hrgnWnd == hrgn)
282 WIN_ReleasePtr( wndPtr );
283 return TRUE;
285 if (wndPtr->hrgnWnd)
287 /* delete previous region */
288 DeleteObject(wndPtr->hrgnWnd);
289 wndPtr->hrgnWnd = 0;
291 wndPtr->hrgnWnd = hrgn;
292 WIN_ReleasePtr( wndPtr );
294 if (USER_Driver.pSetWindowRgn)
295 ret = USER_Driver.pSetWindowRgn( hwnd, hrgn, bRedraw );
297 if (ret && bRedraw) RedrawWindow( hwnd, NULL, 0, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE );
298 return ret;
302 /***********************************************************************
303 * GetClientRect (USER32.@)
305 BOOL WINAPI GetClientRect( HWND hwnd, LPRECT rect )
307 BOOL ret;
309 rect->right = rect->bottom = 0;
310 if ((ret = WIN_GetRectangles( hwnd, NULL, rect )))
312 rect->right -= rect->left;
313 rect->bottom -= rect->top;
315 rect->left = rect->top = 0;
316 return ret;
320 /*******************************************************************
321 * ClientToScreen (USER32.@)
323 BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
325 MapWindowPoints( hwnd, 0, lppnt, 1 );
326 return TRUE;
330 /*******************************************************************
331 * ScreenToClient (USER32.@)
333 BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
335 MapWindowPoints( 0, hwnd, lppnt, 1 );
336 return TRUE;
340 /***********************************************************************
341 * find_child_from_point
343 * Find the child that contains pt. Helper for WindowFromPoint.
344 * pt is in parent client coordinates.
345 * lparam is the param to pass in the WM_NCHITTEST message.
347 static HWND find_child_from_point( HWND parent, POINT pt, INT *hittest, LPARAM lparam )
349 int i, res;
350 LONG style, exstyle;
351 RECT rectWindow, rectClient;
352 WND *wndPtr;
353 HWND *list = WIN_ListChildren( parent );
354 HWND retvalue = 0;
356 if (!list) return 0;
357 for (i = 0; list[i]; i++)
359 /* If point is in window, and window is visible, and it */
360 /* is enabled (or it's a top-level window), then explore */
361 /* its children. Otherwise, go to the next window. */
363 style = GetWindowLongW( list[i], GWL_STYLE );
364 if (!(style & WS_VISIBLE)) continue; /* not visible -> skip */
365 if ((style & (WS_POPUP | WS_CHILD | WS_DISABLED)) == (WS_CHILD | WS_DISABLED))
366 continue; /* disabled child -> skip */
367 exstyle = GetWindowLongW( list[i], GWL_EXSTYLE );
368 if ((exstyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) == (WS_EX_LAYERED | WS_EX_TRANSPARENT))
369 continue; /* transparent -> skip */
371 if (!WIN_GetRectangles( list[i], &rectWindow, &rectClient )) continue;
372 if (!PtInRect( &rectWindow, pt )) continue; /* not in window -> skip */
374 /* FIXME: check window region for other processes too */
375 if ((wndPtr = WIN_GetPtr( list[i] )) && wndPtr != WND_OTHER_PROCESS)
377 if (wndPtr->hrgnWnd && !PtInRegion( wndPtr->hrgnWnd,
378 pt.x - rectWindow.left, pt.y - rectWindow.top ))
380 WIN_ReleasePtr( wndPtr );
381 continue; /* point outside window region -> skip */
383 WIN_ReleasePtr( wndPtr );
386 /* If window is minimized or disabled, return at once */
387 if (style & WS_MINIMIZE)
389 *hittest = HTCAPTION;
390 retvalue = list[i];
391 break;
393 if (style & WS_DISABLED)
395 *hittest = HTERROR;
396 retvalue = list[i];
397 break;
400 /* If point is in client area, explore children */
401 if (PtInRect( &rectClient, pt ))
403 POINT new_pt;
405 new_pt.x = pt.x - rectClient.left;
406 new_pt.y = pt.y - rectClient.top;
407 if ((retvalue = find_child_from_point( list[i], new_pt, hittest, lparam ))) break;
410 /* Now it's inside window, send WM_NCCHITTEST (if same thread) */
411 if (!WIN_IsCurrentThread( list[i] ))
413 *hittest = HTCLIENT;
414 retvalue = list[i];
415 break;
417 if ((res = SendMessageA( list[i], WM_NCHITTEST, 0, lparam )) != HTTRANSPARENT)
419 *hittest = res; /* Found the window */
420 retvalue = list[i];
421 break;
423 /* continue search with next sibling */
425 HeapFree( GetProcessHeap(), 0, list );
426 return retvalue;
430 /***********************************************************************
431 * WINPOS_WindowFromPoint
433 * Find the window and hittest for a given point.
435 HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest )
437 POINT xy = pt;
438 int res;
439 LONG style;
441 TRACE("scope %p %ld,%ld\n", hwndScope, pt.x, pt.y);
443 if (!hwndScope) hwndScope = GetDesktopWindow();
444 style = GetWindowLongW( hwndScope, GWL_STYLE );
446 *hittest = HTERROR;
447 if (style & WS_DISABLED) return 0;
449 MapWindowPoints( GetDesktopWindow(), GetAncestor( hwndScope, GA_PARENT ), &xy, 1 );
451 if (!(style & WS_MINIMIZE))
453 RECT rectClient;
454 if (WIN_GetRectangles( hwndScope, NULL, &rectClient ) && PtInRect( &rectClient, xy ))
456 HWND ret;
458 xy.x -= rectClient.left;
459 xy.y -= rectClient.top;
460 if ((ret = find_child_from_point( hwndScope, xy, hittest, MAKELONG( pt.x, pt.y ) )))
462 TRACE( "found child %p\n", ret );
463 return ret;
468 /* If nothing found, try the scope window */
469 if (!WIN_IsCurrentThread( hwndScope ))
471 *hittest = HTCLIENT;
472 TRACE( "returning %p\n", hwndScope );
473 return hwndScope;
475 res = SendMessageA( hwndScope, WM_NCHITTEST, 0, MAKELONG( pt.x, pt.y ) );
476 if (res != HTTRANSPARENT)
478 *hittest = res; /* Found the window */
479 TRACE( "returning %p\n", hwndScope );
480 return hwndScope;
482 *hittest = HTNOWHERE;
483 TRACE( "nothing found\n" );
484 return 0;
488 /*******************************************************************
489 * WindowFromPoint (USER32.@)
491 HWND WINAPI WindowFromPoint( POINT pt )
493 INT hittest;
494 return WINPOS_WindowFromPoint( 0, pt, &hittest );
498 /*******************************************************************
499 * ChildWindowFromPoint (USER32.@)
501 HWND WINAPI ChildWindowFromPoint( HWND hwndParent, POINT pt )
503 return ChildWindowFromPointEx( hwndParent, pt, CWP_ALL );
506 /*******************************************************************
507 * ChildWindowFromPointEx (USER32.@)
509 HWND WINAPI ChildWindowFromPointEx( HWND hwndParent, POINT pt, UINT uFlags)
511 /* pt is in the client coordinates */
512 HWND *list;
513 int i;
514 RECT rect;
515 HWND retvalue;
517 GetClientRect( hwndParent, &rect );
518 if (!PtInRect( &rect, pt )) return 0;
519 if (!(list = WIN_ListChildren( hwndParent ))) return 0;
521 for (i = 0; list[i]; i++)
523 if (!WIN_GetRectangles( list[i], &rect, NULL )) continue;
524 if (!PtInRect( &rect, pt )) continue;
525 if (uFlags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED))
527 LONG style = GetWindowLongW( list[i], GWL_STYLE );
528 if ((uFlags & CWP_SKIPINVISIBLE) && !(style & WS_VISIBLE)) continue;
529 if ((uFlags & CWP_SKIPDISABLED) && (style & WS_DISABLED)) continue;
531 if (uFlags & CWP_SKIPTRANSPARENT)
533 if (GetWindowLongW( list[i], GWL_EXSTYLE ) & WS_EX_TRANSPARENT) continue;
535 break;
537 retvalue = list[i];
538 HeapFree( GetProcessHeap(), 0, list );
539 if (!retvalue) retvalue = hwndParent;
540 return retvalue;
544 /*******************************************************************
545 * WINPOS_GetWinOffset
547 * Calculate the offset between the origin of the two windows. Used
548 * to implement MapWindowPoints.
550 static void WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, POINT *offset )
552 WND * wndPtr;
554 offset->x = offset->y = 0;
556 /* Translate source window origin to screen coords */
557 if (hwndFrom)
559 HWND hwnd = hwndFrom;
561 while (hwnd)
563 if (hwnd == hwndTo) return;
564 if (!(wndPtr = WIN_GetPtr( hwnd )))
566 ERR( "bad hwndFrom = %p\n", hwnd );
567 return;
569 if (wndPtr == WND_OTHER_PROCESS) goto other_process;
570 offset->x += wndPtr->rectClient.left;
571 offset->y += wndPtr->rectClient.top;
572 hwnd = wndPtr->parent;
573 WIN_ReleasePtr( wndPtr );
577 /* Translate origin to destination window coords */
578 if (hwndTo)
580 HWND hwnd = hwndTo;
582 while (hwnd)
584 if (!(wndPtr = WIN_GetPtr( hwnd )))
586 ERR( "bad hwndTo = %p\n", hwnd );
587 return;
589 if (wndPtr == WND_OTHER_PROCESS) goto other_process;
590 offset->x -= wndPtr->rectClient.left;
591 offset->y -= wndPtr->rectClient.top;
592 hwnd = wndPtr->parent;
593 WIN_ReleasePtr( wndPtr );
596 return;
598 other_process: /* one of the parents may belong to another process, do it the hard way */
599 offset->x = offset->y = 0;
600 SERVER_START_REQ( get_windows_offset )
602 req->from = hwndFrom;
603 req->to = hwndTo;
604 if (!wine_server_call( req ))
606 offset->x = reply->x;
607 offset->y = reply->y;
610 SERVER_END_REQ;
614 /*******************************************************************
615 * MapWindowPoints (USER.258)
617 void WINAPI MapWindowPoints16( HWND16 hwndFrom, HWND16 hwndTo,
618 LPPOINT16 lppt, UINT16 count )
620 POINT offset;
622 WINPOS_GetWinOffset( WIN_Handle32(hwndFrom), WIN_Handle32(hwndTo), &offset );
623 while (count--)
625 lppt->x += offset.x;
626 lppt->y += offset.y;
627 lppt++;
632 /*******************************************************************
633 * MapWindowPoints (USER32.@)
635 INT WINAPI MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, UINT count )
637 POINT offset;
639 WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset );
640 while (count--)
642 lppt->x += offset.x;
643 lppt->y += offset.y;
644 lppt++;
646 return MAKELONG( LOWORD(offset.x), LOWORD(offset.y) );
650 /***********************************************************************
651 * IsIconic (USER32.@)
653 BOOL WINAPI IsIconic(HWND hWnd)
655 return (GetWindowLongW( hWnd, GWL_STYLE ) & WS_MINIMIZE) != 0;
659 /***********************************************************************
660 * IsZoomed (USER32.@)
662 BOOL WINAPI IsZoomed(HWND hWnd)
664 return (GetWindowLongW( hWnd, GWL_STYLE ) & WS_MAXIMIZE) != 0;
668 /*******************************************************************
669 * AllowSetForegroundWindow (USER32.@)
671 BOOL WINAPI AllowSetForegroundWindow( DWORD procid )
673 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
674 * implemented, then fix this function. */
675 return TRUE;
679 /*******************************************************************
680 * LockSetForegroundWindow (USER32.@)
682 BOOL WINAPI LockSetForegroundWindow( UINT lockcode )
684 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
685 * implemented, then fix this function. */
686 return TRUE;
690 /***********************************************************************
691 * BringWindowToTop (USER32.@)
693 BOOL WINAPI BringWindowToTop( HWND hwnd )
695 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
699 /***********************************************************************
700 * MoveWindow (USER32.@)
702 BOOL WINAPI MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
703 BOOL repaint )
705 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
706 if (!repaint) flags |= SWP_NOREDRAW;
707 TRACE("%p %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint );
708 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
711 /***********************************************************************
712 * WINPOS_InitInternalPos
714 static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT pt, const RECT *restoreRect )
716 LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( wnd->hwndSelf,
717 atomInternalPos );
718 if( !lpPos )
720 /* this happens when the window is minimized/maximized
721 * for the first time (rectWindow is not adjusted yet) */
723 lpPos = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNALPOS) );
724 if( !lpPos ) return NULL;
726 SetPropA( wnd->hwndSelf, atomInternalPos, (HANDLE)lpPos );
727 lpPos->hwndIconTitle = 0; /* defer until needs to be shown */
728 CONV_RECT32TO16( &wnd->rectWindow, &lpPos->rectNormal );
729 *(UINT*)&lpPos->ptIconPos = *(UINT*)&lpPos->ptMaxPos = 0xFFFFFFFF;
732 if( wnd->dwStyle & WS_MINIMIZE )
733 CONV_POINT32TO16( &pt, &lpPos->ptIconPos );
734 else if( wnd->dwStyle & WS_MAXIMIZE )
735 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
736 else if( restoreRect )
737 CONV_RECT32TO16( restoreRect, &lpPos->rectNormal );
739 return lpPos;
742 /***********************************************************************
743 * WINPOS_RedrawIconTitle
745 BOOL WINPOS_RedrawIconTitle( HWND hWnd )
747 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hWnd, atomInternalPos );
748 if( lpPos )
750 if( lpPos->hwndIconTitle )
752 SendMessageA( lpPos->hwndIconTitle, WM_SHOWWINDOW, TRUE, 0);
753 InvalidateRect( lpPos->hwndIconTitle, NULL, TRUE );
754 return TRUE;
757 return FALSE;
760 /***********************************************************************
761 * WINPOS_ShowIconTitle
763 BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow )
765 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
767 if( lpPos && !(GetWindowLongA( hwnd, GWL_EXSTYLE) & WS_EX_MANAGED))
769 HWND title = lpPos->hwndIconTitle;
771 TRACE("%p %i\n", hwnd, (bShow != 0) );
773 if( !title )
774 lpPos->hwndIconTitle = title = ICONTITLE_Create( hwnd );
775 if( bShow )
777 if (!IsWindowVisible(title))
779 SendMessageA( title, WM_SHOWWINDOW, TRUE, 0 );
780 SetWindowPos( title, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
781 SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
784 else ShowWindow( title, SW_HIDE );
786 return FALSE;
789 /*******************************************************************
790 * WINPOS_GetMinMaxInfo
792 * Get the minimized and maximized information for a window.
794 void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
795 POINT *minTrack, POINT *maxTrack )
797 LPINTERNALPOS lpPos;
798 MINMAXINFO MinMax;
799 INT xinc, yinc;
800 LONG style = GetWindowLongA( hwnd, GWL_STYLE );
801 LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
802 RECT rc;
804 /* Compute default values */
806 GetWindowRect(hwnd, &rc);
807 MinMax.ptReserved.x = rc.left;
808 MinMax.ptReserved.y = rc.top;
810 if (style & WS_CHILD)
812 if ((style & WS_CAPTION) == WS_CAPTION)
813 style &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
815 GetClientRect(GetParent(hwnd), &rc);
816 AdjustWindowRectEx(&rc, style, 0, exstyle);
818 /* avoid calculating this twice */
819 style &= ~(WS_DLGFRAME | WS_BORDER | WS_THICKFRAME);
821 MinMax.ptMaxSize.x = rc.right - rc.left;
822 MinMax.ptMaxSize.y = rc.bottom - rc.top;
824 else
826 MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);
827 MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);
829 MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
830 MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
831 MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
832 MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
834 if (HAS_DLGFRAME( style, exstyle ))
836 xinc = GetSystemMetrics(SM_CXDLGFRAME);
837 yinc = GetSystemMetrics(SM_CYDLGFRAME);
839 else
841 xinc = yinc = 0;
842 if (HAS_THICKFRAME(style))
844 xinc += GetSystemMetrics(SM_CXFRAME);
845 yinc += GetSystemMetrics(SM_CYFRAME);
847 if (style & WS_BORDER)
849 xinc += GetSystemMetrics(SM_CXBORDER);
850 yinc += GetSystemMetrics(SM_CYBORDER);
853 MinMax.ptMaxSize.x += 2 * xinc;
854 MinMax.ptMaxSize.y += 2 * yinc;
856 lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
857 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
858 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
859 else
861 MinMax.ptMaxPosition.x = -xinc;
862 MinMax.ptMaxPosition.y = -yinc;
865 SendMessageA( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
867 /* Some sanity checks */
869 TRACE("%ld %ld / %ld %ld / %ld %ld / %ld %ld\n",
870 MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,
871 MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
872 MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
873 MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y);
874 MinMax.ptMaxTrackSize.x = max( MinMax.ptMaxTrackSize.x,
875 MinMax.ptMinTrackSize.x );
876 MinMax.ptMaxTrackSize.y = max( MinMax.ptMaxTrackSize.y,
877 MinMax.ptMinTrackSize.y );
879 if (maxSize) *maxSize = MinMax.ptMaxSize;
880 if (maxPos) *maxPos = MinMax.ptMaxPosition;
881 if (minTrack) *minTrack = MinMax.ptMinTrackSize;
882 if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize;
885 /***********************************************************************
886 * ShowWindowAsync (USER32.@)
888 * doesn't wait; returns immediately.
889 * used by threads to toggle windows in other (possibly hanging) threads
891 BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd )
893 HWND full_handle;
895 if (is_broadcast(hwnd))
897 SetLastError( ERROR_INVALID_PARAMETER );
898 return FALSE;
901 if ((full_handle = WIN_IsCurrentThread( hwnd )))
902 return USER_Driver.pShowWindow( full_handle, cmd );
903 return SendNotifyMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
907 /***********************************************************************
908 * ShowWindow (USER32.@)
910 BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
912 HWND full_handle;
914 if (is_broadcast(hwnd))
916 SetLastError( ERROR_INVALID_PARAMETER );
917 return FALSE;
919 if ((full_handle = WIN_IsCurrentThread( hwnd )))
921 if (USER_Driver.pShowWindow)
922 return USER_Driver.pShowWindow( full_handle, cmd );
923 return FALSE;
925 return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
929 /***********************************************************************
930 * GetInternalWindowPos (USER32.@)
932 UINT WINAPI GetInternalWindowPos( HWND hwnd, LPRECT rectWnd,
933 LPPOINT ptIcon )
935 WINDOWPLACEMENT wndpl;
936 if (GetWindowPlacement( hwnd, &wndpl ))
938 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
939 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
940 return wndpl.showCmd;
942 return 0;
946 /***********************************************************************
947 * GetWindowPlacement (USER32.@)
949 * Win95:
950 * Fails if wndpl->length of Win95 (!) apps is invalid.
952 BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
954 WND *pWnd = WIN_FindWndPtr( hwnd );
955 LPINTERNALPOS lpPos;
957 if(!pWnd ) return FALSE;
959 lpPos = WINPOS_InitInternalPos( pWnd, *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
960 wndpl->length = sizeof(*wndpl);
961 if( pWnd->dwStyle & WS_MINIMIZE )
962 wndpl->showCmd = SW_SHOWMINIMIZED;
963 else
964 wndpl->showCmd = ( pWnd->dwStyle & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
965 if( pWnd->flags & WIN_RESTORE_MAX )
966 wndpl->flags = WPF_RESTORETOMAXIMIZED;
967 else
968 wndpl->flags = 0;
969 CONV_POINT16TO32( &lpPos->ptIconPos, &wndpl->ptMinPosition );
970 CONV_POINT16TO32( &lpPos->ptMaxPos, &wndpl->ptMaxPosition );
971 CONV_RECT16TO32( &lpPos->rectNormal, &wndpl->rcNormalPosition );
972 WIN_ReleaseWndPtr(pWnd);
973 return TRUE;
977 /***********************************************************************
978 * WINPOS_SetPlacement
980 static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT flags )
982 WND *pWnd = WIN_FindWndPtr( hwnd );
983 if( pWnd )
985 LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
986 *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
988 if( flags & PLACE_MIN ) CONV_POINT32TO16( &wndpl->ptMinPosition, &lpPos->ptIconPos );
989 if( flags & PLACE_MAX ) CONV_POINT32TO16( &wndpl->ptMaxPosition, &lpPos->ptMaxPos );
990 if( flags & PLACE_RECT) CONV_RECT32TO16( &wndpl->rcNormalPosition, &lpPos->rectNormal );
992 if( pWnd->dwStyle & WS_MINIMIZE )
994 WINPOS_ShowIconTitle( pWnd->hwndSelf, FALSE );
995 if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
996 SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
997 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
999 else if( pWnd->dwStyle & WS_MAXIMIZE )
1001 if( !EMPTYPOINT(lpPos->ptMaxPos) )
1002 SetWindowPos( hwnd, 0, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
1003 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
1005 else if( flags & PLACE_RECT )
1006 SetWindowPos( hwnd, 0, lpPos->rectNormal.left, lpPos->rectNormal.top,
1007 lpPos->rectNormal.right - lpPos->rectNormal.left,
1008 lpPos->rectNormal.bottom - lpPos->rectNormal.top,
1009 SWP_NOZORDER | SWP_NOACTIVATE );
1011 ShowWindow( hwnd, wndpl->showCmd );
1012 if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
1014 if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd->hwndSelf, TRUE );
1016 /* SDK: ...valid only the next time... */
1017 if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
1019 WIN_ReleaseWndPtr(pWnd);
1020 return TRUE;
1022 return FALSE;
1026 /***********************************************************************
1027 * SetWindowPlacement (USER32.@)
1029 * Win95:
1030 * Fails if wndpl->length of Win95 (!) apps is invalid.
1032 BOOL WINAPI SetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *wpl )
1034 if (!wpl) return FALSE;
1035 return WINPOS_SetPlacement( hwnd, wpl, PLACE_MIN | PLACE_MAX | PLACE_RECT );
1039 /***********************************************************************
1040 * AnimateWindow (USER32.@)
1041 * Shows/Hides a window with an animation
1042 * NO ANIMATION YET
1044 BOOL WINAPI AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags)
1046 FIXME("partial stub\n");
1048 /* If trying to show/hide and it's already *
1049 * shown/hidden or invalid window, fail with *
1050 * invalid parameter */
1051 if(!IsWindow(hwnd) ||
1052 (IsWindowVisible(hwnd) && !(dwFlags & AW_HIDE)) ||
1053 (!IsWindowVisible(hwnd) && (dwFlags & AW_HIDE)))
1055 SetLastError(ERROR_INVALID_PARAMETER);
1056 return FALSE;
1059 ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
1061 return TRUE;
1064 /***********************************************************************
1065 * SetInternalWindowPos (USER32.@)
1067 void WINAPI SetInternalWindowPos( HWND hwnd, UINT showCmd,
1068 LPRECT rect, LPPOINT pt )
1070 if( IsWindow(hwnd) )
1072 WINDOWPLACEMENT wndpl;
1073 UINT flags;
1075 wndpl.length = sizeof(wndpl);
1076 wndpl.showCmd = showCmd;
1077 wndpl.flags = flags = 0;
1079 if( pt )
1081 flags |= PLACE_MIN;
1082 wndpl.flags |= WPF_SETMINPOSITION;
1083 wndpl.ptMinPosition = *pt;
1085 if( rect )
1087 flags |= PLACE_RECT;
1088 wndpl.rcNormalPosition = *rect;
1090 WINPOS_SetPlacement( hwnd, &wndpl, flags );
1095 /*******************************************************************
1096 * can_activate_window
1098 * Check if we can activate the specified window.
1100 static BOOL can_activate_window( HWND hwnd )
1102 LONG style;
1104 if (!hwnd) return FALSE;
1105 style = GetWindowLongW( hwnd, GWL_STYLE );
1106 if (!(style & WS_VISIBLE)) return FALSE;
1107 if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
1108 return !(style & WS_DISABLED);
1112 /*******************************************************************
1113 * WINPOS_ActivateOtherWindow
1115 * Activates window other than pWnd.
1117 void WINPOS_ActivateOtherWindow(HWND hwnd)
1119 HWND hwndTo, fg;
1121 if ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo = GetWindow( hwnd, GW_OWNER )))
1123 hwndTo = GetAncestor( hwndTo, GA_ROOT );
1124 if (can_activate_window( hwndTo )) goto done;
1127 hwndTo = hwnd;
1128 for (;;)
1130 if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
1131 if (can_activate_window( hwndTo )) break;
1134 done:
1135 fg = GetForegroundWindow();
1136 TRACE("win = %p fg = %p\n", hwndTo, fg);
1137 if (!fg || (hwnd == fg))
1139 if (SetForegroundWindow( hwndTo )) return;
1141 if (!SetActiveWindow( hwndTo )) SetActiveWindow(0);
1145 /***********************************************************************
1146 * WINPOS_HandleWindowPosChanging16
1148 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1150 LONG WINPOS_HandleWindowPosChanging16( HWND hwnd, WINDOWPOS16 *winpos )
1152 POINT minTrack, maxTrack;
1153 LONG style = GetWindowLongW( hwnd, GWL_STYLE );
1155 if (winpos->flags & SWP_NOSIZE) return 0;
1156 if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
1158 WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
1159 if (winpos->cx > maxTrack.x) winpos->cx = maxTrack.x;
1160 if (winpos->cy > maxTrack.y) winpos->cy = maxTrack.y;
1161 if (!(style & WS_MINIMIZE))
1163 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1164 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1167 return 0;
1171 /***********************************************************************
1172 * WINPOS_HandleWindowPosChanging
1174 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1176 LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos )
1178 POINT minTrack, maxTrack;
1179 LONG style = GetWindowLongW( hwnd, GWL_STYLE );
1181 if (winpos->flags & SWP_NOSIZE) return 0;
1182 if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
1184 WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
1185 if (winpos->cx > maxTrack.x) winpos->cx = maxTrack.x;
1186 if (winpos->cy > maxTrack.y) winpos->cy = maxTrack.y;
1187 if (!(style & WS_MINIMIZE))
1189 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1190 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1193 return 0;
1197 /***********************************************************************
1198 * dump_winpos_flags
1200 static void dump_winpos_flags(UINT flags)
1202 TRACE("flags:");
1203 if(flags & SWP_NOSIZE) TRACE(" SWP_NOSIZE");
1204 if(flags & SWP_NOMOVE) TRACE(" SWP_NOMOVE");
1205 if(flags & SWP_NOZORDER) TRACE(" SWP_NOZORDER");
1206 if(flags & SWP_NOREDRAW) TRACE(" SWP_NOREDRAW");
1207 if(flags & SWP_NOACTIVATE) TRACE(" SWP_NOACTIVATE");
1208 if(flags & SWP_FRAMECHANGED) TRACE(" SWP_FRAMECHANGED");
1209 if(flags & SWP_SHOWWINDOW) TRACE(" SWP_SHOWWINDOW");
1210 if(flags & SWP_HIDEWINDOW) TRACE(" SWP_HIDEWINDOW");
1211 if(flags & SWP_NOCOPYBITS) TRACE(" SWP_NOCOPYBITS");
1212 if(flags & SWP_NOOWNERZORDER) TRACE(" SWP_NOOWNERZORDER");
1213 if(flags & SWP_NOSENDCHANGING) TRACE(" SWP_NOSENDCHANGING");
1214 if(flags & SWP_DEFERERASE) TRACE(" SWP_DEFERERASE");
1215 if(flags & SWP_ASYNCWINDOWPOS) TRACE(" SWP_ASYNCWINDOWPOS");
1217 #define DUMPED_FLAGS \
1218 (SWP_NOSIZE | \
1219 SWP_NOMOVE | \
1220 SWP_NOZORDER | \
1221 SWP_NOREDRAW | \
1222 SWP_NOACTIVATE | \
1223 SWP_FRAMECHANGED | \
1224 SWP_SHOWWINDOW | \
1225 SWP_HIDEWINDOW | \
1226 SWP_NOCOPYBITS | \
1227 SWP_NOOWNERZORDER | \
1228 SWP_NOSENDCHANGING | \
1229 SWP_DEFERERASE | \
1230 SWP_ASYNCWINDOWPOS)
1232 if(flags & ~DUMPED_FLAGS) TRACE(" %08x", flags & ~DUMPED_FLAGS);
1233 TRACE("\n");
1234 #undef DUMPED_FLAGS
1237 /***********************************************************************
1238 * SetWindowPos (USER32.@)
1240 BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
1241 INT x, INT y, INT cx, INT cy, UINT flags )
1243 WINDOWPOS winpos;
1245 TRACE("hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
1246 hwnd, hwndInsertAfter, x, y, cx, cy, flags);
1247 if(TRACE_ON(win)) dump_winpos_flags(flags);
1249 if (is_broadcast(hwnd))
1251 SetLastError( ERROR_INVALID_PARAMETER );
1252 return FALSE;
1255 winpos.hwnd = WIN_GetFullHandle(hwnd);
1256 winpos.hwndInsertAfter = WIN_GetFullHandle(hwndInsertAfter);
1257 winpos.x = x;
1258 winpos.y = y;
1259 winpos.cx = cx;
1260 winpos.cy = cy;
1261 winpos.flags = flags;
1262 if (WIN_IsCurrentThread( hwnd )) return USER_Driver.pSetWindowPos( &winpos );
1263 return SendMessageW( winpos.hwnd, WM_WINE_SETWINDOWPOS, 0, (LPARAM)&winpos );
1267 /***********************************************************************
1268 * BeginDeferWindowPos (USER32.@)
1270 HDWP WINAPI BeginDeferWindowPos( INT count )
1272 HDWP handle;
1273 DWP *pDWP;
1275 TRACE("%d\n", count);
1277 if (count < 0)
1279 SetLastError(ERROR_INVALID_PARAMETER);
1280 return 0;
1282 /* Windows allows zero count, in which case it allocates context for 8 moves */
1283 if (count == 0) count = 8;
1285 handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
1286 if (!handle) return 0;
1287 pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle );
1288 pDWP->actualCount = 0;
1289 pDWP->suggestedCount = count;
1290 pDWP->valid = TRUE;
1291 pDWP->wMagic = DWP_MAGIC;
1292 pDWP->hwndParent = 0;
1294 TRACE("returning hdwp %p\n", handle);
1295 return handle;
1299 /***********************************************************************
1300 * DeferWindowPos (USER32.@)
1302 HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
1303 INT x, INT y, INT cx, INT cy,
1304 UINT flags )
1306 DWP *pDWP;
1307 int i;
1308 HDWP newhdwp = hdwp,retvalue;
1310 TRACE("hdwp %p, hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
1311 hdwp, hwnd, hwndAfter, x, y, cx, cy, flags);
1313 hwnd = WIN_GetFullHandle( hwnd );
1314 if (hwnd == GetDesktopWindow()) return 0;
1316 if (!(pDWP = USER_HEAP_LIN_ADDR( hdwp ))) return 0;
1318 USER_Lock();
1320 for (i = 0; i < pDWP->actualCount; i++)
1322 if (pDWP->winPos[i].hwnd == hwnd)
1324 /* Merge with the other changes */
1325 if (!(flags & SWP_NOZORDER))
1327 pDWP->winPos[i].hwndInsertAfter = WIN_GetFullHandle(hwndAfter);
1329 if (!(flags & SWP_NOMOVE))
1331 pDWP->winPos[i].x = x;
1332 pDWP->winPos[i].y = y;
1334 if (!(flags & SWP_NOSIZE))
1336 pDWP->winPos[i].cx = cx;
1337 pDWP->winPos[i].cy = cy;
1339 pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
1340 SWP_NOZORDER | SWP_NOREDRAW |
1341 SWP_NOACTIVATE | SWP_NOCOPYBITS|
1342 SWP_NOOWNERZORDER);
1343 pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
1344 SWP_FRAMECHANGED);
1345 retvalue = hdwp;
1346 goto END;
1349 if (pDWP->actualCount >= pDWP->suggestedCount)
1351 newhdwp = USER_HEAP_REALLOC( hdwp,
1352 sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS) );
1353 if (!newhdwp)
1355 retvalue = 0;
1356 goto END;
1358 pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp );
1359 pDWP->suggestedCount++;
1361 pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
1362 pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
1363 pDWP->winPos[pDWP->actualCount].x = x;
1364 pDWP->winPos[pDWP->actualCount].y = y;
1365 pDWP->winPos[pDWP->actualCount].cx = cx;
1366 pDWP->winPos[pDWP->actualCount].cy = cy;
1367 pDWP->winPos[pDWP->actualCount].flags = flags;
1368 pDWP->actualCount++;
1369 retvalue = newhdwp;
1370 END:
1371 USER_Unlock();
1372 return retvalue;
1376 /***********************************************************************
1377 * EndDeferWindowPos (USER32.@)
1379 BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
1381 DWP *pDWP;
1382 WINDOWPOS *winpos;
1383 BOOL res = TRUE;
1384 int i;
1386 TRACE("%p\n", hdwp);
1388 pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
1389 if (!pDWP) return FALSE;
1390 for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
1392 if (!(res = USER_Driver.pSetWindowPos( winpos ))) break;
1394 USER_HEAP_FREE( hdwp );
1395 return res;
1399 /***********************************************************************
1400 * TileChildWindows (USER.199)
1402 void WINAPI TileChildWindows16( HWND16 parent, WORD action )
1404 FIXME("(%04x, %d): stub\n", parent, action);
1407 /***********************************************************************
1408 * CascadeChildWindows (USER.198)
1410 void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
1412 FIXME("(%04x, %d): stub\n", parent, action);