mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:25:48 +00:00
User32 Implement MenuTrackKbdMenuBar, it does work but, alt f works but hit alt again goes into a message loop. So hit alt f than esc esc. If hit alt f than alt v or something else the popup menu stays displayed until the program has terminated.
svn path=/trunk/; revision=23169
This commit is contained in:
parent
ed119adcef
commit
bf0906f9ed
3 changed files with 86 additions and 28 deletions
|
@ -17,6 +17,6 @@ MenuCleanup(VOID);
|
|||
VOID
|
||||
MenuTrackMouseMenuBar(HWND hWnd, ULONG Ht, POINT Pt);
|
||||
VOID
|
||||
MenuTrackKbdMenuBar(HWND hWnd, ULONG wParam, ULONG Key);
|
||||
MenuTrackKbdMenuBar(HWND hWnd, UINT wParam, WCHAR wChar);
|
||||
|
||||
#endif /* __LIB_USER32_INCLUDE_MENU_H */
|
||||
|
|
|
@ -766,9 +766,10 @@ DefWndTrackScrollBar(HWND Wnd, WPARAM wParam, POINT Pt)
|
|||
|
||||
|
||||
LRESULT
|
||||
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
|
||||
DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WINDOWPLACEMENT wp;
|
||||
POINT Pt;
|
||||
|
||||
switch (wParam & 0xfff0)
|
||||
{
|
||||
|
@ -804,16 +805,24 @@ DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
|
|||
SendMessageA(hWnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
case SC_MOUSEMENU:
|
||||
MenuTrackMouseMenuBar(hWnd, wParam & 0x000f, Pt);
|
||||
{
|
||||
Pt.x = (short)LOWORD(lParam);
|
||||
Pt.y = (short)HIWORD(lParam);
|
||||
MenuTrackMouseMenuBar(hWnd, wParam & 0x000f, Pt);
|
||||
}
|
||||
break;
|
||||
case SC_KEYMENU:
|
||||
MenuTrackKbdMenuBar(hWnd, wParam, Pt.x);
|
||||
MenuTrackKbdMenuBar(hWnd, wParam, (WCHAR)lParam);
|
||||
break;
|
||||
case SC_VSCROLL:
|
||||
case SC_HSCROLL:
|
||||
DefWndTrackScrollBar(hWnd, wParam, Pt);
|
||||
{
|
||||
Pt.x = (short)LOWORD(lParam);
|
||||
Pt.y = (short)HIWORD(lParam);
|
||||
DefWndTrackScrollBar(hWnd, wParam, Pt);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/* FIXME: Implement */
|
||||
UNIMPLEMENTED;
|
||||
|
@ -1305,13 +1314,7 @@ User32DefWindowProc(HWND hWnd,
|
|||
}
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
{
|
||||
POINT Pt;
|
||||
Pt.x = GET_X_LPARAM(lParam);
|
||||
Pt.y = GET_Y_LPARAM(lParam);
|
||||
return (DefWndHandleSysCommand(hWnd, wParam, Pt));
|
||||
}
|
||||
|
||||
return (DefWndHandleSysCommand(hWnd, wParam, lParam));
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if(wParam == VK_F10) iF10Key = VK_F10;
|
||||
|
|
|
@ -3320,9 +3320,13 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y,
|
|||
fRemove = TRUE; /* Keyboard messages are always removed */
|
||||
switch(Msg.message)
|
||||
{
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
switch(Msg.wParam)
|
||||
{
|
||||
case VK_MENU:
|
||||
fEndMenu = TRUE;
|
||||
break;
|
||||
case VK_HOME:
|
||||
case VK_END:
|
||||
if (MenuGetRosMenuInfo(&MenuInfo, Mt.CurrentMenu))
|
||||
|
@ -3408,20 +3412,6 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y,
|
|||
break;
|
||||
}
|
||||
break; /* WM_KEYDOWN */
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
switch (Msg.wParam)
|
||||
{
|
||||
DbgPrint("Menu.c WM_SYSKEYDOWN wPram %d\n",Msg.wParam);
|
||||
case VK_MENU:
|
||||
fEndMenu = TRUE;
|
||||
break;
|
||||
case VK_LMENU:
|
||||
fEndMenu = TRUE;
|
||||
break;
|
||||
}
|
||||
break; /* WM_SYSKEYDOWN */
|
||||
|
||||
case WM_CHAR:
|
||||
case WM_SYSCHAR:
|
||||
{
|
||||
|
@ -3566,8 +3556,73 @@ MenuTrackMouseMenuBar(HWND Wnd, ULONG Ht, POINT Pt)
|
|||
|
||||
|
||||
VOID
|
||||
MenuTrackKbdMenuBar(HWND hWnd, ULONG wParam, ULONG Key)
|
||||
MenuTrackKbdMenuBar(HWND hWnd, UINT wParam, WCHAR wChar)
|
||||
{
|
||||
UINT uItem = NO_SELECTED_ITEM;
|
||||
HMENU hTrackMenu;
|
||||
ROSMENUINFO MenuInfo;
|
||||
UINT wFlags = TPM_ENTERIDLEEX | TPM_LEFTALIGN | TPM_LEFTBUTTON;
|
||||
|
||||
DPRINT("hwnd %p wParam 0x%04x wChar 0x%04x\n", hWnd, wParam, wChar);
|
||||
|
||||
/* find window that has a menu */
|
||||
|
||||
while (!((GetWindowLongW( hWnd, GWL_STYLE ) &
|
||||
(WS_CHILD | WS_POPUP)) != WS_CHILD))
|
||||
if (!(hWnd = GetAncestor( hWnd, GA_PARENT ))) return;
|
||||
|
||||
/* check if we have to track a system menu */
|
||||
|
||||
hTrackMenu = GetMenu( hWnd );
|
||||
if (!hTrackMenu || IsIconic(hWnd) || wChar == ' ' )
|
||||
{
|
||||
if (!(GetWindowLongW( hWnd, GWL_STYLE ) & WS_SYSMENU)) return;
|
||||
hTrackMenu = NtUserGetSystemMenu(hWnd, FALSE);
|
||||
uItem = 0;
|
||||
wParam |= HTSYSMENU; /* prevent item lookup */
|
||||
}
|
||||
|
||||
if (!IsMenu( hTrackMenu )) return;
|
||||
|
||||
MenuInitTracking( hWnd, hTrackMenu, FALSE, wFlags );
|
||||
|
||||
if (! MenuGetRosMenuInfo(&MenuInfo, hTrackMenu))
|
||||
{
|
||||
goto track_menu;
|
||||
}
|
||||
|
||||
if( wChar && wChar != ' ' )
|
||||
{
|
||||
uItem = MenuFindItemByKey( hWnd, &MenuInfo, wChar, (wParam & HTSYSMENU) );
|
||||
if ( uItem >= (UINT)(-2) )
|
||||
{
|
||||
if( uItem == (UINT)(-1) ) MessageBeep(0);
|
||||
/* schedule end of menu tracking */
|
||||
wFlags |= TF_ENDMENU;
|
||||
goto track_menu;
|
||||
}
|
||||
}
|
||||
|
||||
MenuSelectItem( hWnd, &MenuInfo, uItem, TRUE, 0 );
|
||||
|
||||
if (wParam & HTSYSMENU)
|
||||
{
|
||||
/* prevent sysmenu activation for managed windows on Alt down/up */
|
||||
// if (GetPropA( hwnd, "__wine_x11_managed" ))
|
||||
wFlags |= TF_ENDMENU; /* schedule end of menu tracking */
|
||||
}
|
||||
else
|
||||
{
|
||||
if( uItem == NO_SELECTED_ITEM )
|
||||
MenuMoveSelection( hWnd, &MenuInfo, ITEM_NEXT );
|
||||
else
|
||||
PostMessageW( hWnd, WM_KEYDOWN, VK_DOWN, 0L );
|
||||
}
|
||||
|
||||
track_menu:
|
||||
MenuTrackMenu( hTrackMenu, wFlags, 0, 0, hWnd, NULL );
|
||||
MenuExitTracking( hWnd );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue