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

[STR New]

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


Investigating inconsistent Shift-TAB behavior for STR #2368 turned out that
X11 returns a special keysym for Shift-TAB (XK_ISO_Left_Tab = 0xfe20)
instead of TAB (FL_Tab). The FL_SHIFT modifier is correct (set).

This leads to inconsistencies between platforms, if code uses FL_Tab
(combined with modifier keys or not) to decide if TAB or Shift-TAB has
been pressed. The current FLTK code takes care of this at some places, but
not everywhere where FL_Tab is used/tested.

I propose to replace the special X11 keysym directly at data entry (in
src/Fl_x.cxx/fl_handle()) to get rid of the necessity to test for
both/different keysyms. This simplifies FLTK code (and makes it more
platform independent) as well as user code that is likely to miss this
platform dependent behavior as well.

A simple patch is attached. The change concerns only X11 specific code and
makes it possible to remove other special case, as seen here:

$ grep -i -n 'iso_left_tab\|0xfe20' FL/* src/*.c*
src/Fl_Group.cxx:136:  case 0xfe20: // XK_ISO_Left_Tab
src/Fl_Input.cxx:502:        case 0xfe20: // XK_ISO_Left_Tab
src/Fl_Menu.cxx:663:    case 0xFE20: // backtab

The patch has been tested okay with test/input.

Comments welcome.


Link: http://www.fltk.org/str.php?L2369
Version: 1.3-current
Index: src/Fl_x.cxx
===================================================================
--- src/Fl_x.cxx        (revision 7613)
+++ src/Fl_x.cxx        (working copy)
@@ -1252,6 +1252,10 @@
       Fl::e_original_keysym = (int)keysym;
     }
     Fl::e_keysym = int(keysym);
+
+    // replace XK_ISO_Left_Tab (Shift-TAB) with FL_Tab
+    if (Fl::e_keysym == 0xfe20) Fl::e_keysym = FL_Tab;
+
     set_event_xy();
     Fl::e_is_click = 0;
     break;}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to