summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-02-16 07:27:55 +0000
committerManolo Gouy <Manolo>2010-02-16 07:27:55 +0000
commitb434df6061c5436685d2fd6f24e8ebeaf619311f (patch)
treea6cd5d6d715aa36a452e537c84e6f10b9c094585
parent5a768969085c5723caa99c7c5dd498d59fdd822d (diff)
changed events dispatching so command+key generates both FL_KEYBOARD and FL_KEYUP events
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7087 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_cocoa.mm25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index d0da4dbfb..1fc5f5ce2 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -1391,6 +1391,29 @@ extern "C" {
}
@end
+@interface FLApplication : NSApplication
+{
+}
+- (void)sendEvent:(NSEvent *)theEvent;
+@end
+@implementation FLApplication
+// The default sendEvent turns key downs into performKeyEquivalent when
+// modifiers are down, but swallows the key up if the modifiers include
+// command. This one makes all modifiers consistent by always sending key ups.
+// FLView treats performKeyEquivalent to keyDown, but performKeyEquivalent is
+// still needed for the system menu.
+- (void)sendEvent:(NSEvent *)theEvent
+{
+ NSEventType type = [theEvent type];
+ NSWindow *key = [self keyWindow];
+ if (key && type == NSKeyUp) {
+ [key sendEvent:theEvent];
+ } else {
+ [super sendEvent:theEvent];
+ }
+}
+@end
+
static FLDelegate *mydelegate;
void fl_open_display() {
@@ -1398,7 +1421,7 @@ void fl_open_display() {
if ( !beenHereDoneThat ) {
beenHereDoneThat = 1;
- [NSApplication sharedApplication];
+ [FLApplication sharedApplication];
NSAutoreleasePool *localPool;
localPool = [[NSAutoreleasePool alloc] init];
mydelegate = [[FLDelegate alloc] init];