Implement ShowOwnedPopups and ArrangeIconicWindows. Based on Wine.

svn path=/trunk/; revision=16629
This commit is contained in:
James Tabor 2005-07-18 03:12:01 +00:00
parent 0825640a24
commit 35b93a79d6
5 changed files with 140 additions and 7 deletions

View file

@ -228,6 +228,9 @@ DWORD IntRemoveWndProcHandle(WNDPROC Handle);
DWORD IntRemoveProcessWndProcHandles(HANDLE ProcessID);
DWORD IntAddWndProcHandle(WNDPROC WindowProc, BOOL IsUnicode);
BOOL FASTCALL
IntShowOwnedPopups( HWND owner, BOOL fShow );
#endif /* _WIN32K_WINDOW_H */
/* EOF */

View file

@ -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

View file

@ -11,7 +11,7 @@
#include <w32k.h>
#define NDEBUG
#define DEBUG
#include <debug.h>
/* registered Logon process */
@ -453,9 +453,32 @@ NtUserCallTwoParam(
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 @@ NtUserCallTwoParam(
ExFreePool(Buffer);
}
return Ret;
}
@ -619,7 +644,6 @@ NtUserCallTwoParam(
ExFreePool(Buffer.Pointer);
}
return Ret;
}
@ -630,6 +654,7 @@ NtUserCallTwoParam(
return 0;
}
/*
* @unimplemented
*/
@ -653,7 +678,7 @@ NtUserCallHwndLock(
switch (Routine)
{
case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS:
/* FIXME */
WinPosArrangeIconicWindows(Window);
break;
case HWNDLOCK_ROUTINE_DRAWMENUBAR:

View file

@ -4314,4 +4314,65 @@ IntRemoveProcessWndProcHandles(HANDLE ProcessID)
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 */

View file

@ -165,6 +165,47 @@ WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
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 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
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;
}