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:
parent
8a64710a17
commit
7fffbf7dea
2
CHANGES
2
CHANGES
@ -1,5 +1,7 @@
|
||||
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
|
||||
#1476)
|
||||
- Fl_File_Browser did not calculate the width of
|
||||
|
19
src/Fl.cxx
19
src/Fl.cxx
@ -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*/ {
|
||||
if (first_window() != o->window()) return 0;
|
||||
int mx = e_x - o->x();
|
||||
int my = e_y - o->y();
|
||||
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;
|
||||
|
||||
// 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
|
||||
// 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:
|
||||
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;}
|
||||
for (; wi; wi = wi->parent()) if (send(FL_SHORTCUT, wi, window)) return 1;
|
||||
// Try it as shortcut, sending to focused window then mouse widget and
|
||||
// all parents:
|
||||
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:
|
||||
if (send_handlers(FL_SHORTCUT)) return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user