mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +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.
|
* Display a popup menu.
|
||||||
*/
|
*/
|
||||||
static BOOL FASTCALL
|
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 )
|
INT X, INT Y, INT XAnchor, INT YAnchor )
|
||||||
{
|
{
|
||||||
ROSMENUINFO MenuInfo;
|
ROSMENUINFO MenuInfo;
|
||||||
ROSMENUITEMINFO ItemInfo;
|
ROSMENUITEMINFO ItemInfo;
|
||||||
UINT Width, Height;
|
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",
|
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);
|
WndOwner, Menu, Id, X, Y, XAnchor, YAnchor);
|
||||||
|
@ -1967,38 +1970,40 @@ MenuShowPopup(HWND WndOwner, HMENU Menu, UINT Id,
|
||||||
Width = MenuInfo.Width + GetSystemMetrics(SM_CXBORDER);
|
Width = MenuInfo.Width + GetSystemMetrics(SM_CXBORDER);
|
||||||
Height = MenuInfo.Height + GetSystemMetrics(SM_CYBORDER);
|
Height = MenuInfo.Height + GetSystemMetrics(SM_CYBORDER);
|
||||||
|
|
||||||
if (GetSystemMetrics(SM_CXSCREEN ) < X + Width)
|
/* FIXME: should use item rect */
|
||||||
{
|
pt.x = X;
|
||||||
if (0 != XAnchor && X >= Width - XAnchor)
|
pt.y = Y;
|
||||||
{
|
monitor = MonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST );
|
||||||
X -= Width - XAnchor;
|
info.cbSize = sizeof(info);
|
||||||
}
|
GetMonitorInfoW( monitor, &info );
|
||||||
if (GetSystemMetrics(SM_CXSCREEN) < X + Width)
|
|
||||||
{
|
|
||||||
X = GetSystemMetrics(SM_CXSCREEN) - Width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (X < 0 )
|
|
||||||
{
|
|
||||||
X = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetSystemMetrics(SM_CYSCREEN) < Y + Height)
|
if( flags & TPM_RIGHTALIGN ) X -= Width;
|
||||||
{
|
if( flags & TPM_CENTERALIGN ) X -= Width / 2;
|
||||||
if (0 != YAnchor && Y >= Height + YAnchor)
|
|
||||||
{
|
if( flags & TPM_BOTTOMALIGN ) Y -= Height;
|
||||||
Y -= Height + YAnchor;
|
if( flags & TPM_VCENTERALIGN ) Y -= Height / 2;
|
||||||
}
|
|
||||||
if (GetSystemMetrics(SM_CYSCREEN) < Y + Height)
|
|
||||||
{
|
|
||||||
Y = GetSystemMetrics(SM_CYSCREEN) - Height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Y < 0 )
|
|
||||||
{
|
|
||||||
Y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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. */
|
/* NOTE: In Windows, top menu popup is not owned. */
|
||||||
MenuInfo.Wnd = CreateWindowExW(0, POPUPMENU_CLASS_ATOMW, NULL,
|
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 );
|
Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||||
if (SelectFirst && MenuGetRosMenuInfo(&SubMenuInfo, ItemInfo.hSubMenu))
|
if (SelectFirst && MenuGetRosMenuInfo(&SubMenuInfo, ItemInfo.hSubMenu))
|
||||||
{
|
{
|
||||||
|
@ -3389,8 +3394,13 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y,
|
||||||
SetCapture(Mt.OwnerWnd);
|
SetCapture(Mt.OwnerWnd);
|
||||||
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, Mt.OwnerWnd);
|
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, Mt.OwnerWnd);
|
||||||
|
|
||||||
|
ERR("MenuTrackMenu 1\n");
|
||||||
while (! fEndMenu)
|
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
|
/* we have to keep the message in the queue until it's
|
||||||
* clear that menu loop is not over yet. */
|
* 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;
|
Mt.TrackFlags &= ~TF_SKIPREMOVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ERR("MenuTrackMenu 2\n");
|
||||||
|
|
||||||
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, NULL);
|
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, NULL);
|
||||||
SetCapture(NULL); /* release the capture */
|
SetCapture(NULL); /* release the capture */
|
||||||
|
@ -4787,9 +4798,8 @@ WINAPI
|
||||||
IsMenu(
|
IsMenu(
|
||||||
HMENU Menu)
|
HMENU Menu)
|
||||||
{
|
{
|
||||||
ROSMENUINFO MenuInfo;
|
if (ValidateHandle(Menu, VALIDATE_TYPE_MENU)) return TRUE;
|
||||||
|
return FALSE;
|
||||||
return MenuGetRosMenuInfo(&MenuInfo, Menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5205,12 +5215,11 @@ TrackPopupMenu(
|
||||||
SendMessageW(Wnd, WM_INITMENUPOPUP, (WPARAM) Menu, 0);
|
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);
|
ret = MenuTrackMenu(Menu, Flags | TPM_POPUPMENU, 0, 0, Wnd, Rect);
|
||||||
}
|
}
|
||||||
MenuExitTracking(Wnd);
|
MenuExitTracking(Wnd);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue