blob: 98871797ed583b49f6bef1ddbeac2a136e3b7fff [file] [log] [blame]
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001/*
2 * Window position related functions.
3 *
Alexandre Julliard22945d51995-03-02 17:44:29 +00004 * Copyright 1993, 1994, 1995 Alexandre Julliard
Alex Korobka4f1ac051999-03-28 09:37:57 +00005 * 1995, 1996, 1999 Alex Korobka
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00006 *
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.
11 *
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.
16 *
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
Alexandre Julliard5f721f81994-01-04 20:14:34 +000020 */
21
Alexandre Julliarddadf78f1998-05-17 17:13:43 +000022#include <string.h>
Francois Jacques5b6879c2000-07-28 23:04:54 +000023#include "winerror.h"
Jeremy Whited3e22d92000-02-10 19:03:02 +000024#include "windef.h"
25#include "wingdi.h"
Slava Monichcdbe6442000-07-08 12:44:09 +000026#include "winerror.h"
Michael Veksler9d14a001999-05-08 12:40:24 +000027#include "wine/winuser16.h"
Alexandre Julliardfb0ff052001-10-16 21:58:58 +000028#include "wine/server.h"
Alexandre Julliard91222da2000-12-10 23:01:33 +000029#include "controls.h"
Alexandre Julliarddba420a1994-02-02 06:48:31 +000030#include "user.h"
Alexandre Julliard5f721f81994-01-04 20:14:34 +000031#include "win.h"
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000032#include "message.h"
Alexandre Julliardaca05781994-10-17 18:12:41 +000033#include "winpos.h"
Alexandre Julliard22945d51995-03-02 17:44:29 +000034#include "nonclient.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000035#include "wine/debug.h"
Alexandre Julliard5f721f81994-01-04 20:14:34 +000036
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000037WINE_DEFAULT_DEBUG_CHANNEL(win);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000038
Alexandre Julliard23946ad1997-06-16 17:43:53 +000039#define HAS_DLGFRAME(style,exStyle) \
40 (((exStyle) & WS_EX_DLGMODALFRAME) || \
41 (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
42
43#define HAS_THICKFRAME(style) \
44 (((style) & WS_THICKFRAME) && \
45 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
46
Alexandre Julliard23946ad1997-06-16 17:43:53 +000047#define EMPTYPOINT(pt) ((*(LONG*)&(pt)) == -1)
48
49#define PLACE_MIN 0x0001
50#define PLACE_MAX 0x0002
51#define PLACE_RECT 0x0004
52
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +000053
54#define DWP_MAGIC ((INT)('W' | ('P' << 8) | ('O' << 16) | ('S' << 24)))
55
56typedef struct
57{
58 INT actualCount;
59 INT suggestedCount;
60 BOOL valid;
61 INT wMagic;
62 HWND hwndParent;
63 WINDOWPOS winPos[1];
64} DWP;
65
Alexandre Julliardd4719651995-12-12 18:49:11 +000066/* ----- internal variables ----- */
67
Alexandre Julliarda3960291999-02-26 11:11:13 +000068static HWND hGlobalShellWindow=0; /*the shell*/
Juergen Schmiedddb2e291999-05-02 09:19:19 +000069static HWND hGlobalTaskmanWindow=0;
70static HWND hGlobalProgmanWindow=0;
Alexandre Julliardd4719651995-12-12 18:49:11 +000071
Alexandre Julliard23946ad1997-06-16 17:43:53 +000072static LPCSTR atomInternalPos;
73
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +000074
75/***********************************************************************
Alexandre Julliard23946ad1997-06-16 17:43:53 +000076 * WINPOS_CreateInternalPosAtom
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +000077 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000078BOOL WINPOS_CreateInternalPosAtom()
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +000079{
Alexandre Julliard23946ad1997-06-16 17:43:53 +000080 LPSTR str = "SysIP";
Alexandre Julliarda3960291999-02-26 11:11:13 +000081 atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str);
Alexandre Julliard23946ad1997-06-16 17:43:53 +000082 return (atomInternalPos) ? TRUE : FALSE;
83}
84
85/***********************************************************************
86 * WINPOS_CheckInternalPos
87 *
88 * Called when a window is destroyed.
89 */
Alexandre Julliardde424282001-08-10 22:51:42 +000090void WINPOS_CheckInternalPos( HWND hwnd )
Alexandre Julliard23946ad1997-06-16 17:43:53 +000091{
Alexandre Julliard5030bda2002-10-11 23:41:06 +000092 LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
Alexandre Julliard23946ad1997-06-16 17:43:53 +000093
94 if( lpPos )
95 {
Vincent Béron9a624912002-05-31 23:06:46 +000096 if( IsWindow(lpPos->hwndIconTitle) )
Alexandre Julliarda3960291999-02-26 11:11:13 +000097 DestroyWindow( lpPos->hwndIconTitle );
Alexandre Julliardda2892c2001-02-23 01:13:42 +000098 HeapFree( GetProcessHeap(), 0, lpPos );
Alexandre Julliard23946ad1997-06-16 17:43:53 +000099 }
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +0000100}
101
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000102/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000103 * ArrangeIconicWindows (USER32.@)
Alexandre Julliard22945d51995-03-02 17:44:29 +0000104 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000105UINT WINAPI ArrangeIconicWindows( HWND parent )
Alexandre Julliard22945d51995-03-02 17:44:29 +0000106{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000107 RECT rectParent;
108 HWND hwndChild;
109 INT x, y, xspacing, yspacing;
Alexandre Julliard22945d51995-03-02 17:44:29 +0000110
Alexandre Julliarda3960291999-02-26 11:11:13 +0000111 GetClientRect( parent, &rectParent );
Alexandre Julliard22945d51995-03-02 17:44:29 +0000112 x = rectParent.left;
113 y = rectParent.bottom;
Marcus Meissnerddca3151999-05-22 11:33:23 +0000114 xspacing = GetSystemMetrics(SM_CXICONSPACING);
115 yspacing = GetSystemMetrics(SM_CYICONSPACING);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000116
Alexandre Julliarda3960291999-02-26 11:11:13 +0000117 hwndChild = GetWindow( parent, GW_CHILD );
Alexandre Julliard22945d51995-03-02 17:44:29 +0000118 while (hwndChild)
119 {
Alexandre Julliarda3960291999-02-26 11:11:13 +0000120 if( IsIconic( hwndChild ) )
Alexandre Julliard22945d51995-03-02 17:44:29 +0000121 {
Alexandre Julliardde424282001-08-10 22:51:42 +0000122 WINPOS_ShowIconTitle( hwndChild, FALSE );
123
Marcus Meissnerddca3151999-05-22 11:33:23 +0000124 SetWindowPos( hwndChild, 0, x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
125 y - yspacing - GetSystemMetrics(SM_CYICON)/2, 0, 0,
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000126 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000127 if( IsWindow(hwndChild) )
Alexandre Julliardde424282001-08-10 22:51:42 +0000128 WINPOS_ShowIconTitle(hwndChild , TRUE );
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000129
Alexandre Julliard22945d51995-03-02 17:44:29 +0000130 if (x <= rectParent.right - xspacing) x += xspacing;
131 else
132 {
133 x = rectParent.left;
134 y -= yspacing;
135 }
136 }
Alexandre Julliarda3960291999-02-26 11:11:13 +0000137 hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
Alexandre Julliard22945d51995-03-02 17:44:29 +0000138 }
139 return yspacing;
140}
141
142
143/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000144 * SwitchToThisWindow (USER32.@)
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000145 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000146void WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000147{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000148 ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000149}
150
151
152/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000153 * GetWindowRect (USER32.@)
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000154 */
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000155BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000156{
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000157 BOOL ret = WIN_GetRectangles( hwnd, rect, NULL );
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000158 if (ret)
159 {
160 MapWindowPoints( GetAncestor( hwnd, GA_PARENT ), 0, (POINT *)rect, 2 );
Dan Kegel0fd521f2003-01-08 21:09:25 +0000161 TRACE( "hwnd %p (%ld,%ld)-(%ld,%ld)\n",
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000162 hwnd, rect->left, rect->top, rect->right, rect->bottom);
163 }
164 return ret;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000165}
166
167
168/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000169 * GetWindowRgn (USER32.@)
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000170 */
Francois Jacques5b6879c2000-07-28 23:04:54 +0000171int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000172{
Francois Jacques5b6879c2000-07-28 23:04:54 +0000173 int nRet = ERROR;
Alexandre Julliardddc33172001-10-22 19:08:33 +0000174 WND *wndPtr = WIN_GetPtr( hwnd );
175
176 if (wndPtr == WND_OTHER_PROCESS)
Francois Jacques5b6879c2000-07-28 23:04:54 +0000177 {
Alexandre Julliardddc33172001-10-22 19:08:33 +0000178 if (IsWindow( hwnd ))
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000179 FIXME( "not supported on other process window %p\n", hwnd );
Alexandre Julliardddc33172001-10-22 19:08:33 +0000180 wndPtr = NULL;
Francois Jacques5b6879c2000-07-28 23:04:54 +0000181 }
Alexandre Julliardddc33172001-10-22 19:08:33 +0000182 if (!wndPtr)
183 {
184 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
185 return ERROR;
186 }
187 if (wndPtr->hrgnWnd) nRet = CombineRgn( hrgn, wndPtr->hrgnWnd, 0, RGN_COPY );
188 WIN_ReleasePtr( wndPtr );
Francois Jacques5b6879c2000-07-28 23:04:54 +0000189 return nRet;
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000190}
191
Alexandre Julliardddc33172001-10-22 19:08:33 +0000192
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000193/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000194 * SetWindowRgn (USER32.@)
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000195 */
Francois Jacques5b6879c2000-07-28 23:04:54 +0000196int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000197{
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +0000198 RECT rect;
199 WND *wndPtr;
Alexandre Julliardddc33172001-10-22 19:08:33 +0000200
201 if (hrgn) /* verify that region really exists */
202 {
203 if (GetRgnBox( hrgn, &rect ) == ERROR) return FALSE;
204 }
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000205
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +0000206 if (USER_Driver.pSetWindowRgn)
207 return USER_Driver.pSetWindowRgn( hwnd, hrgn, bRedraw );
Francois Jacques5b6879c2000-07-28 23:04:54 +0000208
Alexandre Julliardddc33172001-10-22 19:08:33 +0000209 if ((wndPtr = WIN_GetPtr( hwnd )) == WND_OTHER_PROCESS)
210 {
211 if (IsWindow( hwnd ))
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000212 FIXME( "not supported on other process window %p\n", hwnd );
Alexandre Julliardddc33172001-10-22 19:08:33 +0000213 wndPtr = NULL;
214 }
215 if (!wndPtr)
216 {
217 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
218 return FALSE;
219 }
Francois Jacques5b6879c2000-07-28 23:04:54 +0000220
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +0000221 if (wndPtr->hrgnWnd == hrgn)
Francois Jacques5b6879c2000-07-28 23:04:54 +0000222 {
Alexandre Julliardddc33172001-10-22 19:08:33 +0000223 WIN_ReleasePtr( wndPtr );
224 return TRUE;
Francois Jacques5b6879c2000-07-28 23:04:54 +0000225 }
226
James Hatheway34899972000-09-12 23:59:57 +0000227 if (wndPtr->hrgnWnd)
228 {
229 /* delete previous region */
230 DeleteObject(wndPtr->hrgnWnd);
231 wndPtr->hrgnWnd = 0;
232 }
James Hatheway34899972000-09-12 23:59:57 +0000233 wndPtr->hrgnWnd = hrgn;
Alexandre Julliardddc33172001-10-22 19:08:33 +0000234 WIN_ReleasePtr( wndPtr );
Francois Jacques5b6879c2000-07-28 23:04:54 +0000235
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +0000236 /* Size the window to the rectangle of the new region (if it isn't NULL) */
237 if (hrgn) SetWindowPos( hwnd, 0, rect.left, rect.top,
238 rect.right - rect.left, rect.bottom - rect.top,
239 SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOACTIVATE |
240 SWP_NOZORDER | (bRedraw ? 0 : SWP_NOREDRAW) );
Alexandre Julliardddc33172001-10-22 19:08:33 +0000241 return TRUE;
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000242}
243
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000244
245/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000246 * GetClientRect (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000247 */
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000248BOOL WINAPI GetClientRect( HWND hwnd, LPRECT rect )
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000249{
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000250 BOOL ret;
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000251
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000252 rect->right = rect->bottom = 0;
253 if ((ret = WIN_GetRectangles( hwnd, NULL, rect )))
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000254 {
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000255 rect->right -= rect->left;
256 rect->bottom -= rect->top;
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000257 }
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000258 rect->left = rect->top = 0;
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000259 return ret;
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000260}
261
262
263/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000264 * ClientToScreen (USER32.@)
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000265 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000266BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000267{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000268 MapWindowPoints( hwnd, 0, lppnt, 1 );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000269 return TRUE;
270}
271
272
273/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000274 * ScreenToClient (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000275 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000276BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000277{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000278 MapWindowPoints( 0, hwnd, lppnt, 1 );
Eric Pouechb9544f11999-02-14 14:09:42 +0000279 return TRUE;
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000280}
281
282
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000283/***********************************************************************
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000284 * find_child_from_point
285 *
286 * Find the child that contains pt. Helper for WindowFromPoint.
287 * pt is in parent client coordinates.
288 * lparam is the param to pass in the WM_NCHITTEST message.
289 */
290static HWND find_child_from_point( HWND parent, POINT pt, INT *hittest, LPARAM lparam )
291{
292 int i, res;
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000293 LONG style, exstyle;
294 RECT rectWindow, rectClient;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000295 WND *wndPtr;
296 HWND *list = WIN_ListChildren( parent );
Andreas Mohr284bcfc2002-05-28 22:47:01 +0000297 HWND retvalue = 0;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000298
299 if (!list) return 0;
300 for (i = 0; list[i]; i++)
301 {
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000302 /* If point is in window, and window is visible, and it */
303 /* is enabled (or it's a top-level window), then explore */
304 /* its children. Otherwise, go to the next window. */
305
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000306 style = GetWindowLongW( list[i], GWL_STYLE );
307 if (!(style & WS_VISIBLE)) continue; /* not visible -> skip */
308 if ((style & (WS_POPUP | WS_CHILD | WS_DISABLED)) == (WS_CHILD | WS_DISABLED))
309 continue; /* disabled child -> skip */
310 exstyle = GetWindowLongW( list[i], GWL_EXSTYLE );
311 if ((exstyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) == (WS_EX_LAYERED | WS_EX_TRANSPARENT))
312 continue; /* transparent -> skip */
313
314 if (!WIN_GetRectangles( list[i], &rectWindow, &rectClient )) continue;
315 if (!PtInRect( &rectWindow, pt )) continue; /* not in window -> skip */
316
317 /* FIXME: check window region for other processes too */
318 if ((wndPtr = WIN_GetPtr( list[i] )) && wndPtr != WND_OTHER_PROCESS)
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000319 {
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000320 if (wndPtr->hrgnWnd && !PtInRegion( wndPtr->hrgnWnd,
321 pt.x - rectWindow.left, pt.y - rectWindow.top ))
322 {
323 WIN_ReleasePtr( wndPtr );
324 continue; /* point outside window region -> skip */
325 }
326 WIN_ReleasePtr( wndPtr );
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000327 }
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000328
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000329 /* If window is minimized or disabled, return at once */
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000330 if (style & WS_MINIMIZE)
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000331 {
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000332 *hittest = HTCAPTION;
Andreas Mohr284bcfc2002-05-28 22:47:01 +0000333 retvalue = list[i];
334 break;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000335 }
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000336 if (style & WS_DISABLED)
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000337 {
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000338 *hittest = HTERROR;
Andreas Mohr284bcfc2002-05-28 22:47:01 +0000339 retvalue = list[i];
340 break;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000341 }
342
343 /* If point is in client area, explore children */
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000344 if (PtInRect( &rectClient, pt ))
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000345 {
346 POINT new_pt;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000347
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000348 new_pt.x = pt.x - rectClient.left;
349 new_pt.y = pt.y - rectClient.top;
Andreas Mohr284bcfc2002-05-28 22:47:01 +0000350 if ((retvalue = find_child_from_point( list[i], new_pt, hittest, lparam ))) break;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000351 }
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000352
353 /* Now it's inside window, send WM_NCCHITTEST (if same thread) */
354 if (!WIN_IsCurrentThread( list[i] ))
355 {
356 *hittest = HTCLIENT;
Andreas Mohr284bcfc2002-05-28 22:47:01 +0000357 retvalue = list[i];
358 break;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000359 }
360 if ((res = SendMessageA( list[i], WM_NCHITTEST, 0, lparam )) != HTTRANSPARENT)
361 {
362 *hittest = res; /* Found the window */
Andreas Mohr284bcfc2002-05-28 22:47:01 +0000363 retvalue = list[i];
364 break;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000365 }
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000366 /* continue search with next sibling */
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000367 }
Andreas Mohr284bcfc2002-05-28 22:47:01 +0000368 HeapFree( GetProcessHeap(), 0, list );
369 return retvalue;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000370}
371
372
373/***********************************************************************
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000374 * WINPOS_WindowFromPoint
Alexandre Julliard7e56f681996-01-31 19:02:28 +0000375 *
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000376 * Find the window and hittest for a given point.
Alexandre Julliard7e56f681996-01-31 19:02:28 +0000377 */
Alexandre Julliardee8ab7a2001-06-20 23:16:34 +0000378HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest )
Alexandre Julliard7e56f681996-01-31 19:02:28 +0000379{
Alexandre Julliard5db8d2f2001-05-22 19:55:20 +0000380 POINT xy = pt;
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000381 int res;
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000382 LONG style;
Alexandre Julliard7e56f681996-01-31 19:02:28 +0000383
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000384 TRACE("scope %p %ld,%ld\n", hwndScope, pt.x, pt.y);
Alexandre Julliardee8ab7a2001-06-20 23:16:34 +0000385
386 if (!hwndScope) hwndScope = GetDesktopWindow();
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000387 style = GetWindowLongW( hwndScope, GWL_STYLE );
Alexandre Julliardee8ab7a2001-06-20 23:16:34 +0000388
389 *hittest = HTERROR;
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000390 if (style & WS_DISABLED) return 0;
391
392 MapWindowPoints( GetDesktopWindow(), GetAncestor( hwndScope, GA_PARENT ), &xy, 1 );
393
394 if (!(style & WS_MINIMIZE))
Susan Farleyb3f8a632000-07-08 18:28:25 +0000395 {
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000396 RECT rectClient;
397 if (WIN_GetRectangles( hwndScope, NULL, &rectClient ) && PtInRect( &rectClient, xy ))
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000398 {
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000399 HWND ret;
400
401 xy.x -= rectClient.left;
402 xy.y -= rectClient.top;
403 if ((ret = find_child_from_point( hwndScope, xy, hittest, MAKELONG( pt.x, pt.y ) )))
404 {
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000405 TRACE( "found child %p\n", ret );
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000406 return ret;
407 }
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000408 }
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000409 }
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000410
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000411 /* If nothing found, try the scope window */
412 if (!WIN_IsCurrentThread( hwndScope ))
413 {
414 *hittest = HTCLIENT;
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000415 TRACE( "returning %p\n", hwndScope );
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000416 return hwndScope;
417 }
418 res = SendMessageA( hwndScope, WM_NCHITTEST, 0, MAKELONG( pt.x, pt.y ) );
419 if (res != HTTRANSPARENT)
420 {
421 *hittest = res; /* Found the window */
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000422 TRACE( "returning %p\n", hwndScope );
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000423 return hwndScope;
424 }
425 *hittest = HTNOWHERE;
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000426 TRACE( "nothing found\n" );
Alexandre Julliard80593bf2001-10-11 20:49:40 +0000427 return 0;
Alexandre Julliard7e56f681996-01-31 19:02:28 +0000428}
429
430
431/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000432 * WindowFromPoint (USER32.@)
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000433 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000434HWND WINAPI WindowFromPoint( POINT pt )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000435{
Alexandre Julliardee8ab7a2001-06-20 23:16:34 +0000436 INT hittest;
437 return WINPOS_WindowFromPoint( 0, pt, &hittest );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000438}
439
440
441/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000442 * ChildWindowFromPoint (USER32.@)
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000443 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000444HWND WINAPI ChildWindowFromPoint( HWND hwndParent, POINT pt )
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000445{
Alexandre Julliard0801ffc2001-08-24 00:26:59 +0000446 return ChildWindowFromPointEx( hwndParent, pt, CWP_ALL );
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000447}
448
Paul Quinneede6b01998-11-30 13:15:36 +0000449/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000450 * ChildWindowFromPointEx (USER32.@)
Paul Quinneede6b01998-11-30 13:15:36 +0000451 */
Alexandre Julliard0801ffc2001-08-24 00:26:59 +0000452HWND WINAPI ChildWindowFromPointEx( HWND hwndParent, POINT pt, UINT uFlags)
Paul Quinneede6b01998-11-30 13:15:36 +0000453{
454 /* pt is in the client coordinates */
Alexandre Julliard0801ffc2001-08-24 00:26:59 +0000455 HWND *list;
456 int i;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000457 RECT rect;
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000458 HWND retvalue;
Paul Quinneede6b01998-11-30 13:15:36 +0000459
Alexandre Julliard0801ffc2001-08-24 00:26:59 +0000460 GetClientRect( hwndParent, &rect );
461 if (!PtInRect( &rect, pt )) return 0;
Alexandre Julliard9d9dac02001-08-24 19:28:21 +0000462 if (!(list = WIN_ListChildren( hwndParent ))) return 0;
Paul Quinneede6b01998-11-30 13:15:36 +0000463
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000464 for (i = 0; list[i]; i++)
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000465 {
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000466 if (!WIN_GetRectangles( list[i], &rect, NULL )) continue;
467 if (!PtInRect( &rect, pt )) continue;
468 if (uFlags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED))
Alexandre Julliard0801ffc2001-08-24 00:26:59 +0000469 {
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000470 LONG style = GetWindowLongW( list[i], GWL_STYLE );
471 if ((uFlags & CWP_SKIPINVISIBLE) && !(style & WS_VISIBLE)) continue;
472 if ((uFlags & CWP_SKIPDISABLED) && (style & WS_DISABLED)) continue;
Alexandre Julliard0801ffc2001-08-24 00:26:59 +0000473 }
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000474 if (uFlags & CWP_SKIPTRANSPARENT)
475 {
476 if (GetWindowLongW( list[i], GWL_EXSTYLE ) & WS_EX_TRANSPARENT) continue;
477 }
478 break;
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000479 }
Alexandre Julliard5797fbb2001-12-06 22:33:58 +0000480 retvalue = list[i];
Alexandre Julliard9d9dac02001-08-24 19:28:21 +0000481 HeapFree( GetProcessHeap(), 0, list );
Alexandre Julliard0801ffc2001-08-24 00:26:59 +0000482 if (!retvalue) retvalue = hwndParent;
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000483 return retvalue;
Paul Quinneede6b01998-11-30 13:15:36 +0000484}
485
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000486
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000487/*******************************************************************
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000488 * WINPOS_GetWinOffset
489 *
490 * Calculate the offset between the origin of the two windows. Used
491 * to implement MapWindowPoints.
492 */
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000493static void WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, POINT *offset )
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000494{
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000495 WND * wndPtr;
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000496
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000497 offset->x = offset->y = 0;
Alexandre Julliard7e56f681996-01-31 19:02:28 +0000498
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000499 /* Translate source window origin to screen coords */
Alexandre Julliard59730ae1996-03-24 16:20:51 +0000500 if (hwndFrom)
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000501 {
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000502 HWND hwnd = hwndFrom;
503
504 while (hwnd)
Alexandre Julliard59730ae1996-03-24 16:20:51 +0000505 {
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000506 if (hwnd == hwndTo) return;
507 if (!(wndPtr = WIN_GetPtr( hwnd )))
Alexandre Julliard556607a2001-10-10 20:28:17 +0000508 {
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000509 ERR( "bad hwndFrom = %p\n", hwnd );
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000510 return;
Alexandre Julliard556607a2001-10-10 20:28:17 +0000511 }
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000512 if (wndPtr == WND_OTHER_PROCESS) goto other_process;
513 offset->x += wndPtr->rectClient.left;
514 offset->y += wndPtr->rectClient.top;
515 hwnd = wndPtr->parent;
516 WIN_ReleasePtr( wndPtr );
Alexandre Julliard59730ae1996-03-24 16:20:51 +0000517 }
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000518 }
519
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000520 /* Translate origin to destination window coords */
Alexandre Julliard59730ae1996-03-24 16:20:51 +0000521 if (hwndTo)
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000522 {
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000523 HWND hwnd = hwndTo;
524
525 while (hwnd)
Alexandre Julliard59730ae1996-03-24 16:20:51 +0000526 {
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000527 if (!(wndPtr = WIN_GetPtr( hwnd )))
Alexandre Julliard556607a2001-10-10 20:28:17 +0000528 {
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000529 ERR( "bad hwndTo = %p\n", hwnd );
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000530 return;
Alexandre Julliard556607a2001-10-10 20:28:17 +0000531 }
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000532 if (wndPtr == WND_OTHER_PROCESS) goto other_process;
533 offset->x -= wndPtr->rectClient.left;
534 offset->y -= wndPtr->rectClient.top;
535 hwnd = wndPtr->parent;
536 WIN_ReleasePtr( wndPtr );
Alexandre Julliard556607a2001-10-10 20:28:17 +0000537 }
Alexandre Julliard59730ae1996-03-24 16:20:51 +0000538 }
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000539 return;
540
541 other_process: /* one of the parents may belong to another process, do it the hard way */
542 offset->x = offset->y = 0;
543 SERVER_START_REQ( get_windows_offset )
544 {
545 req->from = hwndFrom;
546 req->to = hwndTo;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000547 if (!wine_server_call( req ))
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000548 {
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000549 offset->x = reply->x;
550 offset->y = reply->y;
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000551 }
552 }
553 SERVER_END_REQ;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000554}
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000555
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000556
557/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000558 * MapWindowPoints (USER.258)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000559 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000560void WINAPI MapWindowPoints16( HWND16 hwndFrom, HWND16 hwndTo,
561 LPPOINT16 lppt, UINT16 count )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000562{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000563 POINT offset;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000564
Alexandre Julliardf44bbb82001-09-14 00:24:39 +0000565 WINPOS_GetWinOffset( WIN_Handle32(hwndFrom), WIN_Handle32(hwndTo), &offset );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000566 while (count--)
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000567 {
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000568 lppt->x += offset.x;
569 lppt->y += offset.y;
570 lppt++;
571 }
572}
573
574
575/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000576 * MapWindowPoints (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000577 */
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000578INT WINAPI MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, UINT count )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000579{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000580 POINT offset;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000581
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000582 WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000583 while (count--)
584 {
585 lppt->x += offset.x;
586 lppt->y += offset.y;
587 lppt++;
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000588 }
Eric Pouechb9544f11999-02-14 14:09:42 +0000589 return MAKELONG( LOWORD(offset.x), LOWORD(offset.y) );
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000590}
591
592
593/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000594 * IsIconic (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +0000595 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000596BOOL WINAPI IsIconic(HWND hWnd)
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000597{
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000598 return (GetWindowLongW( hWnd, GWL_STYLE ) & WS_MINIMIZE) != 0;
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000599}
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000600
601
Alexandre Julliard01d63461997-01-20 19:43:45 +0000602/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000603 * IsZoomed (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +0000604 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000605BOOL WINAPI IsZoomed(HWND hWnd)
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000606{
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000607 return (GetWindowLongW( hWnd, GWL_STYLE ) & WS_MAXIMIZE) != 0;
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000608}
609
610
Alexandre Julliarddba420a1994-02-02 06:48:31 +0000611/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000612 * AllowSetForegroundWindow (USER32.@)
David Elliott44f84b52000-10-29 01:24:54 +0000613 */
614BOOL WINAPI AllowSetForegroundWindow( DWORD procid )
615{
616 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
617 * implemented, then fix this function. */
618 return TRUE;
619}
620
621
622/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000623 * LockSetForegroundWindow (USER32.@)
David Elliott44f84b52000-10-29 01:24:54 +0000624 */
625BOOL WINAPI LockSetForegroundWindow( UINT lockcode )
626{
627 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
628 * implemented, then fix this function. */
629 return TRUE;
630}
631
632
633/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000634 * SetShellWindow (USER32.@)
Alexandre Julliarde658d821997-11-30 17:45:40 +0000635 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000636HWND WINAPI SetShellWindow(HWND hwndshell)
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000637{ WARN("(hWnd=%p) semi stub\n",hwndshell );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000638
Alexandre Julliard37a46392001-09-12 17:19:13 +0000639 hGlobalShellWindow = WIN_GetFullHandle( hwndshell );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000640 return hGlobalShellWindow;
Alexandre Julliarde658d821997-11-30 17:45:40 +0000641}
642
Alexandre Julliard17216f51997-10-12 16:30:17 +0000643
644/*******************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000645 * GetShellWindow (USER32.@)
Alexandre Julliard17216f51997-10-12 16:30:17 +0000646 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000647HWND WINAPI GetShellWindow(void)
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000648{ WARN("(hWnd=%p) semi stub\n",hGlobalShellWindow );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000649
650 return hGlobalShellWindow;
Alexandre Julliard17216f51997-10-12 16:30:17 +0000651}
652
653
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000654/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000655 * BringWindowToTop (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +0000656 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000657BOOL WINAPI BringWindowToTop( HWND hwnd )
Alexandre Julliard01d63461997-01-20 19:43:45 +0000658{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000659 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000660}
661
662
663/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000664 * MoveWindow (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +0000665 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000666BOOL WINAPI MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
667 BOOL repaint )
Vincent Béron9a624912002-05-31 23:06:46 +0000668{
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000669 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
670 if (!repaint) flags |= SWP_NOREDRAW;
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000671 TRACE("%p %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000672 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000673}
674
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000675/***********************************************************************
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000676 * WINPOS_InitInternalPos
677 */
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000678static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT pt, const RECT *restoreRect )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000679{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000680 LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( wnd->hwndSelf,
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000681 atomInternalPos );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000682 if( !lpPos )
683 {
Vincent Béron9a624912002-05-31 23:06:46 +0000684 /* this happens when the window is minimized/maximized
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000685 * for the first time (rectWindow is not adjusted yet) */
686
Alexandre Julliardda2892c2001-02-23 01:13:42 +0000687 lpPos = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNALPOS) );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000688 if( !lpPos ) return NULL;
689
Alexandre Julliarda3960291999-02-26 11:11:13 +0000690 SetPropA( wnd->hwndSelf, atomInternalPos, (HANDLE)lpPos );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000691 lpPos->hwndIconTitle = 0; /* defer until needs to be shown */
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000692 CONV_RECT32TO16( &wnd->rectWindow, &lpPos->rectNormal );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000693 *(UINT*)&lpPos->ptIconPos = *(UINT*)&lpPos->ptMaxPos = 0xFFFFFFFF;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000694 }
695
Vincent Béron9a624912002-05-31 23:06:46 +0000696 if( wnd->dwStyle & WS_MINIMIZE )
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000697 CONV_POINT32TO16( &pt, &lpPos->ptIconPos );
Vincent Béron9a624912002-05-31 23:06:46 +0000698 else if( wnd->dwStyle & WS_MAXIMIZE )
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000699 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
Vincent Béron9a624912002-05-31 23:06:46 +0000700 else if( restoreRect )
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000701 CONV_RECT32TO16( restoreRect, &lpPos->rectNormal );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000702
703 return lpPos;
704}
705
706/***********************************************************************
707 * WINPOS_RedrawIconTitle
708 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000709BOOL WINPOS_RedrawIconTitle( HWND hWnd )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000710{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000711 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hWnd, atomInternalPos );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000712 if( lpPos )
713 {
714 if( lpPos->hwndIconTitle )
715 {
Alexandre Julliarda3960291999-02-26 11:11:13 +0000716 SendMessageA( lpPos->hwndIconTitle, WM_SHOWWINDOW, TRUE, 0);
717 InvalidateRect( lpPos->hwndIconTitle, NULL, TRUE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000718 return TRUE;
719 }
720 }
721 return FALSE;
722}
723
724/***********************************************************************
725 * WINPOS_ShowIconTitle
726 */
Alexandre Julliardde424282001-08-10 22:51:42 +0000727BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000728{
Alexandre Julliardde424282001-08-10 22:51:42 +0000729 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000730
Alexandre Julliardde424282001-08-10 22:51:42 +0000731 if( lpPos && !(GetWindowLongA( hwnd, GWL_EXSTYLE) & WS_EX_MANAGED))
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000732 {
Alexandre Julliardde424282001-08-10 22:51:42 +0000733 HWND title = lpPos->hwndIconTitle;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000734
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000735 TRACE("%p %i\n", hwnd, (bShow != 0) );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000736
Alexandre Julliardde424282001-08-10 22:51:42 +0000737 if( !title )
738 lpPos->hwndIconTitle = title = ICONTITLE_Create( hwnd );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000739 if( bShow )
740 {
Alexandre Julliardde424282001-08-10 22:51:42 +0000741 if (!IsWindowVisible(title))
742 {
743 SendMessageA( title, WM_SHOWWINDOW, TRUE, 0 );
744 SetWindowPos( title, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
745 SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
746 }
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000747 }
Alexandre Julliardde424282001-08-10 22:51:42 +0000748 else ShowWindow( title, SW_HIDE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000749 }
750 return FALSE;
751}
752
753/*******************************************************************
754 * WINPOS_GetMinMaxInfo
755 *
756 * Get the minimized and maximized information for a window.
757 */
Alexandre Julliardde424282001-08-10 22:51:42 +0000758void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
Alexandre Julliarda3960291999-02-26 11:11:13 +0000759 POINT *minTrack, POINT *maxTrack )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000760{
761 LPINTERNALPOS lpPos;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000762 MINMAXINFO MinMax;
763 INT xinc, yinc;
Alexandre Julliardde424282001-08-10 22:51:42 +0000764 LONG style = GetWindowLongA( hwnd, GWL_STYLE );
765 LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000766
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000767 /* Compute default values */
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000768
Marcus Meissnerddca3151999-05-22 11:33:23 +0000769 MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);
770 MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);
771 MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
772 MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
773 MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
774 MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000775
Alexandre Julliardde424282001-08-10 22:51:42 +0000776 if (HAS_DLGFRAME( style, exstyle ))
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000777 {
Marcus Meissnerddca3151999-05-22 11:33:23 +0000778 xinc = GetSystemMetrics(SM_CXDLGFRAME);
779 yinc = GetSystemMetrics(SM_CYDLGFRAME);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000780 }
781 else
782 {
783 xinc = yinc = 0;
Alexandre Julliardde424282001-08-10 22:51:42 +0000784 if (HAS_THICKFRAME(style))
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000785 {
Marcus Meissnerddca3151999-05-22 11:33:23 +0000786 xinc += GetSystemMetrics(SM_CXFRAME);
787 yinc += GetSystemMetrics(SM_CYFRAME);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000788 }
Alexandre Julliardde424282001-08-10 22:51:42 +0000789 if (style & WS_BORDER)
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000790 {
Marcus Meissnerddca3151999-05-22 11:33:23 +0000791 xinc += GetSystemMetrics(SM_CXBORDER);
792 yinc += GetSystemMetrics(SM_CYBORDER);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000793 }
794 }
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000795 MinMax.ptMaxSize.x += 2 * xinc;
796 MinMax.ptMaxSize.y += 2 * yinc;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000797
Alexandre Julliardde424282001-08-10 22:51:42 +0000798 lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000799 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000800 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000801 else
802 {
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000803 MinMax.ptMaxPosition.x = -xinc;
804 MinMax.ptMaxPosition.y = -yinc;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000805 }
806
Alexandre Julliardde424282001-08-10 22:51:42 +0000807 SendMessageA( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000808
809 /* Some sanity checks */
810
Alexandre Julliard359f497e1999-07-04 16:02:24 +0000811 TRACE("%ld %ld / %ld %ld / %ld %ld / %ld %ld\n",
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000812 MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,
813 MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
814 MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
815 MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y);
Francois Gouget6d77d3a2000-03-25 21:44:35 +0000816 MinMax.ptMaxTrackSize.x = max( MinMax.ptMaxTrackSize.x,
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000817 MinMax.ptMinTrackSize.x );
Francois Gouget6d77d3a2000-03-25 21:44:35 +0000818 MinMax.ptMaxTrackSize.y = max( MinMax.ptMaxTrackSize.y,
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000819 MinMax.ptMinTrackSize.y );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000820
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000821 if (maxSize) *maxSize = MinMax.ptMaxSize;
822 if (maxPos) *maxPos = MinMax.ptMaxPosition;
823 if (minTrack) *minTrack = MinMax.ptMinTrackSize;
824 if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000825}
826
827/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000828 * ShowWindowAsync (USER32.@)
Alexandre Julliarddadf78f1998-05-17 17:13:43 +0000829 *
830 * doesn't wait; returns immediately.
831 * used by threads to toggle windows in other (possibly hanging) threads
832 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000833BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd )
Alexandre Julliarddadf78f1998-05-17 17:13:43 +0000834{
Alexandre Julliardc07a6cf2002-10-29 21:33:00 +0000835 HWND full_handle;
836
837 if ((full_handle = WIN_IsCurrentThread( hwnd )))
838 return USER_Driver.pShowWindow( full_handle, cmd );
839 return SendNotifyMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
Alexandre Julliarddadf78f1998-05-17 17:13:43 +0000840}
841
842
843/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000844 * ShowWindow (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +0000845 */
Alexandre Julliarddc4fe772001-06-04 21:55:17 +0000846BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
847{
Alexandre Julliardfb0ff052001-10-16 21:58:58 +0000848 HWND full_handle;
849
850 if ((full_handle = WIN_IsCurrentThread( hwnd )))
851 return USER_Driver.pShowWindow( full_handle, cmd );
852 return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
Alexandre Julliard5f721f81994-01-04 20:14:34 +0000853}
854
855
856/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000857 * GetInternalWindowPos (USER32.@)
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000858 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000859UINT WINAPI GetInternalWindowPos( HWND hwnd, LPRECT rectWnd,
860 LPPOINT ptIcon )
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000861{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000862 WINDOWPLACEMENT wndpl;
863 if (GetWindowPlacement( hwnd, &wndpl ))
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000864 {
865 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
866 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
867 return wndpl.showCmd;
868 }
869 return 0;
870}
871
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000872
873/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000874 * GetWindowPlacement (USER32.@)
Alexandre Julliard638f1691999-01-17 16:32:32 +0000875 *
876 * Win95:
877 * Fails if wndpl->length of Win95 (!) apps is invalid.
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000878 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +0000879BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000880{
Alexandre Julliardd23a82b2001-09-19 20:37:04 +0000881 WND *pWnd = WIN_FindWndPtr( hwnd );
882 LPINTERNALPOS lpPos;
883
884 if(!pWnd ) return FALSE;
885
886 lpPos = WINPOS_InitInternalPos( pWnd, *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
887 wndpl->length = sizeof(*wndpl);
888 if( pWnd->dwStyle & WS_MINIMIZE )
889 wndpl->showCmd = SW_SHOWMINIMIZED;
890 else
891 wndpl->showCmd = ( pWnd->dwStyle & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
892 if( pWnd->flags & WIN_RESTORE_MAX )
893 wndpl->flags = WPF_RESTORETOMAXIMIZED;
894 else
895 wndpl->flags = 0;
896 CONV_POINT16TO32( &lpPos->ptIconPos, &wndpl->ptMinPosition );
897 CONV_POINT16TO32( &lpPos->ptMaxPos, &wndpl->ptMaxPosition );
898 CONV_RECT16TO32( &lpPos->rectNormal, &wndpl->rcNormalPosition );
899 WIN_ReleaseWndPtr(pWnd);
900 return TRUE;
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000901}
902
903
904/***********************************************************************
905 * WINPOS_SetPlacement
906 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +0000907static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT flags )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000908{
909 WND *pWnd = WIN_FindWndPtr( hwnd );
910 if( pWnd )
911 {
912 LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
Alexandre Julliarda3960291999-02-26 11:11:13 +0000913 *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000914
Alexandre Julliardd23a82b2001-09-19 20:37:04 +0000915 if( flags & PLACE_MIN ) CONV_POINT32TO16( &wndpl->ptMinPosition, &lpPos->ptIconPos );
916 if( flags & PLACE_MAX ) CONV_POINT32TO16( &wndpl->ptMaxPosition, &lpPos->ptMaxPos );
917 if( flags & PLACE_RECT) CONV_RECT32TO16( &wndpl->rcNormalPosition, &lpPos->rectNormal );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000918
919 if( pWnd->dwStyle & WS_MINIMIZE )
920 {
Alexandre Julliardde424282001-08-10 22:51:42 +0000921 WINPOS_ShowIconTitle( pWnd->hwndSelf, FALSE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000922 if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
Alexandre Julliarda3960291999-02-26 11:11:13 +0000923 SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000924 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
Vincent Béron9a624912002-05-31 23:06:46 +0000925 }
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000926 else if( pWnd->dwStyle & WS_MAXIMIZE )
927 {
928 if( !EMPTYPOINT(lpPos->ptMaxPos) )
Alexandre Julliarda3960291999-02-26 11:11:13 +0000929 SetWindowPos( hwnd, 0, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000930 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
931 }
932 else if( flags & PLACE_RECT )
Alexandre Julliarda3960291999-02-26 11:11:13 +0000933 SetWindowPos( hwnd, 0, lpPos->rectNormal.left, lpPos->rectNormal.top,
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000934 lpPos->rectNormal.right - lpPos->rectNormal.left,
935 lpPos->rectNormal.bottom - lpPos->rectNormal.top,
936 SWP_NOZORDER | SWP_NOACTIVATE );
937
Alexandre Julliarda3960291999-02-26 11:11:13 +0000938 ShowWindow( hwnd, wndpl->showCmd );
939 if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000940 {
Alexandre Julliardde424282001-08-10 22:51:42 +0000941 if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd->hwndSelf, TRUE );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000942
943 /* SDK: ...valid only the next time... */
944 if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
945 }
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000946 WIN_ReleaseWndPtr(pWnd);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000947 return TRUE;
948 }
949 return FALSE;
950}
951
952
953/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000954 * SetWindowPlacement (USER32.@)
Alexandre Julliard638f1691999-01-17 16:32:32 +0000955 *
956 * Win95:
957 * Fails if wndpl->length of Win95 (!) apps is invalid.
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000958 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +0000959BOOL WINAPI SetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *wpl )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000960{
Alexandre Julliardd23a82b2001-09-19 20:37:04 +0000961 if (!wpl) return FALSE;
962 return WINPOS_SetPlacement( hwnd, wpl, PLACE_MIN | PLACE_MAX | PLACE_RECT );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000963}
964
965
966/***********************************************************************
Bobby Binghamdb4aae22001-06-06 20:20:09 +0000967 * AnimateWindow (USER32.@)
968 * Shows/Hides a window with an animation
969 * NO ANIMATION YET
970 */
971BOOL WINAPI AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags)
972{
973 FIXME("partial stub\n");
974
975 /* If trying to show/hide and it's already *
976 * shown/hidden or invalid window, fail with *
977 * invalid parameter */
978 if(!IsWindow(hwnd) ||
979 (IsWindowVisible(hwnd) && !(dwFlags & AW_HIDE)) ||
980 (!IsWindowVisible(hwnd) && (dwFlags & AW_HIDE)))
981 {
982 SetLastError(ERROR_INVALID_PARAMETER);
983 return FALSE;
984 }
985
986 ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
987
988 return TRUE;
989}
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000990
991/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000992 * SetInternalWindowPos (USER32.@)
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +0000993 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000994void WINAPI SetInternalWindowPos( HWND hwnd, UINT showCmd,
995 LPRECT rect, LPPOINT pt )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000996{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000997 if( IsWindow(hwnd) )
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000998 {
Alexandre Julliardd23a82b2001-09-19 20:37:04 +0000999 WINDOWPLACEMENT wndpl;
Alexandre Julliarda3960291999-02-26 11:11:13 +00001000 UINT flags;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001001
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001002 wndpl.length = sizeof(wndpl);
1003 wndpl.showCmd = showCmd;
1004 wndpl.flags = flags = 0;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001005
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001006 if( pt )
1007 {
1008 flags |= PLACE_MIN;
1009 wndpl.flags |= WPF_SETMINPOSITION;
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001010 wndpl.ptMinPosition = *pt;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001011 }
1012 if( rect )
1013 {
1014 flags |= PLACE_RECT;
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001015 wndpl.rcNormalPosition = *rect;
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001016 }
1017 WINPOS_SetPlacement( hwnd, &wndpl, flags );
1018 }
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001019}
1020
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001021
Alexandre Julliardd4719651995-12-12 18:49:11 +00001022/*******************************************************************
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001023 * can_activate_window
Alexandre Julliarddba420a1994-02-02 06:48:31 +00001024 *
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001025 * Check if we can activate the specified window.
Alexandre Julliarddba420a1994-02-02 06:48:31 +00001026 */
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001027static BOOL can_activate_window( HWND hwnd )
Alexandre Julliarddba420a1994-02-02 06:48:31 +00001028{
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001029 LONG style;
Noel Borthwickb4278561999-02-05 10:37:53 +00001030
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001031 if (!hwnd) return FALSE;
1032 style = GetWindowLongW( hwnd, GWL_STYLE );
1033 if (!(style & WS_VISIBLE)) return FALSE;
1034 if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
1035 return !(style & WS_DISABLED);
Alexandre Julliardd4719651995-12-12 18:49:11 +00001036}
1037
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001038
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +00001039/*******************************************************************
1040 * WINPOS_ActivateOtherWindow
1041 *
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001042 * Activates window other than pWnd.
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +00001043 */
Alexandre Julliard03e07b52001-11-06 22:28:18 +00001044void WINPOS_ActivateOtherWindow(HWND hwnd)
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +00001045{
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001046 HWND hwndTo, fg;
Noel Borthwickb4278561999-02-05 10:37:53 +00001047
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001048 if ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo = GetWindow( hwnd, GW_OWNER )))
Noel Borthwickb4278561999-02-05 10:37:53 +00001049 {
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001050 hwndTo = GetAncestor( hwndTo, GA_ROOT );
1051 if (can_activate_window( hwndTo )) goto done;
Noel Borthwickb4278561999-02-05 10:37:53 +00001052 }
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +00001053
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001054 hwndTo = hwnd;
1055 for (;;)
Alexandre Julliardde424282001-08-10 22:51:42 +00001056 {
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001057 if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
1058 if (can_activate_window( hwndTo )) break;
Alexandre Julliardde424282001-08-10 22:51:42 +00001059 }
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +00001060
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001061 done:
1062 fg = GetForegroundWindow();
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001063 TRACE("win = %p fg = %p\n", hwndTo, fg);
Alexandre Julliard5030bda2002-10-11 23:41:06 +00001064 if (!fg || (hwnd == fg))
1065 {
1066 if (SetForegroundWindow( hwndTo )) return;
1067 }
1068 if (!SetActiveWindow( hwndTo )) SetActiveWindow(0);
Alexandre Julliarddba420a1994-02-02 06:48:31 +00001069}
1070
1071
Alexandre Julliard86a8d0f1994-01-18 23:04:40 +00001072/***********************************************************************
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001073 * WINPOS_HandleWindowPosChanging16
Alexandre Julliard2d159fb1994-07-15 16:04:31 +00001074 *
1075 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1076 */
Alexandre Julliardde424282001-08-10 22:51:42 +00001077LONG WINPOS_HandleWindowPosChanging16( HWND hwnd, WINDOWPOS16 *winpos )
Alexandre Julliard2d159fb1994-07-15 16:04:31 +00001078{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001079 POINT maxSize, minTrack;
Alexandre Julliardde424282001-08-10 22:51:42 +00001080 LONG style = GetWindowLongA( hwnd, GWL_STYLE );
1081
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001082 if (winpos->flags & SWP_NOSIZE) return 0;
Alexandre Julliardde424282001-08-10 22:51:42 +00001083 if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001084 {
Alexandre Julliardde424282001-08-10 22:51:42 +00001085 WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
Alexandre Julliard77b99181997-09-14 17:17:23 +00001086 if (maxSize.x < winpos->cx) winpos->cx = maxSize.x;
1087 if (maxSize.y < winpos->cy) winpos->cy = maxSize.y;
Alexandre Julliardde424282001-08-10 22:51:42 +00001088 if (!(style & WS_MINIMIZE))
Alexandre Julliard77b99181997-09-14 17:17:23 +00001089 {
1090 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1091 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1092 }
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001093 }
1094 return 0;
1095}
1096
1097
1098/***********************************************************************
Francois Boisvert6b1b41c1999-03-14 17:25:32 +00001099 * WINPOS_HandleWindowPosChanging
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001100 *
1101 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1102 */
Alexandre Julliardde424282001-08-10 22:51:42 +00001103LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001104{
Gerard Patelcc3e0c52000-12-18 03:10:42 +00001105 POINT maxSize, minTrack;
Alexandre Julliardde424282001-08-10 22:51:42 +00001106 LONG style = GetWindowLongA( hwnd, GWL_STYLE );
1107
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001108 if (winpos->flags & SWP_NOSIZE) return 0;
Alexandre Julliardde424282001-08-10 22:51:42 +00001109 if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
Alexandre Julliard2d159fb1994-07-15 16:04:31 +00001110 {
Alexandre Julliardde424282001-08-10 22:51:42 +00001111 WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
Francois Gouget6d77d3a2000-03-25 21:44:35 +00001112 winpos->cx = min( winpos->cx, maxSize.x );
1113 winpos->cy = min( winpos->cy, maxSize.y );
Alexandre Julliardde424282001-08-10 22:51:42 +00001114 if (!(style & WS_MINIMIZE))
Gerard Patelcc3e0c52000-12-18 03:10:42 +00001115 {
1116 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1117 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1118 }
Alexandre Julliard2d159fb1994-07-15 16:04:31 +00001119 }
1120 return 0;
1121}
1122
Alexandre Julliard01d63461997-01-20 19:43:45 +00001123
1124/***********************************************************************
Dmitry Timoshkov85350c82002-08-27 01:14:44 +00001125 * dump_winpos_flags
1126 */
1127static void dump_winpos_flags(UINT flags)
1128{
1129 TRACE("flags:");
Tony Lambregts7ce3a5a2003-03-14 04:11:17 +00001130 if(flags & SWP_NOSIZE) TRACE(" SWP_NOSIZE");
1131 if(flags & SWP_NOMOVE) TRACE(" SWP_NOMOVE");
1132 if(flags & SWP_NOZORDER) TRACE(" SWP_NOZORDER");
1133 if(flags & SWP_NOREDRAW) TRACE(" SWP_NOREDRAW");
1134 if(flags & SWP_NOACTIVATE) TRACE(" SWP_NOACTIVATE");
1135 if(flags & SWP_FRAMECHANGED) TRACE(" SWP_FRAMECHANGED");
1136 if(flags & SWP_SHOWWINDOW) TRACE(" SWP_SHOWWINDOW");
1137 if(flags & SWP_HIDEWINDOW) TRACE(" SWP_HIDEWINDOW");
1138 if(flags & SWP_NOCOPYBITS) TRACE(" SWP_NOCOPYBITS");
1139 if(flags & SWP_NOOWNERZORDER) TRACE(" SWP_NOOWNERZORDER");
1140 if(flags & SWP_NOSENDCHANGING) TRACE(" SWP_NOSENDCHANGING");
1141 if(flags & SWP_DEFERERASE) TRACE(" SWP_DEFERERASE");
1142 if(flags & SWP_ASYNCWINDOWPOS) TRACE(" SWP_ASYNCWINDOWPOS");
Dmitry Timoshkov85350c82002-08-27 01:14:44 +00001143
1144#define DUMPED_FLAGS \
1145 (SWP_NOSIZE | \
1146 SWP_NOMOVE | \
1147 SWP_NOZORDER | \
1148 SWP_NOREDRAW | \
1149 SWP_NOACTIVATE | \
1150 SWP_FRAMECHANGED | \
1151 SWP_SHOWWINDOW | \
1152 SWP_HIDEWINDOW | \
1153 SWP_NOCOPYBITS | \
1154 SWP_NOOWNERZORDER | \
1155 SWP_NOSENDCHANGING | \
1156 SWP_DEFERERASE | \
1157 SWP_ASYNCWINDOWPOS)
1158
Tony Lambregts7ce3a5a2003-03-14 04:11:17 +00001159 if(flags & ~DUMPED_FLAGS) TRACE(" %08x", flags & ~DUMPED_FLAGS);
1160 TRACE("\n");
Dmitry Timoshkov85350c82002-08-27 01:14:44 +00001161#undef DUMPED_FLAGS
1162}
1163
1164/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001165 * SetWindowPos (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001166 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001167BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
Ulrich Weigand7f53c571999-06-18 17:03:13 +00001168 INT x, INT y, INT cx, INT cy, UINT flags )
Alexandre Julliard2d159fb1994-07-15 16:04:31 +00001169{
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +00001170 WINDOWPOS winpos;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001171
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001172 TRACE("hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
1173 hwnd, hwndInsertAfter, x, y, cx, cy, flags);
Dmitry Timoshkov85350c82002-08-27 01:14:44 +00001174 if(TRACE_ON(win)) dump_winpos_flags(flags);
1175
Alexandre Julliardcf2e57d2002-10-31 22:06:53 +00001176 winpos.hwnd = WIN_GetFullHandle(hwnd);
1177 winpos.hwndInsertAfter = WIN_GetFullHandle(hwndInsertAfter);
Alexandre Julliardd37eb361997-07-20 16:23:21 +00001178 winpos.x = x;
1179 winpos.y = y;
1180 winpos.cx = cx;
1181 winpos.cy = cy;
1182 winpos.flags = flags;
Alexandre Julliardfb0ff052001-10-16 21:58:58 +00001183 if (WIN_IsCurrentThread( hwnd )) return USER_Driver.pSetWindowPos( &winpos );
1184 return SendMessageW( winpos.hwnd, WM_WINE_SETWINDOWPOS, 0, (LPARAM)&winpos );
Alexandre Julliard2d159fb1994-07-15 16:04:31 +00001185}
1186
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +00001187
Alexandre Julliard2d159fb1994-07-15 16:04:31 +00001188/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001189 * BeginDeferWindowPos (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001190 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001191HDWP WINAPI BeginDeferWindowPos( INT count )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001192{
Alexandre Julliarda3960291999-02-26 11:11:13 +00001193 HDWP handle;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001194 DWP *pDWP;
1195
Vincent Béron9a624912002-05-31 23:06:46 +00001196 if (count < 0)
Slava Monichcdbe6442000-07-08 12:44:09 +00001197 {
1198 SetLastError(ERROR_INVALID_PARAMETER);
1199 return 0;
1200 }
1201 /* Windows allows zero count, in which case it allocates context for 8 moves */
1202 if (count == 0) count = 8;
1203
Alexandre Julliarda3960291999-02-26 11:11:13 +00001204 handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001205 if (!handle) return 0;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001206 pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001207 pDWP->actualCount = 0;
1208 pDWP->suggestedCount = count;
1209 pDWP->valid = TRUE;
1210 pDWP->wMagic = DWP_MAGIC;
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001211 pDWP->hwndParent = 0;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001212 return handle;
1213}
1214
1215
1216/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001217 * DeferWindowPos (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001218 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001219HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
1220 INT x, INT y, INT cx, INT cy,
1221 UINT flags )
Alexandre Julliardaca05781994-10-17 18:12:41 +00001222{
1223 DWP *pDWP;
1224 int i;
Francois Boisvert6b1b41c1999-03-14 17:25:32 +00001225 HDWP newhdwp = hdwp,retvalue;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001226
Alexandre Julliardf44bbb82001-09-14 00:24:39 +00001227 hwnd = WIN_GetFullHandle( hwnd );
Alexandre Julliarda3960291999-02-26 11:11:13 +00001228 if (hwnd == GetDesktopWindow()) return 0;
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001229
Alexandre Julliardf44bbb82001-09-14 00:24:39 +00001230 if (!(pDWP = USER_HEAP_LIN_ADDR( hdwp ))) return 0;
1231
Alexandre Julliardfb0ff052001-10-16 21:58:58 +00001232 USER_Lock();
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001233
Alexandre Julliardaca05781994-10-17 18:12:41 +00001234 for (i = 0; i < pDWP->actualCount; i++)
1235 {
1236 if (pDWP->winPos[i].hwnd == hwnd)
1237 {
1238 /* Merge with the other changes */
1239 if (!(flags & SWP_NOZORDER))
1240 {
Alexandre Julliardcf2e57d2002-10-31 22:06:53 +00001241 pDWP->winPos[i].hwndInsertAfter = WIN_GetFullHandle(hwndAfter);
Alexandre Julliardaca05781994-10-17 18:12:41 +00001242 }
1243 if (!(flags & SWP_NOMOVE))
1244 {
1245 pDWP->winPos[i].x = x;
1246 pDWP->winPos[i].y = y;
Alexandre Julliardfb0ff052001-10-16 21:58:58 +00001247 }
Alexandre Julliardaca05781994-10-17 18:12:41 +00001248 if (!(flags & SWP_NOSIZE))
1249 {
1250 pDWP->winPos[i].cx = cx;
1251 pDWP->winPos[i].cy = cy;
1252 }
Alexandre Julliard17216f51997-10-12 16:30:17 +00001253 pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
1254 SWP_NOZORDER | SWP_NOREDRAW |
1255 SWP_NOACTIVATE | SWP_NOCOPYBITS|
1256 SWP_NOOWNERZORDER);
Alexandre Julliardaca05781994-10-17 18:12:41 +00001257 pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
1258 SWP_FRAMECHANGED);
Francois Boisvert6b1b41c1999-03-14 17:25:32 +00001259 retvalue = hdwp;
1260 goto END;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001261 }
1262 }
1263 if (pDWP->actualCount >= pDWP->suggestedCount)
1264 {
1265 newhdwp = USER_HEAP_REALLOC( hdwp,
Alexandre Julliarda3960291999-02-26 11:11:13 +00001266 sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS) );
Francois Boisvert6b1b41c1999-03-14 17:25:32 +00001267 if (!newhdwp)
1268 {
1269 retvalue = 0;
1270 goto END;
1271 }
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001272 pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001273 pDWP->suggestedCount++;
1274 }
1275 pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
1276 pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
1277 pDWP->winPos[pDWP->actualCount].x = x;
1278 pDWP->winPos[pDWP->actualCount].y = y;
1279 pDWP->winPos[pDWP->actualCount].cx = cx;
1280 pDWP->winPos[pDWP->actualCount].cy = cy;
1281 pDWP->winPos[pDWP->actualCount].flags = flags;
1282 pDWP->actualCount++;
Francois Boisvert6b1b41c1999-03-14 17:25:32 +00001283 retvalue = newhdwp;
1284END:
Alexandre Julliardfb0ff052001-10-16 21:58:58 +00001285 USER_Unlock();
Francois Boisvert6b1b41c1999-03-14 17:25:32 +00001286 return retvalue;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001287}
1288
1289
1290/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001291 * EndDeferWindowPos (USER32.@)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001292 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001293BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
Alexandre Julliardaca05781994-10-17 18:12:41 +00001294{
1295 DWP *pDWP;
Alexandre Julliarda3960291999-02-26 11:11:13 +00001296 WINDOWPOS *winpos;
1297 BOOL res = TRUE;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001298 int i;
1299
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001300 pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001301 if (!pDWP) return FALSE;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001302 for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
Alexandre Julliardaca05781994-10-17 18:12:41 +00001303 {
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +00001304 if (!(res = USER_Driver.pSetWindowPos( winpos ))) break;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001305 }
1306 USER_HEAP_FREE( hdwp );
1307 return res;
1308}
1309
1310
1311/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001312 * TileChildWindows (USER.199)
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001313 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001314void WINAPI TileChildWindows16( HWND16 parent, WORD action )
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001315{
Alexandre Julliard359f497e1999-07-04 16:02:24 +00001316 FIXME("(%04x, %d): stub\n", parent, action);
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001317}
1318
1319/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001320 * CascadeChildWindows (USER.198)
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001321 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001322void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001323{
Alexandre Julliard359f497e1999-07-04 16:02:24 +00001324 FIXME("(%04x, %d): stub\n", parent, action);
Alexandre Julliard3a405ba1994-10-30 16:25:19 +00001325}
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001326
1327/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001328 * SetProgmanWindow (USER32.@)
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001329 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001330HWND WINAPI SetProgmanWindow ( HWND hwnd )
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001331{
1332 hGlobalProgmanWindow = hwnd;
1333 return hGlobalProgmanWindow;
1334}
1335
Juergen Schmied2c205911998-10-15 12:35:41 +00001336/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001337 * GetProgmanWindow (USER32.@)
Juergen Schmied2c205911998-10-15 12:35:41 +00001338 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001339HWND WINAPI GetProgmanWindow(void)
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001340{
1341 return hGlobalProgmanWindow;
Juergen Schmied2c205911998-10-15 12:35:41 +00001342}
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001343
1344/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001345 * SetShellWindowEx (USER32.@)
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001346 * hwndProgman = Progman[Program Manager]
1347 * |-> SHELLDLL_DefView
1348 * hwndListView = | |-> SysListView32
1349 * | | |-> tooltips_class32
1350 * | |
1351 * | |-> SysHeader32
Vincent Béron9a624912002-05-31 23:06:46 +00001352 * |
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001353 * |-> ProxyTarget
1354 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001355HWND WINAPI SetShellWindowEx ( HWND hwndProgman, HWND hwndListView )
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001356{
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001357 FIXME("%p %p stub\n",hwndProgman ,hwndListView );
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001358 hGlobalShellWindow = hwndProgman;
1359 return hGlobalShellWindow;
1360
1361}
1362
1363/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001364 * SetTaskmanWindow (USER32.@)
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001365 * NOTES
Vincent Béron9a624912002-05-31 23:06:46 +00001366 * hwnd = MSTaskSwWClass
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001367 * |-> SysTabControl32
1368 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001369HWND WINAPI SetTaskmanWindow ( HWND hwnd )
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001370{
1371 hGlobalTaskmanWindow = hwnd;
1372 return hGlobalTaskmanWindow;
1373}
1374
Juergen Schmied2c205911998-10-15 12:35:41 +00001375/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001376 * GetTaskmanWindow (USER32.@)
Juergen Schmied2c205911998-10-15 12:35:41 +00001377 */
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001378HWND WINAPI GetTaskmanWindow(void)
1379{
Juergen Schmiedddb2e291999-05-02 09:19:19 +00001380 return hGlobalTaskmanWindow;
Juergen Schmied2c205911998-10-15 12:35:41 +00001381}