From f8b645f614271ca48c7454bd86be77478ec58c63 Mon Sep 17 00:00:00 2001
From: Manolo Gouy <Manolo>
Date: Fri, 25 Mar 2011 12:16:57 +0000
Subject: [PATCH] Fl::focus(): allows the focus to be set to an Fl_Window
 widget.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8532 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
---
 src/Fl.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;
     }