]> Dogcows Code - chaz/openbox/blobdiff - src/bindings.cc
initialize _modal, its used before the window's type is checked
[chaz/openbox] / src / bindings.cc
index 783b6479c2b2d03cdea56828dc80f423346c2405..df1de3ecaa4032f848a998c749c76620c217c4e2 100644 (file)
@@ -241,7 +241,6 @@ bool Bindings::addKey(const StringVect &keylist, PyObject *callback)
 
   if (t) {
     // already bound to something
-    // XXX: look if callback is already bound to this key?
     t->callbacks.push_back(callback);
     destroytree(tree);
   } else {
@@ -261,7 +260,7 @@ bool Bindings::addKey(const StringVect &keylist, PyObject *callback)
   return true;
 }
 
-
+/*
 bool Bindings::removeKey(const StringVect &keylist, PyObject *callback)
 {
   assert(false); // XXX: function not implemented yet
@@ -295,7 +294,7 @@ bool Bindings::removeKey(const StringVect &keylist, PyObject *callback)
   }
   return false;
 }
-
+*/
 
 void Bindings::setResetKey(const std::string &key)
 {
@@ -385,9 +384,6 @@ bool Bindings::grabKeyboard(int screen, PyObject *callback)
   if (XGrabKeyboard(**otk::display, root, false, GrabModeAsync,
                     GrabModeAsync, CurrentTime))
     return false;
-  // the pointer grab causes pointer events during the keyboard grab to go away
-  XGrabPointer(**otk::display, root, false, 0, GrabModeAsync,
-               GrabModeAsync, None, None, CurrentTime);
   _keybgrab_callback = callback;
   return true;
 }
@@ -403,6 +399,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 +441,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.021345 seconds and 4 git commands to generate.