From a26d5408a1f90a073aef48ddf67010b87d06553c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 13 Oct 2008 19:26:18 +0000 Subject: STR 1952: Fixed first modifier key event, some minor utf8 orrections. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6416 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_mac.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/Fl_mac.cxx') diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 213b3a636..f90d95609 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -165,7 +165,7 @@ static unsigned short macKeyLookUp[128] = /** * convert the current mouse chord into the FLTK modifier state */ -static void mods_to_e_state( UInt32 mods ) +static unsigned int mods_to_e_state( UInt32 mods ) { long state = 0; if ( mods & kEventKeyModifierNumLockMask ) state |= FL_NUM_LOCK; @@ -174,8 +174,10 @@ static void mods_to_e_state( UInt32 mods ) if ( mods & (controlKey|rightControlKey) ) state |= FL_CTRL; if ( mods & (shiftKey|rightShiftKey) ) state |= FL_SHIFT; if ( mods & alphaLock ) state |= FL_CAPS_LOCK; - Fl::e_state = ( Fl::e_state & 0xff000000 ) | state; + unsigned int ret = ( Fl::e_state & 0xff000000 ) | state; + Fl::e_state = ret; //printf( "State 0x%08x (%04x)\n", Fl::e_state, mods ); + return ret; } @@ -1212,7 +1214,7 @@ pascal OSStatus carbonKeyboardHandler( Fl_Window *window = (Fl_Window*)userData; Fl::first_window(window); UInt32 mods; - static UInt32 prevMods = 0xffffffff; + static UInt32 prevMods = mods_to_e_state( GetCurrentKeyModifiers() ); fl_lock_function(); @@ -1221,7 +1223,6 @@ pascal OSStatus carbonKeyboardHandler( // get the modifiers for any of the events GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &mods ); - if ( prevMods == 0xffffffff ) prevMods = mods; // get the key code only for key events UInt32 keyCode = 0; -- cgit v1.2.3