Re: GNOME Left-handed Mouse problem



>>>>> "Franco" == Franco Antico <antico@mindspring.com> writes:

Franco> I have a PS/2 Intellimouse and all three buttons work
Franco> (including wheel functionality.) That is great, but I'd like
Franco> it set to lefty.

Franco> I used the GNOME Control Center to set my mouse left-handed
Franco> (like you do under windows), but that doesn't work. None of
Franco> the buttons work properly after I set it to "left."

The code in control-center/capplets/mouse-properties doesn't handle
this case correctly.  And, in fact, I don't think it is entirely clear
that this code can be made to do the right thing in all cases.
Instead we might have to rehink that part of the program.

Right now it assumes that the lefty setting means to reorder the
buttons from largest to smallest.  But if you have a wheel (and a
comment in the code indicates as much), this is wrong: instead you
mustn't touch buttons 4 and 5.

We could just add a special case, like this untested patch:

1999-07-06  Tom Tromey  <tromey@cygnus.com>

	* mouse-properties.c (mouse_apply): Handle wheeled mouse.

Index: mouse-properties.c
===================================================================
RCS file: /cvs/gnome/control-center/capplets/mouse-properties/mouse-properties.c,v
retrieving revision 1.21
diff -u -r1.21 mouse-properties.c
--- mouse-properties.c	1999/03/01 16:06:22	1.21
+++ mouse-properties.c	1999/07/06 23:03:01
@@ -1,5 +1,5 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* Copyright (C) 1998 Redhat Software Inc. 
+/* Copyright (C) 1998, 1999 Redhat Software Inc. 
  * Authors: Jonathan Blandford <jrb@redhat.com>
  */
 #include <config.h>
@@ -112,11 +112,17 @@
 {
         unsigned char buttons[MAX_BUTTONS], i;
         int num, den;
+        int max;
 
         assert (mouse_nbuttons <= MAX_BUTTONS);
 
-        for (i = 0; i < mouse_nbuttons; ++i)
-                buttons[i] = mouse_rtol ? (mouse_nbuttons - i) : (i + 1);
+        /* Ignore buttons above 3 -- these are assumed to be a wheel.
+           FIXME.  */
+        max = mouse_nbuttons > 3 ? 3 : mouse_nbuttons;
+        for (i = 0; i < max; ++i)
+                buttons[i] = mouse_rtol ? (max - i) : (i + 1);
+        for (; i < mouse_nbuttons; ++i)
+                buttons[i] = i + 1;
         XSetPointerMapping (GDK_DISPLAY (), buttons, mouse_nbuttons);
 
         if (mouse_acceleration < MAX_ACCEL)


However, this patch will not work for ordinary 4/5/N>3-button mice.
Maybe that isn't a big deal.  I'll leave it to somebody else to decide
whether this is a good idea.


I don't know of a way to tell whether the mouse is wheeled or not
except to ask the user.  So adding a button for "wheeled mouse" would
probably be a rreasonable way to go.  Then the code in the patch above
would be conditional on whether the mouse had a wheel.


Incidentally, folks, you have to be careful about changing copyrights.
This file includes code that I originally wrote way back before the
control center existed.  In this case I don't care if the code is
copyright me or RedHat or whoever.  But in general changing the
copyright on a derived work is wrong, even in a case like this one,
where the size of the original code is far outweighed by the new code.

Tom



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]