summaryrefslogtreecommitdiff
path: root/src/Fl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl.cxx')
-rw-r--r--src/Fl.cxx26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index a837eb6a3..c0120b13d 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1001,24 +1001,16 @@ void Fl::focus(Fl_Widget *o) {
if (!w1) w1 = o->window();
while (w1) { win=w1; w1=win->window(); }
if (win) {
-#ifdef __APPLE__ // PORTME: Fl_Window_Driver - platform window focus
- if (fl_xfocus != win) {
- Fl_X *x = Fl_X::i(win);
- if (x) x->set_key_window();
- }
-#elif defined(USE_X11)
- if (fl_xfocus != win) {
- Fl_X *x = Fl_X::i(win);
- if (!Fl_X::ewmh_supported())
- win->show(); // Old WMs, XMapRaised
- else if (x) // New WMs use the NETWM attribute:
- Fl_X::activate_window(x->xid);
- }
-#elif defined(WIN32)
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: handle platform specifics for change of keyboard focus here"
+ if (fl_xfocus != win) {
+ Fl_Window_Driver *drvr = win->driver();
+#ifdef USE_X11 // platform fix
+ if (!Fl_X::ewmh_supported()) win->show(); // Old WMs, XMapRaised
+ else if (drvr) drvr->take_focus();
+#else
+ if (drvr) drvr->take_focus();
#endif
- fl_xfocus = win;
+ fl_xfocus = win;
+ }
}
}
// take focus from the old focused window