From a26d5408a1f90a073aef48ddf67010b87d06553c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 13 Oct 2008 19:26:18 +0000 Subject: [PATCH] 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 --- CHANGES | 1 + FL/fl_utf8.h | 2 ++ src/Fl_mac.cxx | 9 +++++---- src/fl_utf.c | 11 ++--------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index 18bd6cbc6..6bbee9017 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.3.0 + - Fixed first modifier key event (STR #1952) - Fl_Group and Fl_Scroll now resize themselves before resizing their children (STR #2032) - "fltk-config --post foo" now creates an application diff --git a/FL/fl_utf8.h b/FL/fl_utf8.h index 74d893893..55a834822 100644 --- a/FL/fl_utf8.h +++ b/FL/fl_utf8.h @@ -75,6 +75,8 @@ extern "C" { # endif +int fl_unichar_to_utf8_size(Fl_Unichar); + /* F2: comes from FLTK2 */ /* OD: comes from OksiD */ 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; diff --git a/src/fl_utf.c b/src/fl_utf.c index d78368550..102591d74 100644 --- a/src/fl_utf.c +++ b/src/fl_utf.c @@ -23,10 +23,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - +#if 0 /** \defgroup fl_unichar Unicode Character Functions Global Functions Handling Single Unicode Characters @@ -56,7 +53,7 @@ extern "C" { //FL_EXPORT int fl_utf8_size(Fl_Unichar uc); /** @} */ - +#endif // 0 /* Set to 1 to turn bad UTF8 bytes into ISO-8859-1. If this is to zero they are instead turned into the Unicode REPLACEMENT CHARACTER, of @@ -839,7 +836,3 @@ int fl_utf8test(const char* src, unsigned srclen) { } return ret; } - -#ifdef __cplusplus -} -#endif