mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
- [User32] Update MenuShowPopup with wine and add menu check for MenuTrackMenu. MenuTrackMenu menu check fixed the first stop with wine menu test.
svn path=/trunk/; revision=43803
This commit is contained in:
parent
7fcc966e35
commit
8a57208aae
|
@ -1928,12 +1928,15 @@ MenuInitTracking(HWND Wnd, HMENU Menu, BOOL Popup, UINT Flags)
|
|||
* Display a popup menu.
|
||||
*/
|
||||
static BOOL FASTCALL
|
||||
MenuShowPopup(HWND WndOwner, HMENU Menu, UINT Id,
|
||||
MenuShowPopup(HWND WndOwner, HMENU Menu, UINT Id, UINT flags,
|
||||
INT X, INT Y, INT XAnchor, INT YAnchor )
|
||||
{
|
||||
ROSMENUINFO MenuInfo;
|
||||
ROSMENUITEMINFO ItemInfo;
|
||||
UINT Width, Height;
|
||||
POINT pt;
|
||||
HMONITOR monitor;
|
||||
MONITORINFO info;
|
||||
|
||||
TRACE("owner=%x hmenu=%x id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x\n",
|
||||
WndOwner, Menu, Id, X, Y, XAnchor, YAnchor);
|
||||
|
@ -1967,38 +1970,40 @@ MenuShowPopup(HWND WndOwner, HMENU Menu, UINT Id,
|
|||
Width = MenuInfo.Width + GetSystemMetrics(SM_CXBORDER);
|
||||
Height = MenuInfo.Height + GetSystemMetrics(SM_CYBORDER);
|
||||
|
||||
if (GetSystemMetrics(SM_CXSCREEN ) < X + Width)
|
||||
{
|
||||
if (0 != XAnchor && X >= Width - XAnchor)
|
||||
{
|
||||
X -= Width - XAnchor;
|
||||
}
|
||||
if (GetSystemMetrics(SM_CXSCREEN) < X + Width)
|
||||
{
|
||||
X = GetSystemMetrics(SM_CXSCREEN) - Width;
|
||||
}
|
||||
}
|
||||
if (X < 0 )
|
||||
{
|
||||
X = 0;
|
||||
}
|
||||
/* FIXME: should use item rect */
|
||||
pt.x = X;
|
||||
pt.y = Y;
|
||||
monitor = MonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST );
|
||||
info.cbSize = sizeof(info);
|
||||
GetMonitorInfoW( monitor, &info );
|
||||
|
||||
if (GetSystemMetrics(SM_CYSCREEN) < Y + Height)
|
||||
{
|
||||
if (0 != YAnchor && Y >= Height + YAnchor)
|
||||
{
|
||||
Y -= Height + YAnchor;
|
||||
}
|
||||
if (GetSystemMetrics(SM_CYSCREEN) < Y + Height)
|
||||
{
|
||||
Y = GetSystemMetrics(SM_CYSCREEN) - Height;
|
||||
}
|
||||
}
|
||||
if (Y < 0 )
|
||||
{
|
||||
Y = 0;
|
||||
}
|
||||
if( flags & TPM_RIGHTALIGN ) X -= Width;
|
||||
if( flags & TPM_CENTERALIGN ) X -= Width / 2;
|
||||
|
||||
if( flags & TPM_BOTTOMALIGN ) Y -= Height;
|
||||
if( flags & TPM_VCENTERALIGN ) Y -= Height / 2;
|
||||
|
||||
if (X + Width > info.rcWork.right)
|
||||
{
|
||||
if ( XAnchor && X >= Width - XAnchor)
|
||||
X -= Width - XAnchor;
|
||||
|
||||
if ( X + Width > info.rcWork.right)
|
||||
X = info.rcWork.right - Width;
|
||||
}
|
||||
|
||||
if ( X < info.rcWork.left ) X = info.rcWork.left;
|
||||
|
||||
if (Y + Height > info.rcWork.bottom)
|
||||
{
|
||||
if ( YAnchor && Y >= Height + YAnchor)
|
||||
Y -= Height + YAnchor;
|
||||
|
||||
if ( Y + Height > info.rcWork.bottom)
|
||||
Y = info.rcWork.bottom - Height;
|
||||
}
|
||||
|
||||
if ( Y < info.rcWork.top ) Y = info.rcWork.top;
|
||||
|
||||
/* NOTE: In Windows, top menu popup is not owned. */
|
||||
MenuInfo.Wnd = CreateWindowExW(0, POPUPMENU_CLASS_ATOMW, NULL,
|
||||
|
@ -2413,7 +2418,7 @@ MenuShowSubPopup(HWND WndOwner, PROSMENUINFO MenuInfo, BOOL SelectFirst, UINT Fl
|
|||
}
|
||||
}
|
||||
|
||||
MenuShowPopup(WndOwner, ItemInfo.hSubMenu, MenuInfo->FocusedItem,
|
||||
MenuShowPopup(WndOwner, ItemInfo.hSubMenu, MenuInfo->FocusedItem, Flags,
|
||||
Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
if (SelectFirst && MenuGetRosMenuInfo(&SubMenuInfo, ItemInfo.hSubMenu))
|
||||
{
|
||||
|
@ -3389,8 +3394,13 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y,
|
|||
SetCapture(Mt.OwnerWnd);
|
||||
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, Mt.OwnerWnd);
|
||||
|
||||
ERR("MenuTrackMenu 1\n");
|
||||
while (! fEndMenu)
|
||||
{
|
||||
PVOID menu = ValidateHandle(Mt.CurrentMenu, VALIDATE_TYPE_MENU);
|
||||
if (!menu) /* sometimes happens if I do a window manager close */
|
||||
break;
|
||||
|
||||
/* we have to keep the message in the queue until it's
|
||||
* clear that menu loop is not over yet. */
|
||||
|
||||
|
@ -3665,6 +3675,7 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y,
|
|||
Mt.TrackFlags &= ~TF_SKIPREMOVE;
|
||||
}
|
||||
}
|
||||
ERR("MenuTrackMenu 2\n");
|
||||
|
||||
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, NULL);
|
||||
SetCapture(NULL); /* release the capture */
|
||||
|
@ -4787,9 +4798,8 @@ WINAPI
|
|||
IsMenu(
|
||||
HMENU Menu)
|
||||
{
|
||||
ROSMENUINFO MenuInfo;
|
||||
|
||||
return MenuGetRosMenuInfo(&MenuInfo, Menu);
|
||||
if (ValidateHandle(Menu, VALIDATE_TYPE_MENU)) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5205,12 +5215,11 @@ TrackPopupMenu(
|
|||
SendMessageW(Wnd, WM_INITMENUPOPUP, (WPARAM) Menu, 0);
|
||||
}
|
||||
|
||||
if (MenuShowPopup(Wnd, Menu, 0, x, y, 0, 0 ))
|
||||
if (MenuShowPopup(Wnd, Menu, 0, Flags, x, y, 0, 0 ))
|
||||
{
|
||||
ret = MenuTrackMenu(Menu, Flags | TPM_POPUPMENU, 0, 0, Wnd, Rect);
|
||||
}
|
||||
MenuExitTracking(Wnd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue