]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes #13557
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 29 Aug 2012 12:01:19 +0000 (12:01 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 29 Aug 2012 12:01:19 +0000 (12:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/utils.mm

index c2c83699409aa287543ee586abb6648b2ef50007..9a7d446ff8e30746288fdbc5629790d78b07053d 100644 (file)
@@ -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];