From d19c20d85a277b6103d88db9d897c419c7f40da1 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 2 Apr 2012 20:30:01 +0000 Subject: [PATCH] fix left/right mouse config init. SVN revision: 69870 --- src/bin/e_mouse.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/bin/e_mouse.c b/src/bin/e_mouse.c index e10114505..c00d16343 100644 --- a/src/bin/e_mouse.c +++ b/src/bin/e_mouse.c @@ -3,7 +3,7 @@ EAPI int e_mouse_update(void) { - unsigned char map[256]; + unsigned char map[256] = { 0 }; int n; if (!ecore_x_pointer_control_set(e_config->mouse_accel_numerator, @@ -11,15 +11,30 @@ e_mouse_update(void) e_config->mouse_accel_threshold)) return 0; - if (!(n = ecore_x_pointer_mapping_get(map, 256))) return 0; + if (!ecore_x_pointer_mapping_get(map, 256)) return 0; - if (((e_config->mouse_hand == E_MOUSE_HAND_LEFT) && (map[2] != 1)) || - ((e_config->mouse_hand == E_MOUSE_HAND_RIGHT) && (map[0] != 1))) + for (n = 0; n < 256; n++) { - const unsigned char tmp = map[0]; - map[0] = map[2]; map[2] = tmp; - if (ecore_x_pointer_mapping_set(map, n)) return 0; + if (!map[n]) break; } + if (n < 3) + { + map[0] = 1; + map[1] = 2; + map[2] = 3; + n = 3; + } + if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT) + { + map[0] = 1; + map[2] = 3; + } + else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT) + { + map[0] = 3; + map[2] = 1; + } + if (ecore_x_pointer_mapping_set(map, n)) return 0; return 1; }