diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 9eddf3e3d..cb6d18543 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -43,7 +43,7 @@ really remove these as well, so we can stop linking to Carbon alltogether. "_GetKeys", referenced from: - Fl::get_key(int) in Fl_get_key.o + Fl::get_key(int) in Fl_get_key.o (kept only for pre-10.4 runs) "_GetEventParameter", referenced from: carbonTextHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in Fl.o diff --git a/src/Fl_get_key_mac.cxx b/src/Fl_get_key_mac.cxx index afdeddb7b..1d2db4a3f 100644 --- a/src/Fl_get_key_mac.cxx +++ b/src/Fl_get_key_mac.cxx @@ -87,6 +87,13 @@ int Fl::event_key(int k) { //: returns true, if that key is pressed right now int Fl::get_key(int k) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 + if(CGEventSourceKeyState != NULL) { + return (int)CGEventSourceKeyState(kCGEventSourceStateCombinedSessionState, fltk2mac(k) ); + } + else +#endif + { KeyMap foo; GetKeys(foo); #ifdef MAC_TEST_FOR_KEYCODES @@ -103,6 +110,7 @@ int Fl::get_key(int k) { } int i = fltk2mac(k); return (b[i>>3]>>(i&7))&1; + } } //