diff mbox

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

Message ID 2cea01d3e442$336dba80$9a492f80$@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

dantmnf2@gmail.com May 5, 2018, 7:25 a.m. UTC
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@gmail.com>
---
 drivers/input/mouse/vmmouse.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

 			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);
diff mbox

Patch

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) {