summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 58f492c87..96fdb4db4 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -813,7 +813,8 @@ void Fl::focus(Fl_Widget *o) {
// make sure that fl_xfocus is set to the top level window
// of this widget, or fl_fix_focus will clear our focus again
if (o) {
- Fl_Window *win = 0, *w1 = o->window();
+ Fl_Window *win = 0, *w1 = o->as_window();
+ if (!w1) w1 = o->window();
while (w1) { win=w1; w1=win->window(); }
if (win) fl_xfocus = win;
}