Author: manolo
Date: 2011-04-01 10:19:34 -0700 (Fri, 01 Apr 2011)
New Revision: 8555
Log:
about STR #2599: - fix the synchro between key presses and key events
- implement character palette input by FL_PASTE events

Modified:
   branches/branch-1.3/src/Fl_cocoa.mm

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-04-01 13:43:07 UTC (rev 8554)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-04-01 17:19:34 UTC (rev 8555)
@@ -1803,7 +1803,6 @@
   } else {
     received = (NSString*)aString;
   }
-//NSLog(@"insertText: received=%@ event type=%d",received, type);
   if (type == NSKeyDown ) {
     str = [event characters];
     }
@@ -1814,9 +1813,13 @@
     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!

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to