[PATCH] Input: vmmouse - report wheel events to device used by movement events

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

 



The vmmouse driver prefers to "report button events on the same device where
we report motion events", but it says "Xorg seems to ignore wheel events on
absolute devices" so it always report wheel event to the relative device.
Seems it is caused by a missing REL_WHEEL capability bit and has been fixed.

Reporting wheel events to a device different from movement events is causing
problems in applications using XInput2 (for example: GTK+ 3 and Qt 5 apps):
application doesn't respond to wheel while you are moving mouse.

Tested with some GTK+ 3 and Qt 5 applications.

Signed-off-by: Wu Bangming <dantmnf2@xxxxxxxxx>
---
 drivers/input/mouse/vmmouse.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c
index 1ae5c1ef..a4252447 100644
--- a/drivers/input/mouse/vmmouse.c
+++ b/drivers/input/mouse/vmmouse.c
@@ -180,9 +180,6 @@ static psmouse_ret_t vmmouse_report_events(struct
psmouse *psmouse)
 		/*
 		 * And report what we've got. Prefer to report button
 		 * events on the same device where we report motion events.
-		 * This doesn't work well with the mouse wheel, though. See
-		 * below. Ideally we would want to report that on the
-		 * preferred device as well.
 		 */
 		if (status & VMMOUSE_RELATIVE_PACKET) {
 			pref_dev = rel_dev;
@@ -194,8 +191,7 @@ static psmouse_ret_t vmmouse_report_events(struct
psmouse *psmouse)
 			input_report_abs(abs_dev, ABS_Y, y);
 		}
 
-		/* Xorg seems to ignore wheel events on absolute devices */
-		input_report_rel(rel_dev, REL_WHEEL, -(s8)((u8) z));
+		input_report_rel(pref_dev, REL_WHEEL, -(s8)((u8) z));
 
 		vmmouse_report_button(psmouse, abs_dev, rel_dev,
 				      pref_dev, BTN_LEFT,
@@ -462,6 +458,7 @@ int vmmouse_init(struct psmouse *psmouse)
 	input_set_capability(abs_dev, EV_KEY, BTN_MIDDLE);
 	input_set_capability(abs_dev, EV_ABS, ABS_X);
 	input_set_capability(abs_dev, EV_ABS, ABS_Y);
+	input_set_capability(abs_dev, EV_REL, REL_WHEEL);
 	input_set_abs_params(abs_dev, ABS_X, 0, VMMOUSE_MAX_X, 0, 0);
 	input_set_abs_params(abs_dev, ABS_Y, 0, VMMOUSE_MAX_Y, 0, 0);
 
-- 
2.15.1


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux