diff options
| author | Manolo Gouy <Manolo> | 2012-12-14 23:36:59 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2012-12-14 23:36:59 +0000 |
| commit | 5a054cd1b353d8805bf4351905e06be51e5e9077 (patch) | |
| tree | a05d77eb7381a78c106c96d8359ea2a4faafb738 | |
| parent | 9a2467ebc512444f789f8763b2b95d8c3386c56e (diff) | |
Mac OS: fixed [FLView keyDown:] for OS ≤ 10.5
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9754 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_cocoa.mm | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index b085cf760..9762d8420 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1745,12 +1745,20 @@ static void q_set_window_title(NSWindow *nsw, const char * name, const char *mi // First let's process the raw key press cocoaKeyboardHandler(theEvent); - - NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; - in_key_event = YES; - [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; - in_key_event = NO; - + + if (fl_mac_os_version < 100600 && (Fl::e_keysym == FL_BackSpace || + Fl::e_keysym == FL_Enter || Fl::e_keysym == FL_Escape || Fl::e_keysym == FL_Tab) ) { + // interpretKeyEvents doesn't output anything for these 4 keys under 10.5 or below + NSString *s = [theEvent characters]; + if ([s length] >= 1) [FLView prepareEtext:s]; + Fl::handle(FL_KEYBOARD, window); + } + else { + NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; + in_key_event = YES; + [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; + in_key_event = NO; + } fl_unlock_function(); } - (void)keyUp:(NSEvent *)theEvent { |
