dix: button state must show the logical buttons, not physical buttons

Submitted by Peter Hutterer on Dec. 16, 2011, 2:43 a.m.

Details

Message ID 20111216024348.GA3857@yabbi.HOME
State Accepted
Commit 76c11e0872dedcd360cbe02cf62bb9de3b212957
Headers show

Not browsing as part of any series.

Commit Message

Peter Hutterer Dec. 16, 2011, 2:43 a.m.
If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
press, but the state was set for button 1. Fix this, the state must be set
for that button's logical mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=655928

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 dix/inpututils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 50a122f..d279c1d 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -674,7 +674,7 @@  void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
 
     for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
         if (BitIsOn(mouse->button->down, i))
-            SetBit(event->buttons, i);
+            SetBit(event->buttons, mouse->button->map[i]);
 
     if (mouse && mouse->touch && mouse->touch->buttonsDown > 0)
         SetBit(event->buttons, mouse->button->map[1]);

Comments

On 12/15/2011 06:43 PM, Peter Hutterer wrote:
> If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
> press, but the state was set for button 1. Fix this, the state must be set
> for that button's logical mapping.
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=655928
> 
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

Makes sense,

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>