Ken Thomases : winemac: Prevent Cocoa from consuming certain key-down events.

Alexandre Julliard julliard at winehq.org
Mon Feb 11 13:06:31 CST 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Sun Feb 10 19:09:18 2013 -0600

winemac: Prevent Cocoa from consuming certain key-down events.

---

 dlls/winemac.drv/cocoa_window.m |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 218ba3f..4371110 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -679,18 +679,27 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
 
     - (void) sendEvent:(NSEvent*)event
     {
-        if ([event type] == NSLeftMouseDown)
+        /* NSWindow consumes certain key-down events as part of Cocoa's keyboard
+           interface control.  For example, Control-Tab switches focus among
+           views.  We want to bypass that feature, so directly route key-down
+           events to -keyDown:. */
+        if ([event type] == NSKeyDown)
+            [[self firstResponder] keyDown:event];
+        else
         {
-            /* Since our windows generally claim they can't be made key, clicks
-               in their title bars are swallowed by the theme frame stuff.  So,
-               we hook directly into the event stream and assume that any click
-               in the window will activate it, if Wine and the Win32 program
-               accept. */
-            if (![self isKeyWindow] && !self.disabled && !self.noActivate)
-                [NSApp windowGotFocus:self];
-        }
+            if ([event type] == NSLeftMouseDown)
+            {
+                /* Since our windows generally claim they can't be made key, clicks
+                   in their title bars are swallowed by the theme frame stuff.  So,
+                   we hook directly into the event stream and assume that any click
+                   in the window will activate it, if Wine and the Win32 program
+                   accept. */
+                if (![self isKeyWindow] && !self.disabled && !self.noActivate)
+                    [NSApp windowGotFocus:self];
+            }
 
-        [super sendEvent:event];
+            [super sendEvent:event];
+        }
     }
 
 




More information about the wine-cvs mailing list