From: Stefan Csomor Date: Wed, 29 Aug 2012 12:01:19 +0000 (+0000) Subject: fixes #13557 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ee6a122fa3446c7aa020e7fdfeb85584d92309d1?ds=inline fixes #13557 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index c2c8369940..9a7d446ff8 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -237,15 +237,38 @@ void wxBell() } @end +// here we subclass NSApplication, for the purpose of being able to override sendEvent. +@interface wxNSApplication : NSApplication +{ +} + +- (void)sendEvent:(NSEvent *)anEvent; + +@end + +@implementation wxNSApplication + +/* This is needed because otherwise we don't receive any key-up events for command-key + combinations (an AppKit bug, apparently) */ +- (void)sendEvent:(NSEvent *)anEvent +{ + if ([anEvent type] == NSKeyUp && ([anEvent modifierFlags] & NSCommandKeyMask)) + [[self keyWindow] sendEvent:anEvent]; + else [super sendEvent:anEvent]; +} + +@end + wxNSAppController* appcontroller = nil; bool wxApp::DoInitGui() { wxMacAutoreleasePool pool; - [NSApplication sharedApplication]; if (!sm_isEmbedded) { + [wxNSApplication sharedApplication]; + appcontroller = [[wxNSAppController alloc] init]; [NSApp setDelegate:appcontroller];