summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-19 01:07:29 +0000
committerDana Jansens <danakj@orodu.net>2003-02-19 01:07:29 +0000
commitd2a1ecb1b50902d262a74e347203a36a961e1d92 (patch)
treeaed6a947bbed9bfc7393fb7ae9b075ce680328db /src
parentd647de97bec82fa6c229a4801908b847f631f031 (diff)
let any number of mouse buttons work
Diffstat (limited to 'src')
-rw-r--r--src/bindings.cc30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/bindings.cc b/src/bindings.cc
index 1e3897de..e6f98f79 100644
--- a/src/bindings.cc
+++ b/src/bindings.cc
@@ -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;
}