]> Dogcows Code - chaz/openbox/blobdiff - src/bindings.cc
move windows based on their *frame* not the client
[chaz/openbox] / src / bindings.cc
index 902340384b1f29e9c27f57e3aa7b573d80233a57..fcbff769f5e4945506d5460784f5a144c74ccdca 100644 (file)
@@ -159,9 +159,8 @@ Bindings::~Bindings()
   if (_timer)
     delete _timer;
 
-  grabKeys(false);
   removeAllKeys();
-//  removeAllButtons(); XXX
+  //removeAllButtons(); // this is done by each client as they are unmanaged
   removeAllEvents();
 }
 
@@ -386,8 +385,6 @@ bool Bindings::grabKeyboard(int screen, PyObject *callback)
   if (XGrabKeyboard(**otk::display, root, false, GrabModeAsync,
                     GrabModeAsync, CurrentTime))
     return false;
-  XGrabPointer(**otk::display, root, false, 0, GrabModeAsync,
-               GrabModeAsync, None, None, CurrentTime);
   _keybgrab_callback = callback;
   return true;
 }
@@ -403,6 +400,24 @@ void Bindings::ungrabKeyboard()
 }
 
 
+bool Bindings::grabPointer(int screen)
+{
+  if (!openbox->screen(screen))
+    return false; // the screen is not managed
+  
+  Window root = otk::display->screenInfo(screen)->rootWindow();
+  XGrabPointer(**otk::display, root, false, 0, GrabModeAsync,
+               GrabModeAsync, None, None, CurrentTime);
+  return true;
+}
+
+
+void Bindings::ungrabPointer()
+{
+  XUngrabPointer(**otk::display, CurrentTime);
+}
+
+
 void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key,
                        Time time, KeyAction::KA action)
 {
@@ -427,7 +442,7 @@ void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key,
           _timer = new otk::Timer(5000, // 5 second timeout
                                   (otk::Timer::TimeoutHandler)resetChains,
                                   this);
-          // grab the server here to make sure no key pressed go missed
+          // grab the server here to make sure no key presses get missed
           otk::display->grab();
           grabKeys(false);
           _curpos = p;
This page took 0.021748 seconds and 4 git commands to generate.