> On Thu, Jan 21, 2010 at 6:19 PM, Evan Laforge <[email protected]> wrote: > > I spoke too soon, command+key doesn't send the keyup. After some > digging around it has to do with some apparently undocumented and > mysterious behaviour wrt NSApplication sending key equivalents. We > don't need any of that since we already have our own mysterious and > hard to disable key equivalent system (don't get me started on that). > Here's a patch against the current version. I cut out a bit of unused > code while I was at it: > > Index: Fl_cocoa.mm > > --- Fl_cocoa.mm (revision 7075) > +++ Fl_cocoa.mm (working copy) > @@ -1391,6 +1391,31 @@ > } > @end > > +...@interface FLApplication : NSApplication > +{ > +} > +- (void)sendEvent:(NSEvent *)theEvent; > +...@end > + > +...@implementation FLApplication > +// The default sendEvent swallows key ups when command is down. This one > +// bypasses all that key equivalent stuff and sends the event directly to = > the > +// key window. > +// > +// For some reason commancd-esc is still sent as a performKeyEquivalent, s= > o > +// FLView still needs to override performKeyEquivalent to act like keyDown= > .. > +- (void)sendEvent:(NSEvent *)theEvent > +{ > + NSEventType type =3D [theEvent type]; > + NSWindow *key =3D [self keyWindow]; > + if (key && (type =3D=3D NSKeyDown || type =3D=3D NSKeyUp || type =3D=3D > NSFlagsChanged)) { > + [key sendEvent: theEvent]; > + } else { > + [super sendEvent:theEvent]; > + } > +} > +...@end > + > static FLDelegate *mydelegate; > > void fl_open_display() { > @@ -1398,7 +1423,7 @@ > if ( !beenHereDoneThat ) { > beenHereDoneThat =3D 1; > =09 > - [NSApplication sharedApplication]; > + [FLApplication sharedApplication]; > NSAutoreleasePool *localPool; > localPool =3D [[NSAutoreleasePool alloc] init]; > mydelegate =3D [[FLDelegate alloc] init]; > @@ -2012,12 +2037,6 @@ > while (w->parent()) w =3D w->window(); // todo: this code does > not make any sense! (w!=3Dw??) > } >
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 ? _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
