STR #2196: fixed wrong identifier for special keys combined with modifier.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@6800 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2009-06-28 21:54:59 +00:00
parent 713454a063
commit 12c9c933fc
2 changed files with 9 additions and 7 deletions

View File

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

View File

@ -1105,7 +1105,7 @@ pascal OSStatus carbonKeyboardHandler(
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 @@ pascal OSStatus carbonKeyboardHandler(
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 @@ pascal OSStatus carbonKeyboardHandler(
}
// 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