Allowing to use FLTK objects in static initializers (cont'd).
On the Mac platform, it is also necessary to change the initialization of the macKeyLookUp array for keyboard events to work in a static initializer. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10962 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
cf14f77a90
commit
09cd712c0d
@ -158,7 +158,7 @@ void fl_set_status(int x, int y, int w, int h)
|
||||
/*
|
||||
* Mac keyboard lookup table
|
||||
*/
|
||||
static unsigned short* macKeyLookUp = fl_compute_macKeyLookUp();
|
||||
static unsigned short* macKeyLookUp = NULL;
|
||||
|
||||
/*
|
||||
* convert the current mouse chord into the FLTK modifier state
|
||||
@ -2177,6 +2177,7 @@ static void cocoaKeyboardHandler(NSEvent *theEvent)
|
||||
// printf("%08x %08x %08x\n", keyCode, mods, key);
|
||||
maskedKeyCode = keyCode & 0x7f;
|
||||
mods_to_e_state( mods ); // process modifier keys
|
||||
if (!macKeyLookUp) macKeyLookUp = fl_compute_macKeyLookUp();
|
||||
sym = macKeyLookUp[maskedKeyCode];
|
||||
if (sym < 0xff00) { // a "simple" key
|
||||
// find the result of this key without modifier
|
||||
@ -2417,6 +2418,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
||||
if ( tMods )
|
||||
{
|
||||
unsigned short keycode = [theEvent keyCode];
|
||||
if (!macKeyLookUp) macKeyLookUp = fl_compute_macKeyLookUp();
|
||||
Fl::e_keysym = Fl::e_original_keysym = macKeyLookUp[keycode & 0x7f];
|
||||
if ( Fl::e_keysym )
|
||||
sendEvent = ( prevMods<mods ) ? FL_KEYBOARD : FL_KEYUP;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user