Commit 33026a2a authored by Ulrich Czekalla's avatar Ulrich Czekalla Committed by Alexandre Julliard

Send WM_HELP message when F1 is pressed.

parent f94c3c55
......@@ -2140,6 +2140,16 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
return item->hSubMenu;
}
/**********************************************************************
* MENU_IsMenuActive
*/
BOOL MENU_IsMenuActive(void)
{
return pTopPopupWnd && (pTopPopupWnd->dwStyle & WS_VISIBLE);
}
/***********************************************************************
* MENU_PtMenu
*
......@@ -2768,6 +2778,22 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
fEndMenu = TRUE;
break;
case VK_F1:
{
HELPINFO hi;
hi.cbSize = sizeof(HELPINFO);
hi.iContextType = HELPINFO_MENUITEM;
if (menu->FocusedItem == NO_SELECTED_ITEM)
hi.iCtrlId = 0;
else
hi.iCtrlId = menu->items[menu->FocusedItem].wID;
hi.hItemHandle = hmenu;
hi.dwContextId = menu->dwContextHelpID;
hi.MousePos = msg.pt;
SendMessageA(hwnd, WM_HELP, 0, (LPARAM)&hi);
break;
}
default:
break;
}
......
......@@ -11,6 +11,7 @@ LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam );
extern BOOL MENU_Init(void);
extern BOOL MENU_IsMenuActive(void);
extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
INT orgX, INT orgY );
......
......@@ -27,6 +27,7 @@
#include "selectors.h"
#include "thread.h"
#include "options.h"
#include "menu.h"
#include "struct32.h"
#include "debugtools.h"
......@@ -422,6 +423,28 @@ static DWORD MSG_TranslateKbdMsg( HWND hTopWnd, DWORD first, DWORD last,
*/
static DWORD MSG_ProcessKbdMsg( MSG *msg, BOOL remove )
{
/* Handle F1 key by sending out WM_HELP message */
if ((msg->message == WM_KEYUP) &&
(msg->wParam == VK_F1) &&
(msg->hwnd != GetDesktopWindow()) &&
!MENU_IsMenuActive())
{
HELPINFO hi;
WND *pWnd = WIN_FindWndPtr(msg->hwnd);
if (NULL != pWnd)
{
hi.cbSize = sizeof(HELPINFO);
hi.iContextType = HELPINFO_WINDOW;
hi.iCtrlId = pWnd->wIDmenu;
hi.hItemHandle = msg->hwnd;
hi.dwContextId = pWnd->helpContext;
hi.MousePos = msg->pt;
SendMessageA(msg->hwnd, WM_HELP, 0, (LPARAM)&hi);
}
WIN_ReleaseWndPtr(pWnd);
}
return (HOOK_CallHooks16( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE,
LOWORD (msg->wParam), msg->lParam )
? SYSQ_MSG_SKIP : SYSQ_MSG_ACCEPT);
......
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