Author: manolo
Date: 2010-05-26 14:25:11 -0700 (Wed, 26 May 2010)
New Revision: 7615
Log:
Fl_get_key_mac.cxx: removed GetKeys Carbon call
Tested OK with keyboard demo.

Modified:
   branches/branch-1.3/src/Fl_cocoa.mm
   branches/branch-1.3/src/Fl_get_key_mac.cxx

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2010-05-26 20:04:00 UTC (rev 7614)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2010-05-26 21:25:11 UTC (rev 7615)
@@ -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

Modified: branches/branch-1.3/src/Fl_get_key_mac.cxx
===================================================================
--- branches/branch-1.3/src/Fl_get_key_mac.cxx  2010-05-26 20:04:00 UTC (rev 
7614)
+++ branches/branch-1.3/src/Fl_get_key_mac.cxx  2010-05-26 21:25:11 UTC (rev 
7615)
@@ -87,6 +87,13 @@
 
 //: 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 i = fltk2mac(k);
   return (b[i>>3]>>(i&7))&1;
+  }
 }
 
 //

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to