[PATCH] winemac: Send Help key presses directly to the window, bypassing -[NSApplication sendEvent:].

Ken Thomases ken at codeweavers.com
Mon Apr 3 20:57:14 CDT 2017


-[NSApplication sendEvent:] seems to consume the event and doesn't pass it along
to the window.

Mac keyboards haven't included a Help key for a long time, but users with PC
keyboards can use the Insert key, which is in the same position.  The Mac
driver translates either one to VK_INSERT.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
 dlls/winemac.drv/cocoa_app.m | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 27ebdc4..6d1473a 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1973,6 +1973,17 @@ - (BOOL) handleEvent:(NSEvent*)anEvent
             [self handleScrollWheel:anEvent];
             ret = mouseCaptureWindow != nil;
         }
+        else if (type == NSKeyDown)
+        {
+            // -[NSApplication sendEvent:] seems to consume presses of the Help
+            // key (Insert key on PC keyboards), so we have to bypass it and
+            // send the event directly to the window.
+            if (anEvent.keyCode == kVK_Help)
+            {
+                [anEvent.window sendEvent:anEvent];
+                ret = TRUE;
+            }
+        }
         else if (type == NSKeyUp)
         {
             uint16_t keyCode = [anEvent keyCode];
-- 
2.10.2




More information about the wine-patches mailing list