From a723af61acbec0915867a9de4713eceba9379dcd Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Tue, 9 Jul 2013 02:49:55 -0500 Subject: [PATCH] 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 461472b2071..25081db2892 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -1692,12 +1692,6 @@ - (BOOL) handleEvent:(NSEvent*)anEvent [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 e0e581ba2c9..c5a630f7f29 100644 --- a/dlls/winemac.drv/cocoa_window.h +++ b/dlls/winemac.drv/cocoa_window.h @@ -68,6 +68,4 @@ @interface WineWindow : NSPanel - (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 0e2d7e64741..e88a8541142 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -1195,6 +1195,18 @@ - (void) makeKeyAndOrderFront:(id)sender } } + - (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 @@ - (void) updateColorSpace /* * ---------- 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 {