summaryrefslogtreecommitdiff
path: root/otk
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-11-11 11:25:40 +0000
committerDana Jansens <danakj@orodu.net>2002-11-11 11:25:40 +0000
commitc4a1fac49da32250dc4567880b385feb7feaa908 (patch)
treecd0d1358e70e3bc5db442e30adff3c37ef222403 /otk
parent24dd636f7318b0d21637aa7ffe253fe0ebf71f24 (diff)
manages windows that exist before running.
Diffstat (limited to 'otk')
-rw-r--r--otk/display.cc16
-rw-r--r--otk/display.hh7
2 files changed, 23 insertions, 0 deletions
diff --git a/otk/display.cc b/otk/display.cc
index 4613b9ba..77111d3c 100644
--- a/otk/display.cc
+++ b/otk/display.cc
@@ -51,6 +51,7 @@ int OBDisplay::_xinerama_event_basep = 0;
unsigned int OBDisplay::_mask_list[8];
OBDisplay::ScreenInfoList OBDisplay::_screenInfoList;
BGCCache *OBDisplay::_gccache = (BGCCache*) 0;
+int OBDisplay::_grab_count = 0;
int OBDisplay::xerrorHandler(Display *d, XErrorEvent *e)
@@ -172,6 +173,21 @@ const ScreenInfo* OBDisplay::screenInfo(int snum) {
}
+void OBDisplay::grab()
+{
+ if (_grab_count == 0)
+ XGrabServer(display);
+ _grab_count++;
+}
+
+
+void OBDisplay::ungrab()
+{
+ if (_grab_count == 0) return;
+ _grab_count--;
+ if (_grab_count == 0)
+ XUngrabServer(display);
+}
diff --git a/otk/display.hh b/otk/display.hh
index e8f91ae9..7f5ab02d 100644
--- a/otk/display.hh
+++ b/otk/display.hh
@@ -42,6 +42,9 @@ private:
//! A list of all possible combinations of keyboard lock masks
static unsigned int _mask_list[8];
+ //! The number of requested grabs on the display
+ static int _grab_count;
+
//! A list of information for all screens on the display
static ScreenInfoList _screenInfoList;
@@ -94,7 +97,11 @@ public:
//! Returns if the display has the xinerama extention available
inline static bool xinerama() { return _xinerama; }
+ //! Grabs the display
+ static void grab();
+ //! Ungrabs the display
+ static void ungrab();