From 32df4755c45711bc9cac74763f89c4766da56f7e Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 1 Apr 2011 17:19:34 +0000 Subject: about STR #2599: - fix the synchro between key presses and key events - implement character palette input by FL_PASTE events git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 7db44d99f..272ec7c22 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1803,7 +1803,6 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) { } else { received = (NSString*)aString; } -//NSLog(@"insertText: received=%@ event type=%d",received, type); if (type == NSKeyDown ) { str = [event characters]; } @@ -1814,9 +1813,13 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) { Fl_Window *window = [(FLWindow*)[NSApp keyWindow] getFl_Window]; Fl::e_text = (char*)[received UTF8String]; Fl::e_length = strlen(Fl::e_text); - Fl::e_keysym = 0; - Fl::handle(FL_KEYBOARD, window); - Fl::handle(FL_KEYUP, window); + if (type == NSKeyDown ) { + Fl::e_keysym = macKeyLookUp[ [event keyCode] & 0x7f] ; + Fl::handle(FL_KEYBOARD, window); + } + else { + Fl::handle(FL_PASTE, window); + } fl_unlock_function(); // for some reason, the window does not redraw until the next mouse move or button push // sending a 'redraw()' or 'awake()' does not solve the issue! -- cgit v1.2.3