diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-02-19 22:37:41 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-02-19 22:37:41 +0000 |
| commit | 399501783ccd867559c954d91a00f7d5d7ec4cb8 (patch) | |
| tree | 8363659b24ecfa9bcdd9f402379896d894644888 /src/Fl.cxx | |
| parent | 052401a34e8347c87a418270986432032ac693e2 (diff) | |
Add example code to Fl_Window_Driver.
Some refactoring of a take_focus() function into driver structures (not too happy with it, because it has some kind of bug fix. However, shouldn't *all* Fl_Windows always have an FL_Window_Driver?)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11196 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl.cxx')
| -rw-r--r-- | src/Fl.cxx | 26 |
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 |
