Bug 150361 - left handed option for mouse broken with xorg-7.3
Summary: left handed option for mouse broken with xorg-7.3
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Miscellaneous
Component: kcmmouse (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Marie Loise Nolden
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-30 21:15 UTC by Sascha Jüngling
Modified: 2008-01-13 19:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Jüngling 2007-09-30 21:15:13 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    Gentoo Packages
Compiler:          gcc-4.2.0 CFLAGS="-O3 -march=pentium-m -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu"
OS:                Linux

Using xorg-7.3 the "Left Handed" option in the KDE Control Center -> Peripherals -> Mouse does not work anymore. IT remains Right Handed all the time. Using KDE 3.5.7, Xorg-7.3, xorg-server-1.4, xf86-input-evdev-1.1.5.

I know that there are already several other bugreports regarding non-functioning Left Handed option, but they are all from way earlier times and seem unrelated to this report. It used to work fine in xorg-7.2 and just stopped in xorg-7.3. I asked someone else on the #kde IRC channel to confirm it and he did confirm (User Sho_).

I was unsure if I should report it here, or to the xorg bugtracker (freedesktop.org), but on your IRC channel I was advised to post it here; if inappropriate I would be redirected to the Xorg guys. Also, I wouldn't know what to tell the Xorg group. If I said "The KDE 'Left Handed' option does not work anymore", they for sure would say "Please contact the KDE guys for this." ;).

This error is pretty easy to reproduce. If you have xorg-7.3 installed, just go to the menu I described in the first paragraph, Apply and see if it works, or not.
Comment 1 Maksim Orlovich 2008-01-13 00:50:23 UTC
It's actually a bit of both --- for some reasons X is claiming that your (and mine, etc., etc.) mouse has ~32 buttons. And the code in KDE screws up when X claims > 20 buttons. Both need to be fixed. The below fixes the KDE part

--- mouse.cpp   (revision 758405)
+++ mouse.cpp   (working copy)
@@ -767,8 +767,12 @@
   XChangePointerControl( QX11Info::display(),
                          true, true, int(qRound(accelRate*10)), 10, thresholdMove);
 
-  unsigned char map[20];
-  num_buttons = XGetPointerMapping(QX11Info::display(), map, 20);
+  // 256 might seems extreme, but X has already been known to return 32,
+  // and we don't want to truncate things. Xlib limits the table to 256 bytes,
+  // so it's a good uper bound..
+  unsigned char map[256];
+  num_buttons = XGetPointerMapping(QX11Info::display(), map, 256);
+
   int remap=(num_buttons>=1);
   if (handedEnabled && (m_handedNeedsApply || force)) {
       if( num_buttons == 1 )
Comment 2 Sascha Jüngling 2008-01-13 17:37:43 UTC
Ahhh, great news.

Will that fix be included in the next KDE 3.5 release (if there will be any), or will it only be in KDE4 (or will it make its way to KDE4 at all? :P).

Regarding the X thing: How are we going to proceed with this? Did you guys already report this to Xorg, or am I supposed to report that to them...?


I can't test your patch yet, as my Laptop is broken and being serviced, I'm currently not on my own laptop and this one runs Windows :P
Comment 3 Maksim Orlovich 2008-01-13 18:31:12 UTC
SVN commit 760911 by orlovich:

Ubreak support for left-handed mice on recent X versions.
This code assumed that all mice had less than 20 buttons, but for some reason new Xorg 
thinks that lots of mice have 32(!!)

CCBUG: 150361


 M  +6 -2      mouse.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=760911
Comment 4 Maksim Orlovich 2008-01-13 18:52:32 UTC
SVN commit 760917 by orlovich:

automatically merged revision 760911:
Ubreak support for left-handed mice on recent X versions.
This code assumed that all mice had less than 20 buttons, but for some reason new Xorg 
thinks that lots of mice have 32(!!)

CCBUG: 150361

 M  +6 -2      mouse.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=760917
Comment 5 Maksim Orlovich 2008-01-13 19:00:01 UTC
SVN commit 760922 by orlovich:

Backport fix for left-handed mice and recent X..

BUG: 150361


 M  +6 -2      mouse.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=760922
Comment 6 Maksim Orlovich 2008-01-13 19:01:45 UTC
That's fixed for 3.5.9, 4.0.1, and 4.1...
Comment 7 Sascha Jüngling 2008-01-13 19:56:06 UTC
Okay cool, thanks for the heads up.

How about Xorg? Are they aware of the issue?