Ken Thomases : Revert "winemac: Dispatch key events directly to window to be sure to get key-up events.".

Alexandre Julliard julliard at winehq.org
Tue Jul 9 15:58:10 CDT 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Tue Jul  9 02:49:55 2013 -0500

Revert "winemac: Dispatch key events directly to window to be sure to get key-up events.".

This reverts commit 0d20ac02f778540844ae37ecc79220f72431a6f4.

---

 dlls/winemac.drv/cocoa_app.m    |    6 ------
 dlls/winemac.drv/cocoa_window.h |    2 --
 dlls/winemac.drv/cocoa_window.m |   15 ++++++++++++++-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 461472b..25081db 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1692,12 +1692,6 @@ int macdrv_err_on;
             [self handleScrollWheel:anEvent];
             ret = mouseCaptureWindow != nil;
         }
-        else if (type == NSKeyDown || type == NSKeyUp)
-        {
-            WineWindow* window = (WineWindow*)[anEvent window];
-            if ([window isKindOfClass:[WineWindow class]])
-                [window postKeyEvent:anEvent];
-        }
 
         return ret;
     }
diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h
index e0e581b..c5a630f 100644
--- a/dlls/winemac.drv/cocoa_window.h
+++ b/dlls/winemac.drv/cocoa_window.h
@@ -68,6 +68,4 @@
     - (NSInteger) minimumLevelForActive:(BOOL)active;
     - (void) updateFullscreen;
 
-    - (void) postKeyEvent:(NSEvent *)theEvent;
-
 @end
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 0e2d7e6..e88a854 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -1195,6 +1195,18 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
         }
     }
 
+    - (void) sendEvent:(NSEvent*)event
+    {
+        /* 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
+            [super sendEvent:event];
+    }
+
     // We normally use the generic/calibrated RGB color space for the window,
     // rather than the device color space, to avoid expensive color conversion
     // which slows down drawing.  However, for windows displaying OpenGL, having
@@ -1230,7 +1242,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
     /*
      * ---------- NSResponder method overrides ----------
      */
-    - (void) keyDown:(NSEvent *)theEvent { /* Need an implementation to avoid beeps */ }
+    - (void) keyDown:(NSEvent *)theEvent { [self postKeyEvent:theEvent]; }
+    - (void) keyUp:(NSEvent *)theEvent   { [self postKeyEvent:theEvent]; }
 
     - (void) flagsChanged:(NSEvent *)theEvent
     {




More information about the wine-cvs mailing list