Commit effbadcb authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

TranslateAccelerator should only ignore commands when mouse capture is

in effect or the window is disabled, if the command corresponds to a menu item. Otherwise it should process them as normal.
parent 66c1accb
......@@ -4668,10 +4668,6 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
found:
if (message == WM_KEYUP || message == WM_SYSKEYUP)
mesg = 1;
else if (GetCapture())
mesg = 2;
else if (!IsWindowEnabled(hWnd))
mesg = 3;
else
{
HMENU hMenu, hSubMenu, hSysMenu;
......@@ -4686,14 +4682,21 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
nPos = cmd;
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
{
SendMessageW(hWnd, WM_INITMENU, (WPARAM)hSysMenu, 0L);
if(hSubMenu != hSysMenu)
if (GetCapture())
mesg = 2;
if (!IsWindowEnabled(hWnd))
mesg = 3;
else
{
nPos = MENU_FindSubMenu(&hSysMenu, hSubMenu);
TRACE_(accel)("hSysMenu = %p, hSubMenu = %p, nPos = %d\n", hSysMenu, hSubMenu, nPos);
SendMessageW(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
SendMessageW(hWnd, WM_INITMENU, (WPARAM)hSysMenu, 0L);
if(hSubMenu != hSysMenu)
{
nPos = MENU_FindSubMenu(&hSysMenu, hSubMenu);
TRACE_(accel)("hSysMenu = %p, hSubMenu = %p, nPos = %d\n", hSysMenu, hSubMenu, nPos);
SendMessageW(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
}
uSysStat = GetMenuState(GetSubMenu(hSysMenu, 0), cmd, MF_BYCOMMAND);
}
uSysStat = GetMenuState(GetSubMenu(hSysMenu, 0), cmd, MF_BYCOMMAND);
}
else /* 2. in the window's menu */
{
......@@ -4701,40 +4704,50 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
nPos = cmd;
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
{
SendMessageW(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
if(hSubMenu != hMenu)
if (GetCapture())
mesg = 2;
if (!IsWindowEnabled(hWnd))
mesg = 3;
else
{
nPos = MENU_FindSubMenu(&hMenu, hSubMenu);
TRACE_(accel)("hMenu = %p, hSubMenu = %p, nPos = %d\n", hMenu, hSubMenu, nPos);
SendMessageW(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE));
SendMessageW(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
if(hSubMenu != hMenu)
{
nPos = MENU_FindSubMenu(&hMenu, hSubMenu);
TRACE_(accel)("hMenu = %p, hSubMenu = %p, nPos = %d\n", hMenu, hSubMenu, nPos);
SendMessageW(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE));
}
uStat = GetMenuState(hMenu, cmd, MF_BYCOMMAND);
}
uStat = GetMenuState(hMenu, cmd, MF_BYCOMMAND);
}
}
if (uSysStat != (UINT)-1)
if (mesg == 0)
{
if (uSysStat & (MF_DISABLED|MF_GRAYED))
mesg=4;
else
mesg=WM_SYSCOMMAND;
}
else
{
if (uStat != (UINT)-1)
if (uSysStat != (UINT)-1)
{
if (IsIconic(hWnd))
mesg=5;
if (uSysStat & (MF_DISABLED|MF_GRAYED))
mesg=4;
else
mesg=WM_SYSCOMMAND;
}
else
{
if (uStat != (UINT)-1)
{
if (uStat & (MF_DISABLED|MF_GRAYED))
mesg=6;
if (IsIconic(hWnd))
mesg=5;
else
mesg=WM_COMMAND;
{
if (uStat & (MF_DISABLED|MF_GRAYED))
mesg=6;
else
mesg=WM_COMMAND;
}
}
else
mesg=WM_COMMAND;
}
else
mesg=WM_COMMAND;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment