Author: manolo
Date: 2012-12-14 15:36:59 -0800 (Fri, 14 Dec 2012)
New Revision: 9754
Log:
Mac OS: fixed [FLView keyDown:] for OS ?\226?\137?\164 10.5

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 2012-12-14 21:29:45 UTC (rev 9753)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2012-12-14 23:36:59 UTC (rev 9754)
@@ -1745,12 +1745,20 @@
 
   // 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 {

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

Reply via email to