DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2232
Version: 1.3-current





Link: http://www.fltk.org/str.php?L2232
Version: 1.3-current
Index: src/x11/run.cxx
===================================================================
--- src/x11/run.cxx     (revision 6969)
+++ src/x11/run.cxx     (working copy)
@@ -1236,15 +1236,6 @@
 
 int fl_actual_keysym;
 
-extern "C" {
-  static Bool fake_keyup_test(Display*, XEvent* event, char* previous) {
-     return
-      event->type == KeyPress &&
-      event->xkey.keycode == ((XKeyEvent*)previous)->keycode &&
-      event->xkey.time == ((XKeyEvent*)previous)->time;
-  }
-}
-
 // this little function makes sure that the stylus related event data
 // is useful, even if no tablet was discovered, or the mouse was used to
 // generate a PUSH, RELEASE, MOVE or DRAG event
@@ -1671,11 +1662,35 @@
     // down, probably due to some back compatability problem. Fortunatley
     // we can detect this because the repeating KeyPress event is in
     // the queue, get it and execute it instead:
-    XEvent temp;
-    if (XCheckIfEvent(xdisplay,&temp,fake_keyup_test,(char*)(&xevent))){
-      xevent = temp;
-      goto KEYPRESS;
+      
+    // Bool XkbSetDetectableAutorepeat ( display, detectable, supported_rtrn )
+    // Display * display ;
+    // Bool detectable ;
+    // Bool * supported_rtrn ;
+    // ...would be the easy way to corrct this isuue. Unfortunatly, this call 
is also 
+    // broken on many Unix distros including Ubuntu and Solaris (as of Dec 
2009)
+
+    // Bogus KeyUp events are generated by repeated KeyDown events. One 
+    // neccessary condition is an identical key event pending right after
+    // the bogus KeyUp.
+    // The new code introduced Dec 2009 differs in that it only check the very
+    // next event in the queue, not the entire queue of events.
+    // This function wrongly detects a repeat key if a software keyboard
+    // sends a burst of events containing two consecutive equal keys. However, 
+    // in every non-gaming situation, this is no problem because both KeyPress
+    // events will cause the expected behavior.
+    XEvent peekevent;
+    if (XPending(xdisplay)) {
+      XPeekEvent(xdisplay, &peekevent);
+      if (   (peekevent.type == KeyPress) // must be a KeyPress event
+          && (peekevent.xkey.keycode == xevent.xkey.keycode) // must be the 
same key
+          && (peekevent.xkey.time == xevent.xkey.time) // must be sent at the 
exact same time
+          ) {
+        XNextEvent(xdisplay, &xevent);
+        goto KEYPRESS;
+      }
     }
+
     set_event_xy(false);
     unsigned keycode = xevent.xkey.keycode;
     fl_key_vector[keycode/8] &= ~(1 << (keycode%8));
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to