X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fbindings.cc;h=e6f98f79688fcdbfe5cef113e629abce5ae3142a;hb=7f561a6a7acee71d55eecc9ed2bd278147ce2536;hp=8c915f4e538e2eac30b4f1d0bc7575015182aeee;hpb=e429ce39deaf4a8d5975e871af0530634ea2a63e;p=chaz%2Fopenbox diff --git a/src/bindings.cc b/src/bindings.cc index 8c915f4e..e6f98f79 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -16,24 +16,30 @@ extern "C" { #define _(str) gettext(str) } +#include #include 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();