source: trunk/src/user32/window.cpp@ 4825

Last change on this file since 4825 was 4825, checked in by sandervl, 25 years ago

hook, mdi & focus fixes

File size: 65.5 KB
Line 
1/* $Id: window.cpp,v 1.85 2000-12-17 15:04:13 sandervl Exp $ */
2/*
3 * Win32 window apis for OS/2
4 *
5 * Copyright 1999 Sander van Leeuwen
6 * Copyright 1999 Daniela Engert (dani@ngrt.de)
7 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
8 *
9 * Parts based on Wine Windows code (windows\win.c, windows\property.c, windows\winpos.c)
10 *
11 * Copyright 1993, 1994, 1995 Alexandre Julliard
12 * 1995, 1996, 1999 Alex Korobka
13 *
14 * Project Odin Software License can be found in LICENSE.TXT
15 *
16 *
17 * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps)
18 * TODO: ShowOwnedPopups needs to be tested
19 * GetLastActivePopup needs to be rewritten
20 * ArrangeIconicWindows probably also
21 *
22 */
23
24#include <os2win.h>
25#include <misc.h>
26#include <string.h>
27#include <stdio.h>
28#include <win32wbase.h>
29#include <win32wmdiclient.h>
30#include <win32wdesktop.h>
31#include "win32dlg.h"
32#include <oslibwin.h>
33#include <oslibgdi.h>
34#include "user32.h"
35#include "winicon.h"
36#include <win\winpos.h>
37#include <win\win.h>
38#include <heapstring.h>
39
40#define DBG_LOCALLOG DBG_window
41#include "dbglocal.h"
42
43//******************************************************************************
44//******************************************************************************
45HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
46 LPCSTR windowName, DWORD style, INT x,
47 INT y, INT width, INT height,
48 HWND parent, HMENU menu,
49 HINSTANCE instance, LPVOID data )
50{
51 Win32BaseWindow *window;
52 ATOM classAtom;
53 CREATESTRUCTA cs;
54 char tmpClass[20];
55
56 if(exStyle & WS_EX_MDICHILD)
57 return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
58
59 /* Find the class atom */
60 if (!(classAtom = GlobalFindAtomA(className)))
61 {
62 if (!HIWORD(className))
63 dprintf(("CreateWindowEx32A: bad class name %04x\n",LOWORD(className)));
64 else
65 dprintf(("CreateWindowEx32A: bad class name '%s'\n", className));
66
67 SetLastError(ERROR_INVALID_PARAMETER);
68 return 0;
69 }
70
71 if (!HIWORD(className))
72 {
73 sprintf(tmpClass,"#%d", (int) className);
74 className = tmpClass;
75 }
76
77 /* Create the window */
78 cs.lpCreateParams = data;
79 cs.hInstance = instance;
80 cs.hMenu = menu;
81 cs.hwndParent = parent;
82 cs.x = x;
83 cs.y = y;
84 cs.cx = width;
85 cs.cy = height;
86 cs.style = style;
87 cs.lpszName = windowName;
88 cs.lpszClass = className;
89 cs.dwExStyle = exStyle;
90 if(HIWORD(className)) {
91 dprintf(("CreateWindowExA: class %s parent %x (%d,%d) (%d,%d), %x %x menu=%x", className, parent, x, y, width, height, style, exStyle, menu));
92 }
93 else dprintf(("CreateWindowExA: class %d parent %x (%d,%d) (%d,%d), %x %x menu=%x", className, parent, x, y, width, height, style, exStyle, menu));
94
95 if(!strcmpi(className, MDICLIENTCLASSNAMEA)) {
96 window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, FALSE);
97 }
98 else
99 if(!strcmpi((char *) className, DIALOG_CLASS_NAMEA))
100 {
101 DLG_TEMPLATE dlgTemplate = {0};
102 dlgTemplate.style = cs.style;
103 dlgTemplate.exStyle = cs.dwExStyle;
104 dlgTemplate.x = cs.x;
105 dlgTemplate.y = cs.y;
106 dlgTemplate.cx = cs.cx;
107 dlgTemplate.cy = cs.cy;
108 dlgTemplate.className = cs.lpszClass;
109 dlgTemplate.caption = cs.lpszName;
110 window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
111 (LPCSTR) &dlgTemplate,
112 cs.hwndParent,
113 NULL,
114 (LPARAM) data,
115 FALSE);
116 }
117 else {
118 window = new Win32BaseWindow( &cs, classAtom, FALSE );
119 }
120 if(window == NULL)
121 {
122 dprintf(("Win32BaseWindow creation failed!!"));
123 return 0;
124 }
125 if(GetLastError() != 0)
126 {
127 dprintf(("Win32BaseWindow error found!!"));
128 delete window;
129 return 0;
130 }
131 return window->getWindowHandle();
132}
133//******************************************************************************
134//******************************************************************************
135HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
136 LPCWSTR windowName, DWORD style, INT x,
137 INT y, INT width, INT height,
138 HWND parent, HMENU menu,
139 HINSTANCE instance, LPVOID data )
140{
141 Win32BaseWindow *window;
142 ATOM classAtom;
143 CREATESTRUCTA cs;
144 WCHAR tmpClassW[20];
145
146 if(exStyle & WS_EX_MDICHILD)
147 return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
148
149 /* Find the class atom */
150 if (!(classAtom = GlobalFindAtomW(className)))
151 {
152 if (!HIWORD(className))
153 dprintf(("CreateWindowEx32W: bad class name %04x",LOWORD(className)));
154 else
155 dprintf(("CreateWindowEx32W: bad class name '%x'", className));
156
157 SetLastError(ERROR_INVALID_PARAMETER);
158 return 0;
159 }
160
161 if(HIWORD(className)) {
162 dprintf(("CreateWindowExW: class %ls name %x parent %x (%d,%d) (%d,%d), %x %x", className, windowName, parent, x, y, width, height, style, exStyle));
163 }
164 else dprintf(("CreateWindowExW: class %d name %x parent %x (%d,%d) (%d,%d), %x %x", className, windowName, parent, x, y, width, height, style, exStyle));
165
166 if (!HIWORD(className))
167 {
168 wsprintfW(tmpClassW, (LPCWSTR)L"#%d", (int) className);
169 className = tmpClassW;
170 }
171
172 /* Create the window */
173 cs.lpCreateParams = data;
174 cs.hInstance = instance;
175 cs.hMenu = menu;
176 cs.hwndParent = parent;
177 cs.x = x;
178 cs.y = y;
179 cs.cx = width;
180 cs.cy = height;
181 cs.style = style;
182 cs.lpszName = (LPSTR)windowName;
183 cs.lpszClass = (LPSTR)className;
184 cs.dwExStyle = exStyle;
185
186 if(!lstrcmpiW(className, (LPWSTR)MDICLIENTCLASSNAMEW)) {
187 window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, TRUE);
188 }
189 else
190 if(!lstrcmpiW(className, (LPWSTR)DIALOG_CLASS_NAMEW))
191 {
192 DLG_TEMPLATE dlgTemplate = {0};
193 dlgTemplate.style = cs.style;
194 dlgTemplate.exStyle = cs.dwExStyle;
195 dlgTemplate.x = cs.x;
196 dlgTemplate.y = cs.y;
197 dlgTemplate.cx = cs.cx;
198 dlgTemplate.cy = cs.cy;
199 dlgTemplate.className = cs.lpszClass;
200 dlgTemplate.caption = cs.lpszName;
201 window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
202 (LPCSTR) &dlgTemplate,
203 cs.hwndParent,
204 NULL,
205 (LPARAM) data,
206 TRUE);
207 }
208 else {
209 window = new Win32BaseWindow( &cs, classAtom, TRUE );
210 }
211 if(window == NULL)
212 {
213 dprintf(("Win32BaseWindow creation failed!!"));
214 return 0;
215 }
216 if(GetLastError() != 0)
217 {
218 dprintf(("Win32BaseWindow error found!!"));
219 delete window;
220 return 0;
221 }
222 return window->getWindowHandle();
223}
224//******************************************************************************
225//******************************************************************************
226HWND WIN32API CreateMDIWindowA(LPCSTR lpszClassName, LPCSTR lpszWindowName,
227 DWORD dwStyle, int x, int y, int nWidth,
228 int nHeight, HWND hwndParent,
229 HINSTANCE hInstance, LPARAM lParam )
230{
231 HWND hwnd;
232 MDICREATESTRUCTA cs;
233 Win32BaseWindow *window;
234
235 window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
236 if(!window) {
237 dprintf(("CreateMDIWindowA, window %x not found", hwndParent));
238 return 0;
239 }
240
241 cs.szClass = lpszClassName;
242 cs.szTitle = lpszWindowName;
243 cs.hOwner = hInstance;
244 cs.x = x;
245 cs.y = y;
246 cs.cx = nHeight;
247 cs.cy = nWidth;
248 cs.style = dwStyle;
249 cs.lParam = lParam;
250
251 if(HIWORD(lpszClassName)) {
252 dprintf(("CreateMDIWindowA: class %s parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam));
253 }
254 else dprintf(("CreateMDIWindowA: class %d parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam));
255
256 return window->SendMessageA(WM_MDICREATE, 0, (LPARAM)&cs);
257}
258//******************************************************************************
259//******************************************************************************
260HWND WIN32API CreateMDIWindowW(LPCWSTR lpszClassName, LPCWSTR lpszWindowName,
261 DWORD dwStyle, int x, int y, int nWidth,
262 int nHeight, HWND hwndParent,
263 HINSTANCE hInstance, LPARAM lParam )
264{
265 HWND hwnd;
266 MDICREATESTRUCTW cs;
267 Win32BaseWindow *window;
268
269 window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
270 if(!window) {
271 dprintf(("CreateMDIWindowW, window %x not found", hwndParent));
272 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
273 return 0;
274 }
275
276 dprintf(("USER32: CreateMDIWindowW\n"));
277 cs.szClass = lpszClassName;
278 cs.szTitle = lpszWindowName;
279 cs.hOwner = hInstance;
280 cs.x = x;
281 cs.y = y;
282 cs.cx = nHeight;
283 cs.cy = nWidth;
284 cs.style = dwStyle;
285 cs.lParam = lParam;
286
287 return window->SendMessageW(WM_MDICREATE, 0, (LPARAM)&cs);
288}
289//******************************************************************************
290//******************************************************************************
291BOOL WIN32API DestroyWindow(HWND hwnd)
292{
293 Win32BaseWindow *window;
294
295 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
296 if(!window) {
297 dprintf(("DestroyWindow, window %x not found", hwnd));
298 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
299 return 0;
300 }
301 if(window->isDesktopWindow()) {
302 dprintf(("WARNING: Trying to destroy desktop window!"));
303 return FALSE;
304 }
305 return window->DestroyWindow();
306}
307//******************************************************************************
308//******************************************************************************
309HWND WIN32API SetActiveWindow( HWND hwnd)
310{
311 Win32BaseWindow *window;
312
313 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
314 if(!window) {
315 dprintf(("SetActiveWindow, window %x not found", hwnd));
316 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
317 return 0;
318 }
319 return window->SetActiveWindow();
320}
321//******************************************************************************
322//******************************************************************************
323HWND WIN32API GetParent( HWND hwnd)
324{
325 Win32BaseWindow *window;
326
327 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
328 if(!window) {
329 dprintf(("GetParent, window %x not found", hwnd));
330 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
331 return 0;
332 }
333// dprintf(("GetParent %x", hwnd));
334 return window->GetParent();
335}
336//******************************************************************************
337//******************************************************************************
338HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
339{
340 Win32BaseWindow *window, *parent;
341
342 window = Win32BaseWindow::GetWindowFromHandle(hwndChild);
343 if(!window) {
344 dprintf(("SetParent, window %x not found", hwndChild));
345 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
346 return 0;
347 }
348 if(hwndNewParent == HWND_DESKTOP) {
349 hwndNewParent = GetDesktopWindow();
350 }
351 else {
352 parent = Win32BaseWindow::GetWindowFromHandle(hwndNewParent);
353 if(!window) {
354 dprintf(("SetParent, parent %x not found", hwndNewParent));
355 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
356 return 0;
357 }
358 }
359 dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
360 return window->SetParent(hwndNewParent);
361}
362//******************************************************************************
363//******************************************************************************
364BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
365{
366 Win32BaseWindow *window;
367
368 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
369 if(!window) {
370 dprintf(("IsChild %x, window %x not found", hwndParent, hwnd));
371 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
372 return 0;
373 }
374 dprintf(("IsChild %x %x", hwndParent, hwnd));
375 return window->IsChild(hwndParent);
376}
377//******************************************************************************
378//******************************************************************************
379HWND WIN32API GetTopWindow( HWND hwnd)
380{
381 Win32BaseWindow *window;
382 HWND hwndTop;
383
384 if(hwnd == HWND_DESKTOP) {
385 window = windowDesktop;
386 }
387 else {
388 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
389 if(!window) {
390 dprintf(("GetTopWindow, window %x not found", hwnd));
391 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
392 return 0;
393 }
394 }
395 hwndTop = window->GetTopWindow();
396 dprintf2(("GetTopWindow %x returned %x", hwnd, hwndTop));
397 return hwndTop;
398}
399//******************************************************************************
400//******************************************************************************
401BOOL WIN32API IsIconic( HWND hwnd)
402{
403 Win32BaseWindow *window;
404 BOOL rc;
405
406 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
407 if(!window) {
408 dprintf(("IsIconic, window %x not found", hwnd));
409 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
410 return FALSE;
411 }
412 rc = window->IsWindowIconic();
413 dprintf(("IsIconic %x returned %d", hwnd, rc));
414 return rc;
415}
416//******************************************************************************
417//******************************************************************************
418HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
419{
420 Win32BaseWindow *window;
421 HWND rc;
422
423 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
424 if(!window) {
425 dprintf(("GetWindow, window %x not found", hwnd));
426 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
427 return 0;
428 }
429 return window->GetWindow(uCmd);
430}
431//******************************************************************************
432//******************************************************************************
433BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
434{
435 Win32BaseWindow *window;
436
437 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
438 if(!window) {
439 dprintf(("EnableWindow, window %x not found", hwnd));
440 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
441 return 0;
442 }
443 dprintf(("EnableWindow %x %d", hwnd, fEnable));
444 return window->EnableWindow(fEnable);
445}
446//******************************************************************************
447//******************************************************************************
448BOOL WIN32API BringWindowToTop(HWND hwnd)
449{
450 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
451}
452/***********************************************************************
453 * SetInternalWindowPos (USER32.483)
454 */
455void WIN32API SetInternalWindowPos(HWND hwnd,
456 UINT showCmd,
457 LPRECT lpRect,
458 LPPOINT lpPoint )
459{
460 dprintf(("USER32: SetInternalWindowPos(%08xh,%08xh,%08xh,%08xh)",
461 hwnd, showCmd, lpRect, lpPoint));
462
463 if( IsWindow(hwnd) )
464 {
465 WINDOWPLACEMENT wndpl;
466 UINT flags;
467
468 GetWindowPlacement(hwnd, &wndpl);
469 wndpl.length = sizeof(wndpl);
470 wndpl.showCmd = showCmd;
471 wndpl.flags = 0;
472
473 if(lpPoint)
474 {
475 wndpl.flags |= WPF_SETMINPOSITION;
476 wndpl.ptMinPosition = *lpPoint;
477 }
478 if(lpRect)
479 {
480 wndpl.rcNormalPosition = *lpRect;
481 }
482 SetWindowPlacement( hwnd, &wndpl);
483 }
484
485}
486/***********************************************************************
487 * GetInternalWindowPos (USER32.245)
488 */
489UINT WIN32API GetInternalWindowPos(HWND hwnd,
490 LPRECT rectWnd,
491 LPPOINT ptIcon )
492{
493 WINDOWPLACEMENT wndpl;
494
495 dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
496 hwnd,
497 rectWnd,
498 ptIcon));
499
500 if(GetWindowPlacement( hwnd, &wndpl ))
501 {
502 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
503 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
504 return wndpl.showCmd;
505 }
506 return 0;
507}
508//******************************************************************************
509//******************************************************************************
510HWND WIN32API GetActiveWindow()
511{
512 return Win32BaseWindow::GetActiveWindow();
513}
514//******************************************************************************
515//******************************************************************************
516BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
517{
518 Win32BaseWindow *window;
519
520 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
521 if(!window) {
522 dprintf(("ShowWindow, window %x not found", hwnd));
523 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
524 return 0;
525 }
526 return window->ShowWindow(nCmdShow);
527}
528/*****************************************************************************
529 * Name : BOOL WIN32API ShowWindowAsync
530 * Purpose : The ShowWindowAsync function sets the show state of a window
531 * created by a different thread.
532 * Parameters: HWND hwnd handle of window
533 * int nCmdShow show state of window
534 * Variables :
535 * Result : If the window was previously visible, the return value is TRUE.
536 * If the window was previously hidden, the return value is FALSE.
537 * Remark :
538 * Status : UNTESTED STUB
539 *
540 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
541 *****************************************************************************/
542BOOL WIN32API ShowWindowAsync (HWND hwnd,
543 int nCmdShow)
544{
545 dprintf(("USER32:ShowWindowAsync (%08xh,%08x) not correctly implemented.\n",
546 hwnd,
547 nCmdShow));
548
549 return ShowWindow(hwnd, nCmdShow);
550}
551//******************************************************************************
552//******************************************************************************
553BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
554{
555 Win32BaseWindow *window;
556
557 if (!hwnd)
558 {
559 dprintf(("SetWindowPos: Can't move desktop!"));
560 return TRUE;
561 }
562 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
563 if(!window) {
564 dprintf(("SetWindowPos, window %x not found", hwnd));
565 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
566 return FALSE;
567 }
568 dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
569 return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags);
570}
571//******************************************************************************
572//NOTE: length must equal structure size or else api fails (verified in NT4, SP6)
573//******************************************************************************
574BOOL WIN32API SetWindowPlacement(HWND hwnd, const WINDOWPLACEMENT *winpos)
575{
576 Win32BaseWindow *window;
577
578 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
579 if(!window) {
580 dprintf(("SetWindowPlacement, window %x not found", hwnd));
581 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
582 return FALSE;
583 }
584 if(!winpos || winpos->length != sizeof(WINDOWPLACEMENT)) {
585 dprintf(("SetWindowPlacement %x invalid parameter", hwnd));
586 SetLastError(ERROR_INVALID_PARAMETER);
587 return FALSE;
588 }
589 dprintf(("USER32: SetWindowPlacement %x %x", hwnd, winpos));
590 return window->SetWindowPlacement((WINDOWPLACEMENT *)winpos);
591}
592//******************************************************************************
593//NOTE: Length does not need to be correct (even though the SDK docs claim otherwise)
594// (Verified in NT4, SP6)
595//******************************************************************************
596BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT winpos)
597{
598 Win32BaseWindow *window;
599
600 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
601 if(!window) {
602 dprintf(("GetWindowPlacement, window %x not found", hwnd));
603 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
604 return FALSE;
605 }
606 if(!winpos) {
607 dprintf(("GetWindowPlacement %x invalid parameter", hwnd));
608 SetLastError(ERROR_INVALID_PARAMETER);
609 return FALSE;
610 }
611 dprintf(("USER32: GetWindowPlacement %x %x", hwnd, winpos));
612 return window->GetWindowPlacement(winpos);
613}
614//******************************************************************************
615//******************************************************************************
616BOOL WIN32API IsWindow( HWND hwnd)
617{
618 Win32BaseWindow *window;
619
620 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
621 if(!window) {
622 dprintf(("IsWindow, window %x not found", hwnd));
623 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
624 return FALSE;
625 }
626 dprintf2(("IsWindow %x", hwnd));
627 return window->IsWindow();
628}
629//******************************************************************************
630//******************************************************************************
631BOOL WIN32API IsWindowEnabled( HWND hwnd)
632{
633 Win32BaseWindow *window;
634
635 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
636 if(!window) {
637 dprintf(("IsWindowEnabled, window %x not found", hwnd));
638 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
639 return 0;
640 }
641 dprintf(("IsWindowEnabled %x", hwnd));
642 return window->IsWindowEnabled();
643}
644//******************************************************************************
645//******************************************************************************
646BOOL WIN32API IsWindowVisible( HWND hwnd)
647{
648 Win32BaseWindow *window;
649 BOOL rc;
650
651 if (hwnd)
652 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
653 else
654 window = windowDesktop;
655 if(!window) {
656 dprintf(("IsWindowVisible, window %x not found", hwnd));
657 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
658 return 0;
659 }
660 rc = window->IsWindowVisible();
661 dprintf(("IsWindowVisible %x returned %d", hwnd, rc));
662 return rc;
663}
664//******************************************************************************
665//******************************************************************************
666HWND WIN32API SetFocus (HWND hwnd)
667{
668 HWND lastFocus, lastFocus_W, hwnd_O;
669 BOOL activate;
670
671 hwnd_O = Win32BaseWindow::Win32ToOS2Handle (hwnd);
672 lastFocus = OSLibWinQueryFocus (OSLIB_HWND_DESKTOP);
673 activate = ((hwnd_O == lastFocus) || OSLibWinIsChild (lastFocus, hwnd_O));
674 lastFocus_W = Win32BaseWindow::OS2ToWin32Handle (lastFocus);
675
676 dprintf(("SetFocus %x (%x) -> %x (%x)\n", lastFocus_W, lastFocus, hwnd, hwnd_O));
677
678 return (OSLibWinSetFocus (OSLIB_HWND_DESKTOP, hwnd_O, activate)) ? lastFocus_W : 0;
679}
680//******************************************************************************
681//******************************************************************************
682HWND WIN32API GetFocus(void)
683{
684 HWND hwnd;
685
686 hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
687 hwnd = Win32BaseWindow::OS2ToWin32Handle(hwnd);
688 dprintf(("USER32: GetFocus %x\n", hwnd));
689 return hwnd;
690}
691//******************************************************************************
692//******************************************************************************
693BOOL WIN32API IsZoomed(HWND hwnd)
694{
695 DWORD style;
696
697 style = GetWindowLongA(hwnd, GWL_STYLE);
698 dprintf(("USER32: IsZoomed %x returned %d", hwnd, ((style & WS_MAXIMIZE) != 0)));
699
700 return (style & WS_MAXIMIZE) != 0;
701}
702//******************************************************************************
703//******************************************************************************
704BOOL WIN32API LockWindowUpdate(HWND hwnd)
705{
706 dprintf(("USER32: LockWindowUpdate %x", hwnd));
707 return OSLibWinLockWindowUpdate(Win32BaseWindow::Win32ToOS2Handle(hwnd));
708}
709//******************************************************************************
710//******************************************************************************
711BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
712{
713 Win32BaseWindow *window;
714
715 if (hwnd)
716 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
717 else
718 window = windowDesktop;
719
720 if(!window) {
721 dprintf(("GetWindowRect, window %x not found", hwnd));
722 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
723 return FALSE;
724 }
725 if(pRect == NULL) {
726 SetLastError(ERROR_INVALID_PARAMETER);
727 return FALSE;
728 }
729 *pRect = *window->getWindowRect();
730
731 //convert from parent coordinates to screen (if necessary)
732 if(window->getParent()) {
733 MapWindowPoints(window->getParent()->getWindowHandle(), 0, (PPOINT)pRect, 2);
734 }
735
736 dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
737 return TRUE;
738}
739//******************************************************************************
740//******************************************************************************
741int WIN32API GetWindowTextLengthA( HWND hwnd)
742{
743 Win32BaseWindow *window;
744
745 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
746 if(!window) {
747 dprintf(("GetWindowTextLength, window %x not found", hwnd));
748 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
749 return 0;
750 }
751 dprintf(("GetWindowTextLength %x", hwnd));
752 return window->GetWindowTextLength();
753}
754//******************************************************************************
755//******************************************************************************
756int WIN32API GetWindowTextA( HWND hwnd, LPSTR lpsz, int cch)
757{
758 Win32BaseWindow *window;
759 int rc;
760
761 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
762 if(!window) {
763 dprintf(("GetWindowTextA, window %x not found", hwnd));
764 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
765 return 0;
766 }
767 rc = window->GetWindowTextA(lpsz, cch);
768 dprintf(("GetWindowTextA %x %s", hwnd, lpsz));
769 return rc;
770}
771//******************************************************************************
772//******************************************************************************
773int WIN32API GetWindowTextLengthW( HWND hwnd)
774{
775 dprintf(("USER32: GetWindowTextLengthW\n"));
776 return GetWindowTextLengthA(hwnd);
777}
778//******************************************************************************
779//******************************************************************************
780int WIN32API GetWindowTextW(HWND hwnd, LPWSTR lpsz, int cch)
781{
782 Win32BaseWindow *window;
783
784 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
785 if(!window) {
786 dprintf(("GetWindowTextW, window %x not found", hwnd));
787 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
788 return 0;
789 }
790#ifdef DEBUG
791 int rc = window->GetWindowTextW(lpsz, cch);
792 if(rc) {
793 LPSTR astring = UnicodeToAsciiString(lpsz);
794 dprintf(("GetWindowTextW %x %s", hwnd, lpsz));
795 free(astring);
796 }
797 else dprintf(("GetWindowTextW %x returned %d", hwnd, rc));
798 return rc;
799#else
800 return window->GetWindowTextW(lpsz, cch);
801#endif
802}
803//******************************************************************************
804//******************************************************************************
805BOOL WIN32API SetWindowTextA(HWND hwnd, LPCSTR lpsz)
806{
807 Win32BaseWindow *window;
808
809 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
810 if(!window) {
811 dprintf(("SetWindowTextA, window %x not found", hwnd));
812 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
813 return 0;
814 }
815 dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
816 return window->SetWindowTextA((LPSTR)lpsz);
817}
818//******************************************************************************
819//******************************************************************************
820BOOL WIN32API SetWindowTextW( HWND hwnd, LPCWSTR lpsz)
821{
822 Win32BaseWindow *window;
823
824 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
825 if(!window) {
826 dprintf(("SetWindowTextA, window %x not found", hwnd));
827 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
828 return 0;
829 }
830#ifdef DEBUG
831 LPSTR astring = UnicodeToAsciiString(lpsz);
832 dprintf(("SetWindowTextW %x %s", hwnd, astring));
833 free(astring);
834#endif
835 return window->SetWindowTextW((LPWSTR)lpsz);
836}
837/*******************************************************************
838 * InternalGetWindowText (USER32.326)
839 */
840int WIN32API InternalGetWindowText(HWND hwnd,
841 LPWSTR lpString,
842 INT nMaxCount )
843{
844 dprintf(("USER32: InternalGetWindowText(%08xh,%08xh,%08xh) not properly implemented.\n",
845 hwnd,
846 lpString,
847 nMaxCount));
848
849 return GetWindowTextW(hwnd,lpString,nMaxCount);
850}
851//******************************************************************************
852//TODO: Correct?
853//******************************************************************************
854BOOL WIN32API SetForegroundWindow(HWND hwnd)
855{
856 dprintf((" SetForegroundWindow %x", hwnd));
857
858 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
859}
860//******************************************************************************
861//******************************************************************************
862BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
863{
864 HWND hwndWin32 = hwnd;
865 Win32BaseWindow *window;
866
867 if (!pRect)
868 {
869 SetLastError(ERROR_INVALID_PARAMETER);
870 return FALSE;
871 }
872 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
873 if(!window) {
874 dprintf(("GetClientRect, window %x not found", hwnd));
875 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
876 return FALSE;
877 }
878 window->getClientRect(pRect);
879 dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom));
880 return TRUE;
881}
882//******************************************************************************
883//******************************************************************************
884BOOL WIN32API AdjustWindowRect(PRECT rect, DWORD style, BOOL menu)
885{
886 return AdjustWindowRectEx(rect, style, menu, 0);
887}
888//******************************************************************************
889//Calculate window rectangle based on given client rectangle, style, menu and extended style
890//******************************************************************************
891BOOL WIN32API AdjustWindowRectEx( PRECT rect, DWORD style, BOOL menu, DWORD exStyle)
892{
893 if(style == 0 && menu == FALSE && exStyle == 0) {
894 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d) -> no change required", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom));
895 return TRUE; //nothing needs to be changed (VERIFIED in NT 4)
896 }
897 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d)\n", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom));
898 /* Correct the window style */
899 if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
900 style |= WS_CAPTION;
901
902 //SvL: Include WS_POPUP -> otherwise HAS_THINFRAME is true for popup windows
903 // Also include WS_CHILD -> otherwise HAS_THICKFRAME doesn't work correctly
904 style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_POPUP);
905 exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
906 if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
907
908 //Adjust rect outer (Win32BaseWindow::AdjustRectOuter)
909 if (HAS_THICKFRAME(style,exStyle))
910 InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
911 else
912 if (HAS_DLGFRAME(style,exStyle))
913 InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
914 else
915 if (HAS_THINFRAME(style))
916 InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
917
918 if ((style & WS_CAPTION) == WS_CAPTION)
919 {
920 if (exStyle & WS_EX_TOOLWINDOW)
921 rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
922 else
923 rect->top -= GetSystemMetrics(SM_CYCAPTION);
924 }
925
926 if (menu)
927 rect->top -= GetSystemMetrics(SM_CYMENU);
928
929 //Adjust rect inner (Win32BaseWindow::AdjustRectInner)
930 if(!(style & WS_ICONIC)) {
931 if (exStyle & WS_EX_CLIENTEDGE)
932 InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
933
934 if (exStyle & WS_EX_STATICEDGE)
935 InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
936
937 //SvL: scrollbars aren't checked *UNLESS* the style includes a border (any border)
938 // --> VERIFIED IN NT4, SP6 (fixes MFC apps with scrollbars + bar controls)
939 if(style & (WS_THICKFRAME|WS_BORDER|WS_DLGFRAME)) {
940 if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL);
941 if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
942 }
943 }
944
945 dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom));
946
947 return TRUE;
948}
949//******************************************************************************
950/* Coordinate Space and Transformation Functions */
951//******************************************************************************
952/*******************************************************************
953 * WINPOS_GetWinOffset
954 *
955 * Calculate the offset between the origin of the two windows. Used
956 * to implement MapWindowPoints.
957 */
958static void WINPOS_GetWinOffset( Win32BaseWindow *wndFrom, Win32BaseWindow *wndTo,
959 POINT *offset )
960{
961 Win32BaseWindow *window;
962
963 offset->x = offset->y = 0;
964
965 /* Translate source window origin to screen coords */
966 if(wndFrom != windowDesktop)
967 {
968 window = wndFrom;
969 while(window)
970 {
971 offset->x += window->getClientRectPtr()->left + window->getWindowRect()->left;
972 offset->y += window->getClientRectPtr()->top + window->getWindowRect()->top;
973 window = window->getParent();
974 }
975 }
976
977 /* Translate origin to destination window coords */
978 if(wndTo != windowDesktop)
979 {
980 window = wndTo;
981 while(window)
982 {
983 offset->x -= window->getClientRectPtr()->left + window->getWindowRect()->left;
984 offset->y -= window->getClientRectPtr()->top + window->getWindowRect()->top;
985 window = window->getParent();
986 }
987 }
988}
989//******************************************************************************
990//******************************************************************************
991int WIN32API MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints,
992 UINT cPoints)
993{
994 Win32BaseWindow *wndfrom, *wndto;
995 int retval = 0;
996 POINT offset;
997
998 SetLastError(0);
999 if(lpPoints == NULL || cPoints == 0) {
1000 SetLastError(ERROR_INVALID_PARAMETER);
1001 return 0;
1002 }
1003 if(hwndFrom)
1004 {
1005 wndfrom = Win32BaseWindow::GetWindowFromHandle(hwndFrom);
1006 if(!wndfrom) {
1007 dprintf(("MapWindowPoints, window %x not found", hwndFrom));
1008 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1009 return 0;
1010 }
1011 }
1012 else wndfrom = windowDesktop;
1013
1014 if(hwndTo)
1015 {
1016 wndto = Win32BaseWindow::GetWindowFromHandle(hwndTo);
1017 if(!wndto) {
1018 dprintf(("MapWindowPoints, window %x not found", hwndTo));
1019 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1020 return 0;
1021 }
1022 }
1023 else wndto = windowDesktop;
1024
1025 if(wndto == wndfrom)
1026 return 0; //nothing to do
1027
1028 dprintf2(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints));
1029 WINPOS_GetWinOffset(wndfrom, wndto, &offset);
1030
1031 for(int i=0;i<cPoints;i++)
1032 {
1033 lpPoints[i].x += offset.x;
1034 lpPoints[i].y += offset.y;
1035 }
1036 retval = ((LONG)offset.y << 16) | offset.x;
1037 return retval;
1038}
1039//******************************************************************************
1040//******************************************************************************
1041BOOL WIN32API ScreenToClient(HWND hwnd, LPPOINT pt)
1042{
1043 Win32BaseWindow *wnd;
1044 PRECT rcl;
1045 BOOL rc;
1046
1047 if(!hwnd) {
1048 return (TRUE);
1049 }
1050 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1051 if (!wnd) {
1052 dprintf(("warning: ScreenToClient: window %x not found!", hwnd));
1053 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1054 return FALSE;
1055 }
1056 SetLastError(0);
1057#ifdef DEBUG
1058 POINT tmp = *pt;
1059#endif
1060 MapWindowPoints(0, hwnd, pt, 1);
1061 dprintf2(("ScreenToClient %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y));
1062 return TRUE;
1063}
1064//******************************************************************************
1065//******************************************************************************
1066HWND WIN32API GetDesktopWindow(void)
1067{
1068 HWND DesktopWindow = windowDesktop->getWindowHandle();
1069 dprintf2(("USER32: GetDesktopWindow, returned %x\n", DesktopWindow));
1070 return DesktopWindow;
1071}
1072//******************************************************************************
1073//******************************************************************************
1074HWND WIN32API FindWindowA(LPCSTR lpszClass, LPCSTR lpszWindow)
1075{
1076 return FindWindowExA( NULL, NULL, lpszClass, lpszWindow );
1077}
1078//******************************************************************************
1079//******************************************************************************
1080HWND WIN32API FindWindowW( LPCWSTR lpClassName, LPCWSTR lpWindowName)
1081{
1082 return FindWindowExW( NULL, NULL, lpClassName, lpWindowName );
1083}
1084//******************************************************************************
1085//******************************************************************************
1086HWND WIN32API FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
1087{
1088 ATOM atom = 0;
1089
1090 if (lpszClass)
1091 {
1092 /* If the atom doesn't exist, then no class */
1093 /* with this name exists either. */
1094 if (!(atom = GlobalFindAtomA( lpszClass )))
1095 {
1096 SetLastError(ERROR_CANNOT_FIND_WND_CLASS);
1097 return 0;
1098 }
1099 }
1100 return Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, atom, (LPSTR)lpszWindow);
1101}
1102/*****************************************************************************
1103 * Name : HWND WIN32API FindWindowExW
1104 * Purpose : The FindWindowEx function retrieves the handle of a window whose
1105 * class name and window name match the specified strings. The
1106 * function searches child windows, beginning with the one following
1107 * the given child window.
1108 * Parameters: HWND hwndParent handle of parent window
1109 * HWND hwndChildAfter handle of a child window
1110 * LPCTSTR lpszClass address of class name
1111 * LPCTSTR lpszWindow address of window name
1112 * Variables :
1113 * Result : If the function succeeds, the return value is the handle of the
1114 * window that has the specified class and window names.
1115 * If the function fails, the return value is NULL. To get extended
1116 * error information, call GetLastError.
1117 * Remark :
1118 *
1119 *****************************************************************************/
1120
1121HWND WIN32API FindWindowExW(HWND hwndParent,
1122 HWND hwndChildAfter,
1123 LPCWSTR lpszClass,
1124 LPCWSTR lpszWindow)
1125{
1126 ATOM atom = 0;
1127 char *buffer;
1128 HWND hwnd;
1129
1130 if (lpszClass)
1131 {
1132 /* If the atom doesn't exist, then no class */
1133 /* with this name exists either. */
1134 if (!(atom = GlobalFindAtomW( lpszClass )))
1135 {
1136 SetLastError(ERROR_CANNOT_FIND_WND_CLASS);
1137 return 0;
1138 }
1139 }
1140 buffer = HEAP_strdupWtoA( GetProcessHeap(), 0, lpszWindow );
1141 hwnd = Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, atom, buffer);
1142 HeapFree( GetProcessHeap(), 0, buffer );
1143 return hwnd;
1144}
1145//******************************************************************************
1146//******************************************************************************
1147BOOL WIN32API FlashWindow(HWND hwnd, BOOL fFlash)
1148{
1149 dprintf(("FlashWindow %x %d\n", hwnd, fFlash));
1150// return OSLibWinFlashWindow(Win32BaseWindow::Win32ToOS2Handle(hwnd), fFlash);
1151 return 1;
1152}
1153//******************************************************************************
1154//******************************************************************************
1155BOOL WIN32API MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
1156 BOOL repaint )
1157{
1158 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
1159
1160 if (!repaint) flags |= SWP_NOREDRAW;
1161 dprintf(("MoveWindow: %x %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint ));
1162
1163 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
1164}
1165//******************************************************************************
1166//******************************************************************************
1167BOOL WIN32API ClientToScreen (HWND hwnd, PPOINT pt)
1168{
1169 Win32BaseWindow *wnd;
1170 PRECT rcl;
1171
1172 if (!hwnd) {
1173 SetLastError(ERROR_INVALID_PARAMETER);
1174 return (FALSE);
1175 }
1176 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1177 if (!wnd) {
1178 dprintf(("warning: ClientToScreen window %x not found!", hwnd));
1179 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1180 return (FALSE);
1181 }
1182#ifdef DEBUG
1183 POINT tmp = *pt;
1184#endif
1185 MapWindowPoints(hwnd, 0, pt, 1);
1186 dprintf2(("ClientToScreen %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y));
1187
1188 return TRUE;
1189}
1190//******************************************************************************
1191//Note: count 0 is a legal parameter (verified in NT4)
1192//******************************************************************************
1193HDWP WIN32API BeginDeferWindowPos(int count)
1194{
1195 HDWP handle;
1196 DWP *pDWP;
1197
1198 if (count < 0)
1199 {
1200 dprintf(("USER32: BeginDeferWindowPos invalid param %d", count));
1201 SetLastError(ERROR_INVALID_PARAMETER);
1202 return 0;
1203 }
1204 dprintf(("USER32: BeginDeferWindowPos %d", count));
1205 if(count == 0)
1206 count = 8; // change to any non-zero value
1207
1208 handle = (HDWP)HeapAlloc(GetProcessHeap(), 0, sizeof(DWP) + (count-1)*sizeof(WINDOWPOS));
1209 if (!handle)
1210 return 0;
1211
1212 pDWP = (DWP *) handle;
1213 pDWP->actualCount = 0;
1214 pDWP->suggestedCount = count;
1215 pDWP->valid = TRUE;
1216 pDWP->wMagic = DWP_MAGIC;
1217 pDWP->hwndParent = 0;
1218 return handle;
1219}
1220/***********************************************************************
1221 * DeferWindowPos (USER32.128)
1222 *
1223 * TODO: SvL: Does this need to be thread safe?
1224 *
1225 */
1226HDWP WIN32API DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
1227 INT x, INT y, INT cx, INT cy,
1228 UINT flags )
1229{
1230 DWP *pDWP;
1231 int i;
1232 HDWP newhdwp = hdwp,retvalue;
1233 Win32BaseWindow *window;
1234
1235 pDWP = (DWP *)hdwp;
1236 if (!pDWP) {
1237 SetLastError(ERROR_INVALID_PARAMETER);
1238 return 0;
1239 }
1240
1241 if (hwnd == GetDesktopWindow())
1242 return 0;
1243
1244 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1245 if(!window) {
1246 dprintf(("DeferWindowPos, window %x not found", hwnd));
1247 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1248 HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
1249 return 0;
1250 }
1251
1252 dprintf(("USER32: DeferWindowPos hdwp %x hwnd %x hwndAfter %x (%d,%d)(%d,%d) %x", hdwp, hwnd, hwndAfter,
1253 x, y, cx, cy, flags));
1254
1255/* Numega Bounds Checker Demo dislikes the following code.
1256 In fact, I've not been able to find any "same parent" requirement in any docu
1257 [AM 980509]
1258 */
1259#if 0
1260 /* All the windows of a DeferWindowPos() must have the same parent */
1261 parent = pWnd->parent->hwndSelf;
1262 if (pDWP->actualCount == 0) pDWP->hwndParent = parent;
1263 else if (parent != pDWP->hwndParent)
1264 {
1265 USER_HEAP_FREE( hdwp );
1266 retvalue = 0;
1267 goto END;
1268 }
1269#endif
1270
1271 for (i = 0; i < pDWP->actualCount; i++)
1272 {
1273 if (pDWP->winPos[i].hwnd == hwnd)
1274 {
1275 /* Merge with the other changes */
1276 if (!(flags & SWP_NOZORDER))
1277 {
1278 pDWP->winPos[i].hwndInsertAfter = hwndAfter;
1279 }
1280 if (!(flags & SWP_NOMOVE))
1281 {
1282 pDWP->winPos[i].x = x;
1283 pDWP->winPos[i].y = y;
1284 }
1285 if (!(flags & SWP_NOSIZE))
1286 {
1287 pDWP->winPos[i].cx = cx;
1288 pDWP->winPos[i].cy = cy;
1289 }
1290 pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
1291 SWP_NOZORDER | SWP_NOREDRAW |
1292 SWP_NOACTIVATE | SWP_NOCOPYBITS|
1293 SWP_NOOWNERZORDER);
1294 pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
1295 SWP_FRAMECHANGED);
1296 retvalue = hdwp;
1297 goto END;
1298 }
1299 }
1300 if (pDWP->actualCount >= pDWP->suggestedCount)
1301 {
1302 //DWP structure already contains WINDOWPOS, allocated with (count-1)
1303 //in BeginDeferWindowPos; pDWP->suggestedCount alloc increases it by one
1304 newhdwp = (HDWP)HeapReAlloc(GetProcessHeap(), 0, (LPVOID)hdwp,
1305 sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS));
1306 if (!newhdwp)
1307 {
1308 retvalue = 0;
1309 goto END;
1310 }
1311 pDWP = (DWP *) newhdwp;
1312 pDWP->suggestedCount++;
1313 }
1314 pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
1315 pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
1316 pDWP->winPos[pDWP->actualCount].x = x;
1317 pDWP->winPos[pDWP->actualCount].y = y;
1318 pDWP->winPos[pDWP->actualCount].cx = cx;
1319 pDWP->winPos[pDWP->actualCount].cy = cy;
1320 pDWP->winPos[pDWP->actualCount].flags = flags;
1321 pDWP->actualCount++;
1322 retvalue = newhdwp;
1323END:
1324 return retvalue;
1325}
1326//******************************************************************************
1327//******************************************************************************
1328BOOL WIN32API EndDeferWindowPos( HDWP hdwp)
1329{
1330 DWP *pDWP;
1331 WINDOWPOS *winpos;
1332 BOOL res = TRUE;
1333 int i;
1334
1335 pDWP = (DWP *) hdwp;
1336 if (!pDWP) {
1337 dprintf(("**EndDeferWindowPos invalid parameter\n"));
1338 SetLastError(ERROR_INVALID_PARAMETER);
1339 return FALSE;
1340 }
1341 dprintf(("**EndDeferWindowPos for %d windows", pDWP->actualCount));
1342 for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
1343 {
1344 dprintf(("**EndDeferWindowPos %x (%d,%d) (%d,%d) %x", winpos->hwnd, winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags));
1345 if (!(res = SetWindowPos(winpos->hwnd, winpos->hwndInsertAfter,
1346 winpos->x, winpos->y, winpos->cx,
1347 winpos->cy, winpos->flags )))
1348 break;
1349 }
1350 dprintf(("**EndDeferWindowPos DONE"));
1351 HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
1352 return res;
1353}
1354//******************************************************************************
1355//******************************************************************************
1356HWND WIN32API ChildWindowFromPoint( HWND hwnd, POINT pt)
1357{
1358 dprintf(("USER32: ChildWindowFromPoint\n"));
1359 return ChildWindowFromPointEx(hwnd, pt, 0);
1360}
1361/*****************************************************************************
1362 * Name : HWND WIN32API ChildWindowFromPointEx
1363 * Purpose : pt: client coordinates
1364 * Parameters:
1365 * Variables :
1366 * Result : If the function succeeds, the return value is the window handle.
1367 * If the function fails, the return value is zero
1368 * Remark :
1369 * Status : COMPLETELY IMPLEMENTED AND TESTED
1370 *
1371 * Author : Rene Pronk [Sun, 1999/08/08 23:30]
1372 *****************************************************************************/
1373HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
1374{
1375 RECT rect;
1376 HWND hWnd;
1377
1378 dprintf(("ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n",
1379 hwndParent, pt, uFlags));
1380
1381 if (GetWindowRect (hwndParent, &rect) == 0) {
1382 // oops, invalid handle
1383 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1384 return NULL;
1385 }
1386
1387 ClientToScreen(hwndParent, &pt);
1388 if (PtInRect (&rect, pt) == 0) {
1389 // point is outside window
1390 return NULL;
1391 }
1392
1393 // get first child
1394 hWnd = GetWindow (hwndParent, GW_CHILD);
1395
1396 while (hWnd != NULL)
1397 {
1398 // do I need to skip this window?
1399 if (((uFlags & CWP_SKIPINVISIBLE) &&
1400 (IsWindowVisible (hWnd) == FALSE)) ||
1401 ((uFlags & CWP_SKIPDISABLED) &&
1402 (IsWindowEnabled (hWnd) == FALSE)) ||
1403 ((uFlags & CWP_SKIPTRANSPARENT) &&
1404 (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
1405 {
1406 hWnd = GetWindow (hWnd, GW_HWNDNEXT);
1407 continue;
1408 }
1409
1410 // is the point in this window's rect?
1411 GetWindowRect (hWnd, &rect);
1412 if (PtInRect (&rect,pt) == FALSE) {
1413 hWnd = GetWindow (hWnd, GW_HWNDNEXT);
1414 continue;
1415 }
1416
1417 dprintf(("ChildWindowFromPointEx returned %x", hWnd));
1418 // found it!
1419 return hWnd;
1420 }
1421 // the point is in the parentwindow but the parentwindow has no child
1422 // at this coordinate
1423 dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent));
1424 return hwndParent;
1425}
1426//******************************************************************************
1427//******************************************************************************
1428BOOL WIN32API CloseWindow(HWND hwnd)
1429{
1430 Win32BaseWindow *window;
1431
1432 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1433 if(!window) {
1434 dprintf(("CloseWindow, window %x not found", hwnd));
1435 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1436 return 0;
1437 }
1438 dprintf(("CloseWindow %x\n", hwnd));
1439 return window->CloseWindow();
1440}
1441//******************************************************************************
1442//TODO: Does this return handles of hidden or disabled windows?
1443//******************************************************************************
1444HWND WIN32API WindowFromPoint( POINT point)
1445{
1446#if 0
1447 INT hittest = HTERROR;
1448 HWND retvalue = 0;
1449 HWND hwnd = GetDesktopWindow();
1450 DWORD dwStyle;
1451 RECT rectWindow, rectClient;
1452 Win32BaseWindow *window;
1453
1454 dprintf(("WindowFromPoint (%d,%d)", point.x, point.y));
1455
1456 while(hwnd)
1457 {
1458 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1459
1460 /* If point is in window, and window is visible, and it */
1461 /* is enabled (or it's a top-level window), then explore */
1462 /* its children. Otherwise, go to the next window. */
1463 dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
1464
1465 if ((dwStyle & WS_VISIBLE) && (!(dwStyle & WS_DISABLED) ||
1466 ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)))
1467 {
1468 GetWindowRect(hwnd, &rectWindow);
1469 if(PtInRect(&rectWindow, point) == TRUE)
1470 {
1471 /* If window is minimized or disabled, return at once */
1472 if(dwStyle & WS_MINIMIZE)
1473 {
1474 break;
1475 }
1476 if(dwStyle & WS_DISABLED)
1477 {
1478 break;
1479 }
1480 retvalue = hwnd;
1481
1482 GetClientRect(hwnd, &rectClient);
1483 InflateRect(&rectClient, rectWindow.left, rectWindow.top);
1484
1485 /* If point is not in client area, ignore the children */
1486 if(PtInRect(&rectClient, point) == FALSE) {
1487 break;
1488 }
1489 if(window->getFirstChild()) {
1490 hwnd = ((Win32BaseWindow *)window->getFirstChild())->getWindowHandle();
1491 }
1492 else break;
1493 }
1494 else
1495 {
1496 if(window->getNextChild()) {
1497 hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle();
1498 }
1499 else hwnd = 0;
1500 }
1501 }
1502 else
1503 {
1504 if(window->getNextChild()) {
1505 hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle();
1506 }
1507 else hwnd = 0;
1508 }
1509 }
1510
1511 dprintf(("WindowFromPoint (%d,%d) -> %x", point.x, point.y, hwnd));
1512 return retvalue;
1513#else
1514 HWND hwndOS2, hwnd;
1515 POINT wPoint;
1516
1517 wPoint.x = point.x;
1518 wPoint.y = mapScreenY(point.y);
1519
1520 hwndOS2 = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&wPoint);
1521 if(hwndOS2)
1522 {
1523 hwnd = Win32BaseWindow::OS2ToWin32Handle(hwndOS2);
1524 if(hwnd) {
1525 dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
1526 return hwnd;
1527 }
1528 }
1529 dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2));
1530 return windowDesktop->getWindowHandle();
1531#endif
1532}
1533//******************************************************************************
1534//******************************************************************************
1535BOOL WIN32API IsWindowUnicode(HWND hwnd)
1536{
1537 Win32BaseWindow *window;
1538
1539 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1540 if(!window) {
1541 dprintf(("IsWindowUnicode, window %x not found", hwnd));
1542 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1543 return 0;
1544 }
1545 return window->IsWindowUnicode();
1546}
1547/***********************************************************************
1548 * SwitchToThisWindow (USER32.539)
1549 */
1550DWORD WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
1551{
1552 return ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
1553}
1554//******************************************************************************
1555//******************************************************************************
1556BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
1557{
1558 return windowDesktop->EnumThreadWindows(dwThreadId, lpfn, lParam);
1559}
1560//******************************************************************************
1561//******************************************************************************
1562BOOL WIN32API EnumChildWindows(HWND hwnd, WNDENUMPROC lpfn, LPARAM lParam)
1563{
1564 Win32BaseWindow *window;
1565 BOOL rc = TRUE;
1566 ULONG henum;
1567 HWND hwndNext;
1568
1569 if(lpfn == NULL) {
1570 dprintf(("EnumChildWindows invalid parameter %x %x\n", hwnd, lParam));
1571 SetLastError(ERROR_INVALID_PARAMETER);
1572 return FALSE;
1573 }
1574 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1575 if(!window) {
1576 dprintf(("EnumChildWindows, window %x not found", hwnd));
1577 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1578 return FALSE;
1579 }
1580 return window->EnumChildWindows(lpfn, lParam);
1581}
1582//******************************************************************************
1583//******************************************************************************
1584BOOL WIN32API EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
1585{
1586 return windowDesktop->EnumWindows(lpfn, lParam);
1587}
1588//******************************************************************************
1589//******************************************************************************
1590UINT WIN32API ArrangeIconicWindows( HWND hwnd)
1591{
1592 dprintf(("USER32: ArrangeIconicWindows %x", hwnd));
1593 return O32_ArrangeIconicWindows(Win32BaseWindow::Win32ToOS2Handle(hwnd));
1594}
1595//******************************************************************************
1596//restores iconized window to previous size/position
1597//******************************************************************************
1598BOOL WIN32API OpenIcon(HWND hwnd)
1599{
1600 dprintf(("USER32: OpenIcon %x", hwnd));
1601
1602 if(!IsIconic(hwnd))
1603 return FALSE;
1604 ShowWindow(hwnd, SW_SHOWNORMAL);
1605 return TRUE;
1606}
1607//******************************************************************************
1608//SDK: Windows can only be shown with ShowOwnedPopups if they were previously
1609// hidden with the same api
1610//TODO: -> needs testing
1611//******************************************************************************
1612BOOL WIN32API ShowOwnedPopups(HWND hwndOwner, BOOL fShow)
1613{
1614 Win32BaseWindow *window, *owner;
1615 HWND hwnd;
1616
1617 owner = Win32BaseWindow::GetWindowFromHandle(hwndOwner);
1618 if(!owner) {
1619 dprintf(("ShowOwnedPopups, window %x not found", hwndOwner));
1620 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1621 return FALSE;
1622 }
1623 dprintf(("USER32: ShowOwnedPopups %x %d", hwnd, fShow));
1624
1625 hwnd = GetWindow(GetDesktopWindow(), GW_CHILD);
1626 while(hwnd) {
1627 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1628 if(window) {
1629 if(window == owner && (window->getStyle() & WS_POPUP))
1630 {
1631 if(fShow) {
1632 if(window->getFlags() & WIN_NEEDS_SHOW_OWNEDPOPUP)
1633 {
1634 /*
1635 * In Windows, ShowOwnedPopups(TRUE) generates WM_SHOWWINDOW messages with SW_PARENTOPENING,
1636 * regardless of the state of the owner
1637 */
1638 SendMessageA(hwnd, WM_SHOWWINDOW, SW_SHOW, SW_PARENTOPENING);
1639 window->setFlags(window->getFlags() & ~WIN_NEEDS_SHOW_OWNEDPOPUP);
1640 }
1641 }
1642 else
1643 {
1644 if(IsWindowVisible(hwnd))
1645 {
1646 /*
1647 * In Windows, ShowOwnedPopups(FALSE) generates WM_SHOWWINDOW messages with SW_PARENTCLOSING,
1648 * regardless of the state of the owner
1649 */
1650 SendMessageA(hwnd, WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING);
1651 window->setFlags(window->getFlags() | WIN_NEEDS_SHOW_OWNEDPOPUP);
1652 }
1653 }
1654 }
1655 }
1656 else dprintf(("WARNING: window %x is not valid", hwnd));
1657
1658 hwnd = GetWindow(hwnd, GW_HWNDNEXT);
1659 }
1660 return TRUE;
1661}
1662//******************************************************************************
1663//******************************************************************************
1664HWND WIN32API GetForegroundWindow(void)
1665{
1666 HWND hwnd;
1667
1668 hwnd = Win32BaseWindow::OS2ToWin32Handle(OSLibWinQueryActiveWindow());
1669 dprintf(("USER32: GetForegroundWindow returned %x", hwnd));
1670 return hwnd;
1671}
1672//******************************************************************************
1673//******************************************************************************
1674HWND WIN32API GetLastActivePopup( HWND hWnd)
1675{
1676 HWND hwnd;
1677
1678 hwnd = Win32BaseWindow::Win32ToOS2Handle(hWnd);
1679 hwnd = Win32BaseWindow::OS2ToWin32Handle(O32_GetLastActivePopup(hwnd));
1680
1681 dprintf(("GetLastActivePopup %x returned %x NOT CORRECTLY IMPLEMENTED", hWnd, hwnd));
1682 return hwnd;
1683}
1684//******************************************************************************
1685//******************************************************************************
1686DWORD WIN32API GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
1687{
1688 dprintf2(("USER32: GetWindowThreadProcessId"));
1689 hWnd = Win32BaseWindow::Win32ToOS2Handle(hWnd);
1690
1691 return O32_GetWindowThreadProcessId(hWnd,lpdwProcessId);
1692}
1693//******************************************************************************
1694//******************************************************************************
1695DWORD WIN32API GetWindowContextHelpId(HWND hwnd)
1696{
1697 Win32BaseWindow *window;
1698
1699 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1700 if(!window) {
1701 dprintf(("GetWindowContextHelpId, window %x not found", hwnd));
1702 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1703 return 0;
1704 }
1705 dprintf(("GetWindowContextHelpId %x", hwnd));
1706 return window->getWindowContextHelpId();
1707}
1708//******************************************************************************
1709//******************************************************************************
1710BOOL WIN32API SetWindowContextHelpId(HWND hwnd, DWORD dwContextHelpId)
1711{
1712 Win32BaseWindow *window;
1713
1714 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1715 if(!window) {
1716 dprintf(("SetWindowContextHelpId, window %x not found", hwnd));
1717 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1718 return 0;
1719 }
1720 dprintf(("SetWindowContextHelpId %x %d", hwnd, dwContextHelpId));
1721 window->setWindowContextHelpId(dwContextHelpId);
1722 return(TRUE);
1723}
1724//******************************************************************************
1725//******************************************************************************
1726HANDLE WINAPI GetPropA( HWND hwnd, LPCSTR str )
1727{
1728 Win32BaseWindow *window;
1729
1730 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1731 if(!window) {
1732 dprintf(("GetPropA, window %x not found", hwnd));
1733 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1734 return 0;
1735 }
1736 return window->getProp(str);
1737}
1738//******************************************************************************
1739//******************************************************************************
1740HANDLE WINAPI GetPropW( HWND hwnd, LPCWSTR str )
1741{
1742 LPSTR strA;
1743 HANDLE ret;
1744
1745 if (!HIWORD(str)) return GetPropA( hwnd, (LPCSTR)(UINT)LOWORD(str) );
1746 strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
1747 ret = GetPropA( hwnd, strA );
1748 HeapFree( GetProcessHeap(), 0, strA );
1749 return ret;
1750}
1751//******************************************************************************
1752//******************************************************************************
1753BOOL WINAPI SetPropA( HWND hwnd, LPCSTR str, HANDLE handle )
1754{
1755 Win32BaseWindow *window;
1756
1757 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1758 if(!window) {
1759 dprintf(("SetPropA, window %x not found", hwnd));
1760 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1761 return FALSE;
1762 }
1763 return window->setProp(str, handle);
1764}
1765//******************************************************************************
1766//******************************************************************************
1767BOOL WINAPI SetPropW( HWND hwnd, LPCWSTR str, HANDLE handle )
1768{
1769 BOOL ret;
1770 LPSTR strA;
1771
1772 if (!HIWORD(str))
1773 return SetPropA( hwnd, (LPCSTR)(UINT)LOWORD(str), handle );
1774 strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
1775 ret = SetPropA( hwnd, strA, handle );
1776 HeapFree( GetProcessHeap(), 0, strA );
1777 return ret;
1778}
1779//******************************************************************************
1780//******************************************************************************
1781HANDLE WINAPI RemovePropA( HWND hwnd, LPCSTR str )
1782{
1783 Win32BaseWindow *window;
1784
1785 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1786 if(!window) {
1787 dprintf(("RemovePropA, window %x not found", hwnd));
1788 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1789 return 0;
1790 }
1791 return window->removeProp(str);
1792}
1793//******************************************************************************
1794//******************************************************************************
1795HANDLE WINAPI RemovePropW( HWND hwnd, LPCWSTR str )
1796{
1797 LPSTR strA;
1798 HANDLE ret;
1799
1800 if (!HIWORD(str))
1801 return RemovePropA( hwnd, (LPCSTR)(UINT)LOWORD(str) );
1802 strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
1803 ret = RemovePropA( hwnd, strA );
1804 HeapFree( GetProcessHeap(), 0, strA );
1805 return ret;
1806}
1807//******************************************************************************
1808//******************************************************************************
1809INT WINAPI EnumPropsA( HWND hwnd, PROPENUMPROCA func )
1810{
1811 return EnumPropsExA( hwnd, (PROPENUMPROCEXA)func, 0 );
1812}
1813//******************************************************************************
1814//******************************************************************************
1815INT WINAPI EnumPropsW( HWND hwnd, PROPENUMPROCW func )
1816{
1817 return EnumPropsExW( hwnd, (PROPENUMPROCEXW)func, 0 );
1818}
1819//******************************************************************************
1820//******************************************************************************
1821INT WINAPI EnumPropsExA(HWND hwnd, PROPENUMPROCEXA func, LPARAM lParam)
1822{
1823 Win32BaseWindow *window;
1824
1825 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1826 if(!window) {
1827 dprintf(("EnumPropsExA, window %x not found", hwnd));
1828 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1829 return -1;
1830 }
1831 return window->enumPropsExA(func, lParam);
1832}
1833//******************************************************************************
1834//******************************************************************************
1835INT WINAPI EnumPropsExW(HWND hwnd, PROPENUMPROCEXW func, LPARAM lParam)
1836{
1837 Win32BaseWindow *window;
1838
1839 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1840 if(!window) {
1841 dprintf(("EnumPropsExA, window %x not found", hwnd));
1842 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1843 return -1;
1844 }
1845 return window->enumPropsExW(func, lParam);
1846}
1847//******************************************************************************
1848//******************************************************************************
Note: See TracBrowser for help on using the repository browser.