From 5f06bf80db714c1c355018cf7e3bd0e5eaa73ebe Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Wed, 6 Feb 2013 19:32:18 -0600 Subject: [PATCH] winemac: Implement SysCommand() to prevent Alt keypresses from activating system menu. --- dlls/winemac.drv/window.c | 30 ++++++++++++++++++++++++++++++ dlls/winemac.drv/winemac.drv.spec | 1 + 2 files changed, 31 insertions(+) diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 9d639125a1b..7a7eda76dfd 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1040,6 +1040,36 @@ done: } +/*********************************************************************** + * SysCommand (MACDRV.@) + * + * Perform WM_SYSCOMMAND handling. + */ +LRESULT CDECL macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam) +{ + struct macdrv_win_data *data; + LRESULT ret = -1; + + TRACE("%p, %x, %lx\n", hwnd, (unsigned)wparam, lparam); + + if (!(data = get_win_data(hwnd))) goto done; + if (!data->cocoa_window || !data->on_screen) goto done; + + /* prevent a simple ALT press+release from activating the system menu, + as that can get confusing */ + if ((wparam & 0xfff0) == SC_KEYMENU && !(WCHAR)lparam && !GetMenu(hwnd) && + (GetWindowLongW(hwnd, GWL_STYLE) & WS_SYSMENU)) + { + TRACE("ignoring SC_KEYMENU wp %lx lp %lx\n", wparam, lparam); + ret = 0; + } + +done: + release_win_data(data); + return ret; +} + + /*********************************************************************** * UpdateLayeredWindow (MACDRV.@) */ diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec index 30df9d6165a..57b1e5a74c4 100644 --- a/dlls/winemac.drv/winemac.drv.spec +++ b/dlls/winemac.drv/winemac.drv.spec @@ -24,6 +24,7 @@ @ cdecl SetWindowStyle(ptr long ptr) macdrv_SetWindowStyle @ cdecl SetWindowText(long wstr) macdrv_SetWindowText @ cdecl ShowWindow(long long ptr long) macdrv_ShowWindow +@ cdecl SysCommand(long long long) macdrv_SysCommand @ cdecl ToUnicodeEx(long long ptr ptr long long long) macdrv_ToUnicodeEx @ cdecl UpdateLayeredWindow(long ptr ptr) macdrv_UpdateLayeredWindow @ cdecl VkKeyScanEx(long long) macdrv_VkKeyScanEx