]> Dogcows Code - chaz/openbox/blobdiff - src/bindings.cc
speed up workspace switching by causing the minimal number of expose events (none...
[chaz/openbox] / src / bindings.cc
index 8c915f4e538e2eac30b4f1d0bc7575015182aeee..e6f98f79688fcdbfe5cef113e629abce5ae3142a 100644 (file)
@@ -16,24 +16,30 @@ extern "C" {
 #define _(str) gettext(str)
 }
 
+#include <cstdlib>
 #include <algorithm>
 
 namespace ob {
 
 static bool buttonvalue(const std::string &button, unsigned int *val)
 {
-  if (button == "Left" || button == "1" || button == "Button1") {
-    *val |= Button1;
-  } else if (button == "Middle" || button == "2" || button == "Button2") {
-    *val |= Button2;
-  } else if (button == "Right" || button == "3" || button == "Button3") {
-    *val |= Button3;
-  } else if (button == "Up" || button == "4" || button == "Button4") {
-    *val |= Button4;
-  } else if (button == "Down" || button == "5" || button == "Button5") {
-    *val |= Button5;
-  } else
-    return false;
+  if (button == "Left")
+    *val = 1;
+  else if (button == "Middle")
+    *val = 2;
+  else if (button == "Right")
+    *val = 3;
+  else if (button == "Up")
+    *val = 4;
+  else if (button == "Down")
+    *val = 5;
+  else {
+    // try convert to number
+    int i = atoi(button.c_str());
+    if (i <= 0)
+      return false;
+    *val = i;
+  }
   return true;
 }
 
@@ -433,9 +439,9 @@ void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key,
             //this point
             XGrabKeyboard(**otk::display, root, 0, GrabModeAsync, 
                           GrabModeSync, CurrentTime);
-            _grabbed = true;
-            _curpos = p;
           }
+          _grabbed = true;
+          _curpos = p;
           XAllowEvents(**otk::display, AsyncKeyboard, CurrentTime);
         } else {
           Client *c = openbox->focusedClient();
This page took 0.025774 seconds and 4 git commands to generate.