summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index 3fb10cb74..5b44bedec 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -127,10 +127,18 @@ int Fl_X11_Window_Driver::decorated_w()
void Fl_X11_Window_Driver::take_focus()
{
Fl_X *i = Fl_X::i(pWindow);
- if (!Fl_X11_Screen_Driver::ewmh_supported())
- pWindow->show(); // Old WMs, XMapRaised
- else if (i) // New WMs use the NETWM attribute:
+ if (!Fl_X11_Screen_Driver::ewmh_supported()) {
+
+ // Save and restore the current group because 'show()' sets it to NULL.
+ // See issue #515: Fl::focus() changes Fl_Group::current() to null.
+
+ Fl_Group *cg = Fl_Group::current(); // save current group
+ pWindow->show(); // old WMs, XMapRaised
+ Fl_Group::current(cg); // restore current group
+ }
+ else if (i) { // New WMs use the NETWM attribute:
activate_window();
+ }
}