Implement ShowOwnedPopups and ArrangeIconicWindows. Based on Wine.
Modified: trunk/reactos/subsys/win32k/include/window.h
Modified: trunk/reactos/subsys/win32k/include/winpos.h
Modified: trunk/reactos/subsys/win32k/ntuser/misc.c
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c
_____
Modified: trunk/reactos/subsys/win32k/include/window.h
--- trunk/reactos/subsys/win32k/include/window.h 2005-07-17
19:20:12 UTC (rev 16628)
+++ trunk/reactos/subsys/win32k/include/window.h 2005-07-18
03:12:01 UTC (rev 16629)
@@ -228,6 +228,9 @@
DWORD IntRemoveProcessWndProcHandles(HANDLE ProcessID);
DWORD IntAddWndProcHandle(WNDPROC WindowProc, BOOL IsUnicode);
+BOOL FASTCALL
+IntShowOwnedPopups( HWND owner, BOOL fShow );
+
#endif /* _WIN32K_WINDOW_H */
/* EOF */
_____
Modified: trunk/reactos/subsys/win32k/include/winpos.h
--- trunk/reactos/subsys/win32k/include/winpos.h 2005-07-17
19:20:12 UTC (rev 16628)
+++ trunk/reactos/subsys/win32k/include/winpos.h 2005-07-18
03:12:01 UTC (rev 16629)
@@ -14,6 +14,8 @@
NtGdiPtInRegion((WndObject)->WindowRegion, (INT)((x) -
(WndObject)->WindowRect.left), \
(INT)((y) - (WndObject)->WindowRect.top))))
+UINT
+FASTCALL WinPosArrangeIconicWindows(PWINDOW_OBJECT parent);
BOOL FASTCALL
IntGetClientOrigin(HWND hWnd, LPPOINT Point);
LRESULT FASTCALL
_____
Modified: trunk/reactos/subsys/win32k/ntuser/misc.c
--- trunk/reactos/subsys/win32k/ntuser/misc.c 2005-07-17 19:20:12 UTC
(rev 16628)
+++ trunk/reactos/subsys/win32k/ntuser/misc.c 2005-07-18 03:12:01 UTC
(rev 16629)
@@ -11,7 +11,7 @@
#include <w32k.h>
-#define NDEBUG
+#define DEBUG
#include <debug.h>
/* registered Logon process */
@@ -453,9 +453,32 @@
return 0;
case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS:
- UNIMPLEMENTED
- return 0;
+ return (DWORD)IntShowOwnedPopups((HWND) Param1, (BOOL)
Param2);
+ case TWOPARAM_ROUTINE_ROS_SHOWWINDOW:
+ {
+#define WIN_NEEDS_SHOW_OWNEDPOPUP (0x00000040)
+ PWINDOW_OBJECT Window = IntGetWindowObject((HWND)Param1);
+ DPRINT1("ROS_SHOWWINDOW\n");
+ if (Window == 0)
+ {
+ SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
+ return FALSE;
+ }
+ if (Param2)
+ {
+ if (!(Window->Flags & WIN_NEEDS_SHOW_OWNEDPOPUP))
+ {
+ IntReleaseWindowObject(Window);
+ return TRUE;
+ }
+ Window->Flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP;
+ }
+ else Window->Flags |= WIN_NEEDS_SHOW_OWNEDPOPUP;
+ DPRINT1("ROS_SHOWWINDOW ---> 0x%x\n",Window->Flags);
+ IntReleaseWindowObject(Window);
+ return TRUE;
+ }
case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW:
UNIMPLEMENTED
return 0;
@@ -570,6 +593,8 @@
ExFreePool(Buffer);
}
+
+
return Ret;
}
@@ -619,7 +644,6 @@
ExFreePool(Buffer.Pointer);
}
-
return Ret;
}
@@ -630,6 +654,7 @@
return 0;
}
+
/*
* @unimplemented
*/
@@ -653,7 +678,7 @@
switch (Routine)
{
case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS:
- /* FIXME */
+ WinPosArrangeIconicWindows(Window);
break;
case HWNDLOCK_ROUTINE_DRAWMENUBAR:
_____
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
--- trunk/reactos/subsys/win32k/ntuser/window.c 2005-07-17 19:20:12 UTC
(rev 16628)
+++ trunk/reactos/subsys/win32k/ntuser/window.c 2005-07-18 03:12:01 UTC
(rev 16629)
@@ -4314,4 +4314,65 @@
return TRUE;
}
+#define WIN_NEEDS_SHOW_OWNEDPOPUP (0x00000040)
+
+BOOL
+FASTCALL
+IntShowOwnedPopups( HWND owner, BOOL fShow )
+{
+ int count = 0;
+ PWINDOW_OBJECT Window, pWnd;
+ HWND *win_array;
+
+ if(!(Window = IntGetWindowObject(owner)))
+ {
+ SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
+ return FALSE;
+ }
+
+ win_array = IntWinListChildren( Window);
+ IntReleaseWindowObject(Window);
+
+ if (!win_array) return TRUE;
+
+ while (win_array[count]) count++;
+ while (--count >= 0)
+ {
+ if (NtUserGetWindow( win_array[count], GW_OWNER ) != owner)
continue;
+ if (!(pWnd = IntGetWindowObject( win_array[count] ))) continue;
+// if (pWnd == WND_OTHER_PROCESS) continue;
+
+ if (fShow)
+ {
+ if (pWnd->Flags & WIN_NEEDS_SHOW_OWNEDPOPUP)
+ {
+ IntReleaseWindowObject( pWnd );
+ /* In Windows, ShowOwnedPopups(TRUE) generates
+ * WM_SHOWWINDOW messages with SW_PARENTOPENING,
+ * regardless of the state of the owner
+ */
+ IntSendMessage(win_array[count], WM_SHOWWINDOW,
SW_SHOWNORMAL, SW_PARENTOPENING);
+ continue;
+ }
+ }
+ else
+ {
+ if (pWnd->Style & WS_VISIBLE)
+ {
+ IntReleaseWindowObject( pWnd );
+ /* In Windows, ShowOwnedPopups(FALSE) generates
+ * WM_SHOWWINDOW messages with SW_PARENTCLOSING,
+ * regardless of the state of the owner
+ */
+ IntSendMessage(win_array[count], WM_SHOWWINDOW,
SW_HIDE, SW_PARENTCLOSING);
+ continue;
+ }
+ }
+ IntReleaseWindowObject( pWnd );
+ }
+ ExFreePool( win_array );
+ return TRUE;
+}
+
+
/* EOF */
_____
Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c
--- trunk/reactos/subsys/win32k/ntuser/winpos.c 2005-07-17 19:20:12 UTC
(rev 16628)
+++ trunk/reactos/subsys/win32k/ntuser/winpos.c 2005-07-18 03:12:01 UTC
(rev 16629)
@@ -165,6 +165,47 @@
IntReleaseWindowObject(Wnd);
}
+
+UINT
+FASTCALL
+WinPosArrangeIconicWindows(PWINDOW_OBJECT parent)
+{
+ RECT rectParent;
+ HWND hwndChild;
+ INT i, x, y, xspacing, yspacing;
+ HWND *List = IntWinListChildren(parent);
+
+ IntGetClientRect( parent, &rectParent );
+ x = rectParent.left;
+ y = rectParent.bottom;
+
+ xspacing = NtUserGetSystemMetrics(SM_CXMINSPACING);
+ yspacing = NtUserGetSystemMetrics(SM_CYMINSPACING);
+
+ DPRINT("X:%d Y:%d XS:%d YS:%d\n",x,y,xspacing,yspacing);
+
+ for( i = 0; List[i]; i++)
+ {
+ hwndChild = List[i];
+
+ if((NtUserGetWindowLong( hwndChild, GWL_STYLE, FALSE) &
WS_MINIMIZE) != 0 )
+ {
+ WinPosSetWindowPos( hwndChild, 0, x +
NtUserGetSystemMetrics(SM_CXBORDER),
+ y - yspacing -
NtUserGetSystemMetrics(SM_CYBORDER)
+ , 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE
);
+ if (x <= rectParent.right - xspacing) x += xspacing;
+ else
+ {
+ x = rectParent.left;
+ y -= yspacing;
+ }
+ }
+ }
+ ExFreePool(List);
+ return yspacing;
+}
+
+
VOID STATIC FASTCALL
WinPosFindIconPos(PWINDOW_OBJECT Window, POINT *Pos)
{
@@ -1210,8 +1251,9 @@
ObmDereferenceObject(Window);
return(FALSE);
}
- Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE
|
- SWP_NOZORDER;
+ Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
+ if (Window->Self != NtUserGetActiveWindow())
+ Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
break;
}