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
This commit is contained in:
Manolo Gouy 2012-12-14 23:36:59 +00:00
parent 9a2467ebc5
commit 5a054cd1b3

View File

@ -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 {