Author: matt
Date: 2009-06-28 14:54:59 -0700 (Sun, 28 Jun 2009)
New Revision: 6800
Log:
STR #2196: fixed wrong identifier for special keys combined with modifier.

Modified:
   branches/branch-1.1/CHANGES
   branches/branch-1.1/src/Fl_mac.cxx

Modified: branches/branch-1.1/CHANGES
===================================================================
--- branches/branch-1.1/CHANGES 2009-06-27 20:40:48 UTC (rev 6799)
+++ branches/branch-1.1/CHANGES 2009-06-28 21:54:59 UTC (rev 6800)
@@ -1,5 +1,7 @@
 CHANGES IN FLTK 1.1.10
 
+       - Fixed wrong identifier for special keys combined with 
+         modifier (STR #2196)
        - Fixed documentation for Fl_Progress (STR #2209)
        - Fix for multiple popups, when dragging and calling fl_alert()
          and friends from the callback (STR #2159)

Modified: branches/branch-1.1/src/Fl_mac.cxx
===================================================================
--- branches/branch-1.1/src/Fl_mac.cxx  2009-06-27 20:40:48 UTC (rev 6799)
+++ branches/branch-1.1/src/Fl_mac.cxx  2009-06-28 21:54:59 UTC (rev 6800)
@@ -1105,7 +1105,7 @@
                      NULL, sizeof(UInt32), NULL, &mods );
   
   // get the key code only for key events
-  UInt32 keyCode = 0;
+  UInt32 keyCode = 0, maskedKeyCode = 0;
   unsigned char key = 0;
   unsigned short sym = 0;
   if (kind!=kEventRawKeyModifiersChanged) {
@@ -1114,6 +1114,7 @@
     GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, 
                        NULL, sizeof(char), NULL, &key );
   }
+  maskedKeyCode = keyCode & 0x7f;
   /* output a human readbale event identifier for debugging
   const char *ev = "";
   switch (kind) {
@@ -1152,17 +1153,16 @@
     }
     // if the user pressed alt/option, event_key should have the keycap, 
     // but event_text should generate the international symbol
+    sym = macKeyLookUp[ maskedKeyCode ];
     if ( isalpha(key) )
       sym = tolower(key);
-    else if ( Fl::e_state&FL_CTRL && key<32 )
+    else if ( Fl::e_state&FL_CTRL && key<32 && sym<0xff00)
       sym = key+96;
-    else if ( Fl::e_state&FL_ALT ) // find the keycap of this key
-      sym = keycode_to_sym( keyCode & 0x7f, 0, macKeyLookUp[ keyCode & 0x7f ] 
);
-    else
-      sym = macKeyLookUp[ keyCode & 0x7f ];
+    else if ( Fl::e_state&FL_ALT && sym<0xff00) // find the keycap of this key
+      sym = keycode_to_sym( maskedKeyCode, 0, macKeyLookUp[ maskedKeyCode ] );
     Fl::e_keysym = Fl::e_original_keysym = sym;
     // Handle FL_KP_Enter on regular keyboards and on Powerbooks
-    if ( keyCode==0x4c || keyCode==0x34) key=0x0d;
+    if ( maskedKeyCode==0x4c || maskedKeyCode==0x34) key=0x0d;
     // Matt: the Mac has no concept of a NumLock key, or at least not visible
     // Matt: to Carbon. The kEventKeyModifierNumLockMask is only set when
     // Matt: a numeric keypad key is pressed and does not correspond with

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

Reply via email to