mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 23:06:54 +08:00
Shortcut events could be sent to the wrong window (STR #1451)
src/Fl.cxx:
- Fl::event_inside(): Only return true for widgets if the
first_window() (focused window) is the same as the widget's
window.
- Fl::handle(): Send shortcuts to the first window (that has
focus) before all others.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5531 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
CHANGES IN FLTK 1.1.8
|
CHANGES IN FLTK 1.1.8
|
||||||
|
|
||||||
|
- Shortcut events could be sent to the wrong window (STR
|
||||||
|
#1451)
|
||||||
- Fl_Spinner did not handle the arrow keys properly (STR
|
- Fl_Spinner did not handle the arrow keys properly (STR
|
||||||
#1476)
|
#1476)
|
||||||
- Fl_File_Browser did not calculate the width of
|
- Fl_File_Browser did not calculate the width of
|
||||||
|
|||||||
+15
-4
@@ -106,6 +106,7 @@ int Fl::event_inside(int xx,int yy,int ww,int hh) /*const*/ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Fl::event_inside(const Fl_Widget *o) /*const*/ {
|
int Fl::event_inside(const Fl_Widget *o) /*const*/ {
|
||||||
|
if (first_window() != o->window()) return 0;
|
||||||
int mx = e_x - o->x();
|
int mx = e_x - o->x();
|
||||||
int my = e_y - o->y();
|
int my = e_y - o->y();
|
||||||
return (mx >= 0 && mx < o->w() && my >= 0 && my < o->h());
|
return (mx >= 0 && mx < o->w() && my >= 0 && my < o->h());
|
||||||
@@ -795,7 +796,8 @@ int Fl::handle(int e, Fl_Window* window)
|
|||||||
if (send(FL_KEYBOARD, wi, window)) return 1;
|
if (send(FL_KEYBOARD, wi, window)) return 1;
|
||||||
|
|
||||||
// recursive call to try shortcut:
|
// recursive call to try shortcut:
|
||||||
if (handle(FL_SHORTCUT, window)) return 1;
|
if (handle(FL_SHORTCUT, first_window())) return 1;
|
||||||
|
else if (first_window() != window && handle(FL_SHORTCUT, window)) return 1;
|
||||||
|
|
||||||
// and then try a shortcut with the case of the text swapped, by
|
// and then try a shortcut with the case of the text swapped, by
|
||||||
// changing the text and falling through to FL_SHORTCUT case:
|
// changing the text and falling through to FL_SHORTCUT case:
|
||||||
@@ -807,9 +809,18 @@ int Fl::handle(int e, Fl_Window* window)
|
|||||||
case FL_SHORTCUT:
|
case FL_SHORTCUT:
|
||||||
if (grab()) {wi = grab(); break;} // send it to grab window
|
if (grab()) {wi = grab(); break;} // send it to grab window
|
||||||
|
|
||||||
// Try it as shortcut, sending to mouse widget and all parents:
|
// Try it as shortcut, sending to focused window then mouse widget and
|
||||||
wi = belowmouse(); if (!wi) {wi = modal(); if (!wi) wi = window;}
|
// all parents:
|
||||||
for (; wi; wi = wi->parent()) if (send(FL_SHORTCUT, wi, window)) return 1;
|
if (send(FL_SHORTCUT, first_window(), first_window())) return 1;
|
||||||
|
|
||||||
|
wi = belowmouse();
|
||||||
|
if (!wi) {
|
||||||
|
wi = modal();
|
||||||
|
if (!wi) wi = window;
|
||||||
|
}
|
||||||
|
for (; wi; wi = wi->parent()) {
|
||||||
|
if (send(FL_SHORTCUT, wi, wi->window())) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// try using add_handle() functions:
|
// try using add_handle() functions:
|
||||||
if (send_handlers(FL_SHORTCUT)) return 1;
|
if (send_handlers(FL_SHORTCUT)) return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user