]> Dogcows Code - chaz/openbox/blobdiff - plugins/mouse/translate.c
add a leftHanded option for mouse bindings, reverses the left/right keywords
[chaz/openbox] / plugins / mouse / translate.c
index c73235958126ac9ab86230d3ce5434a7f6357a24..d849ed4485ea6f622cbab24ddbfe03ccf2ebe5ea 100644 (file)
@@ -1,4 +1,5 @@
 #include "../../kernel/openbox.h"
+#include "mouse.h"
 #include <glib.h>
 #include <string.h>
 #include <stdlib.h>
@@ -45,12 +46,12 @@ gboolean translate_button(char *str, guint *state, guint *button)
     }
 
     /* figure out the button */
-    if (!g_ascii_strcasecmp("Left", l)) *button = 1;
+    if (!g_ascii_strcasecmp("Left", l)) *button = mouse_lefthand ? 3 : 1;
     else if (!g_ascii_strcasecmp("Middle", l)) *button = 2;
-    else if (!g_ascii_strcasecmp("Right", l)) *button = 3;
+    else if (!g_ascii_strcasecmp("Right", l)) *button = mouse_lefthand ? 1 : 3;
     else if (!g_ascii_strcasecmp("Up", l)) *button = 4;
     else if (!g_ascii_strcasecmp("Down", l)) *button = 5;
-    else *button = atoi(l);
+    else if (!g_ascii_strncasecmp("Button", l, 6)) *button = atoi(l+6);
     if (!*button) {
        g_warning("Invalid button '%s' in pointer binding.", l);
        goto translation_fail;
This page took 0.022646 seconds and 4 git commands to generate.