> Evan: I tried your patch. With it the sudoku demo no longer
> executes shortcuts of the system menu bar. So I won't commit it.
> I retain the idea of removing unused variables. Thanks.
> Is the FL_KEYUP event for cmd-keys really important ?
Oh right, yes this would bypass the system menu. I forgot that some
apps actually use it :)
I'll modify the patch to continue to emit key equivalents but also
emit the key ups for command just like the other modifiers.
Yes, keyup is important. I track key state myself because I do key
chording. When keyup is suppressed it looks like that key is down
forever. It's true I don't do chords with command down, but inserting
that as a special case would be uglier than simply making the library
consistent.
Since I assume you already applied removing wRect I omit that part:
Index: Fl_cocoa.mm
===================================================================
--- Fl_cocoa.mm (revision 7075)
+++ Fl_cocoa.mm (working copy)
@@ -1391,6 +1391,30 @@
}
@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 +1422,7 @@
if ( !beenHereDoneThat ) {
beenHereDoneThat = 1;
- [NSApplication sharedApplication];
+ [FLApplication sharedApplication];
NSAutoreleasePool *localPool;
localPool = [[NSAutoreleasePool alloc] init];
mydelegate = [[FLDelegate alloc] init];
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev