Only swap buttons 1 and 3 in the mapping

2001-10-18  Bradford Hovinen  <hovinen@ximian.com>

	* mouse-properties-capplet.c (apply_settings): Only swap buttons 1
	and 3 in the mapping
This commit is contained in:
Bradford Hovinen 2001-10-19 02:37:29 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 705002fcd6
commit 4b9ca59ec9
3 changed files with 31 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2001-10-18 Bradford Hovinen <hovinen@ximian.com>
* mouse-properties-capplet.c (apply_settings): Only swap buttons 1
and 3 in the mapping
2001-10-12 Bradford Hovinen <hovinen@ximian.com> 2001-10-12 Bradford Hovinen <hovinen@ximian.com>
* Makefile.am: Make OAF file creation generic * Makefile.am: Make OAF file creation generic

View file

@ -53,7 +53,7 @@ static void
apply_settings (Bonobo_ConfigDatabase db) apply_settings (Bonobo_ConfigDatabase db)
{ {
unsigned char buttons[MAX_BUTTONS], i; unsigned char buttons[MAX_BUTTONS], i;
int nbuttons, num, max, den; int nbuttons, num, den, idx_1 = 0, idx_3 = 1;
ulong accel, threshold; ulong accel, threshold;
gboolean rtol; gboolean rtol;
CORBA_Environment ev; CORBA_Environment ev;
@ -63,9 +63,18 @@ apply_settings (Bonobo_ConfigDatabase db)
rtol = bonobo_config_get_ulong (db, "/main/right-to-left", &ev); rtol = bonobo_config_get_ulong (db, "/main/right-to-left", &ev);
nbuttons = XGetPointerMapping (GDK_DISPLAY (), buttons, MAX_BUTTONS); nbuttons = XGetPointerMapping (GDK_DISPLAY (), buttons, MAX_BUTTONS);
max = MIN (nbuttons, 3);
for (i = 0; i < max; i++) for (i = 0; i < nbuttons; i++) {
buttons[i] = rtol ? (max - i) : (i + 1); if (buttons[i] == 1)
idx_1 = i;
else if (buttons[i] == ((nbuttons < 3) ? 2 : 3))
idx_3 = i;
}
if ((rtol && idx_1 < idx_3) || (!rtol && idx_1 > idx_3)) {
buttons[idx_1] = ((nbuttons < 3) ? 2 : 3);
buttons[idx_3] = 1;
}
XSetPointerMapping (GDK_DISPLAY (), buttons, nbuttons); XSetPointerMapping (GDK_DISPLAY (), buttons, nbuttons);

View file

@ -53,7 +53,7 @@ static void
apply_settings (Bonobo_ConfigDatabase db) apply_settings (Bonobo_ConfigDatabase db)
{ {
unsigned char buttons[MAX_BUTTONS], i; unsigned char buttons[MAX_BUTTONS], i;
int nbuttons, num, max, den; int nbuttons, num, den, idx_1 = 0, idx_3 = 1;
ulong accel, threshold; ulong accel, threshold;
gboolean rtol; gboolean rtol;
CORBA_Environment ev; CORBA_Environment ev;
@ -63,9 +63,18 @@ apply_settings (Bonobo_ConfigDatabase db)
rtol = bonobo_config_get_ulong (db, "/main/right-to-left", &ev); rtol = bonobo_config_get_ulong (db, "/main/right-to-left", &ev);
nbuttons = XGetPointerMapping (GDK_DISPLAY (), buttons, MAX_BUTTONS); nbuttons = XGetPointerMapping (GDK_DISPLAY (), buttons, MAX_BUTTONS);
max = MIN (nbuttons, 3);
for (i = 0; i < max; i++) for (i = 0; i < nbuttons; i++) {
buttons[i] = rtol ? (max - i) : (i + 1); if (buttons[i] == 1)
idx_1 = i;
else if (buttons[i] == ((nbuttons < 3) ? 2 : 3))
idx_3 = i;
}
if ((rtol && idx_1 < idx_3) || (!rtol && idx_1 > idx_3)) {
buttons[idx_1] = ((nbuttons < 3) ? 2 : 3);
buttons[idx_3] = 1;
}
XSetPointerMapping (GDK_DISPLAY (), buttons, nbuttons); XSetPointerMapping (GDK_DISPLAY (), buttons, nbuttons);