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

Alexandre Julliard julliard at winehq.org
Tue Apr 4 14:54:52 CDT 2017


Module: wine
Branch: master
Commit: 4b8c0d8784593d2830f66407a51e88934ad7adb4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4b8c0d8784593d2830f66407a51e88934ad7adb4

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Apr  3 20:57:14 2017 -0500

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

-[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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 @@ static NSString* WineLocalizedString(unsigned int stringID)
             [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];




More information about the wine-cvs mailing list