DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2793
Version: 1.3-feature
This patch adds an option to use new logic that makes more since for
shortcut handling. The old/default handler considered where the mouse was
on how it handled shortcuts and was confusing the heck out of users. The
new logic says the widget with keyboard focus gets first crack if no shift
type shortcut (character/digit type shortcuts that fits in with the
shortcuts in browser STR#2757), then sent up to first window to handle the
rest. The logic being alt-key needed to send s shortcut outside any group.
Link: http://www.fltk.org/str.php?L2793
Version: 1.3-feature
Index: FL/Fl.H
===================================================================
--- FL/Fl.H (revision 9205)
+++ FL/Fl.H (working copy)
@@ -141,6 +141,11 @@
static void damage(int d) {damage_ = d;}
public:
+ // variable to determine if new method used to handle shortcuts should
+ // be used.
+ static bool new_shortcut_logic;
+
+
/** Enumerator for global FLTK options.
These options can be set system wide, per user, or for the running
application only.
Index: src/Fl.cxx
===================================================================
--- src/Fl.cxx (revision 9205)
+++ src/Fl.cxx (working copy)
@@ -118,6 +118,10 @@
#endif // FL_DOXYGEN
+// define new way to handle shortcuts consistantly for users
+// using keyboard.
+bool Fl::new_shortcut_logic=false;
+
//
// 'Fl::version()' - Return the API version number...
//
@@ -1279,18 +1283,36 @@
case FL_SHORTCUT:
if (grab()) {wi = grab(); break;} // send it to grab window
-
- // Try it as shortcut, sending to mouse widget and all parents:
- wi = belowmouse();
- if (!wi) {
- wi = modal();
- if (!wi) wi = window;
- } else if (wi->window() != first_window()) {
- if (send(FL_SHORTCUT, first_window(), first_window())) return 1;
+ if (new_shortcut_logic) {
+ Fl_Widget *wo;
+ // handle normal character key presses within object with keyboard focus
+ if (Fl::event_state(FL_ALT|FL_CTRL|FL_META|FL_COMMAND)==0) {
+ // get object with keyboard focus
+ wo=Fl::focus();
+ if (wo && wo->window()==window) {
+ // handle object with keyboard focus first
+ if (send(FL_SHORTCUT, wo, wo->window())) return 1;
+ }
+ }
+ // handle other shortcuts at the active window level
+ Fl_Window *tw=first_window();
+ if (tw) {
+ if (send(FL_SHORTCUT, tw, tw)) return 1;
+ }
}
-
- for (; wi; wi = wi->parent()) {
- if (send(FL_SHORTCUT, wi, wi->window())) return 1;
+ else {
+ // Try it as shortcut, sending to mouse widget and all parents:
+ wi = belowmouse();
+ if (!wi) {
+ wi = modal();
+ if (!wi) wi = window;
+ } else if (wi->window() != first_window()) {
+ if (send(FL_SHORTCUT, first_window(), first_window())) return 1;
+ }
+
+ for (; wi; wi = wi->parent()) {
+ if (send(FL_SHORTCUT, wi, wi->window())) return 1;
+ }
}
// try using add_handle() functions:
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev