summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx2
-rw-r--r--src/Fl_x.cxx13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 61263b44d..bcf820410 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -113,7 +113,7 @@ unsigned char Fl::options_[] = { 0, 0 };
unsigned char Fl::options_read_ = 0;
-Fl_Window *fl_xfocus; // which window X thinks has focus
+Fl_Window *fl_xfocus = NULL; // which window X thinks has focus
Fl_Window *fl_xmousewin;// which window X thinks has FL_ENTER
Fl_Window *Fl::grab_; // most recent Fl::grab()
Fl_Window *Fl::modal_; // topmost modal() window
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 7869791d7..c3f2ea2a3 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -2213,12 +2213,17 @@ void Fl_X::activate_window(Window w) {
if (!ewmh_supported())
return;
- Fl_X *x = Fl_X::i(fl_xfocus);
- if (!x)
- return;
+ Window prev = 0;
+
+ if (fl_xfocus) {
+ Fl_X *x = Fl_X::i(fl_xfocus);
+ if (!x)
+ return;
+ prev = x->xid;
+ }
send_wm_event(w, fl_NET_ACTIVE_WINDOW, 1 /* application */,
- 0 /* timestamp */, x->xid /* previously active window */);
+ 0 /* timestamp */, prev /* previously active window */);
}
/* Change an existing window to fullscreen */