summaryrefslogtreecommitdiff
path: root/src/Fl_grab.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2012-03-23 16:47:53 +0000
committerManolo Gouy <Manolo>2012-03-23 16:47:53 +0000
commit08ce2e07d379d6b9925208b5da9323f948b634db (patch)
treecff1ab07cf0952cec8c1cf874ba9bcc7b241a041 /src/Fl_grab.cxx
parent8cd98f5236618f8ab9d576e709308b43246bc7ac (diff)
Fix STR#2641: true fullscreen windows that cover all their screen including menu bar, task bar, dock.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9299 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_grab.cxx')
-rw-r--r--src/Fl_grab.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Fl_grab.cxx b/src/Fl_grab.cxx
index e7951ebc1..c8f7ac941 100644
--- a/src/Fl_grab.cxx
+++ b/src/Fl_grab.cxx
@@ -42,6 +42,15 @@ extern void *fl_capture;
#endif
void Fl::grab(Fl_Window* win) {
+#if USE_X11
+ Fl_Window *fullscreen_win = NULL;
+ for (Fl_Window *W = Fl::first_window(); W; W = Fl::next_window(W)) {
+ if (W->fullscreen_active()) {
+ fullscreen_win = W;
+ break;
+ }
+ }
+#endif
if (win) {
if (!grab_) {
#ifdef WIN32
@@ -51,8 +60,9 @@ void Fl::grab(Fl_Window* win) {
fl_capture = Fl_X::i(first_window())->xid;
Fl_X::i(first_window())->set_key_window();
#else
+ Window xid = fullscreen_win ? fl_xid(fullscreen_win) : fl_xid(first_window());
XGrabPointer(fl_display,
- fl_xid(first_window()),
+ xid,
1,
ButtonPressMask|ButtonReleaseMask|
ButtonMotionMask|PointerMotionMask,
@@ -62,7 +72,7 @@ void Fl::grab(Fl_Window* win) {
0,
fl_event_time);
XGrabKeyboard(fl_display,
- fl_xid(first_window()),
+ xid,
1,
GrabModeAsync,
GrabModeAsync,
@@ -78,7 +88,10 @@ void Fl::grab(Fl_Window* win) {
#elif defined(__APPLE__)
fl_capture = 0;
#else
+ // We must keep the grab in the non-EWMH fullscreen case
+ if (!fullscreen_win || Fl_X::ewmh_supported()) {
XUngrabKeyboard(fl_display, fl_event_time);
+ }
XUngrabPointer(fl_display, fl_event_time);
// this flush is done in case the picked menu item goes into
// an infinite loop, so we don't leave the X server locked up: