From c3aa84b68f45d915160a523b4d7b9c6f4cf2219c Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 10 Mar 2014 09:22:16 +0100 Subject: input: sdl: fix guest_cursor logic. Unbreaks relative mouse mode with SDL. Reported-by: Gabriel L. Somlo Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ui') diff --git a/ui/sdl.c b/ui/sdl.c index c1a16bebdc..4e7f920e37 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -455,13 +455,17 @@ static void sdl_send_mouse_event(int dx, int dy, int x, int y, int state) real_screen->w); qemu_input_queue_abs(dcl->con, INPUT_AXIS_Y, y, real_screen->h); - } else if (guest_cursor) { - x -= guest_x; - y -= guest_y; - guest_x += x; - guest_y += y; - qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, x); - qemu_input_queue_rel(dcl->con, INPUT_AXIS_Y, y); + } else { + if (guest_cursor) { + x -= guest_x; + y -= guest_y; + guest_x += x; + guest_y += y; + dx = x; + dy = y; + } + qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, dx); + qemu_input_queue_rel(dcl->con, INPUT_AXIS_Y, dy); } qemu_input_event_sync(); } -- cgit v1.2.1 From dbb2a1326a7af6159861d3d7976c251a15ce0f92 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 10 Mar 2014 09:31:01 +0100 Subject: input: map INPUT_BUTTON_WHEEL_{UP,DOWN} to legacy input z axis moves. Unbreaks mouse wheel. Reported-by: BALATON Zoltan Signed-off-by: Gerd Hoffmann --- ui/input-legacy.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ui') diff --git a/ui/input-legacy.c b/ui/input-legacy.c index f38984b192..7dc486b8ac 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -359,6 +359,20 @@ static void legacy_mouse_event(DeviceState *dev, QemuConsole *src, } else { s->buttons &= ~bmap[evt->btn->button]; } + if (evt->btn->down && evt->btn->button == INPUT_BUTTON_WHEEL_UP) { + s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, + s->axis[INPUT_AXIS_X], + s->axis[INPUT_AXIS_Y], + -1, + s->buttons); + } + if (evt->btn->down && evt->btn->button == INPUT_BUTTON_WHEEL_DOWN) { + s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, + s->axis[INPUT_AXIS_X], + s->axis[INPUT_AXIS_Y], + 1, + s->buttons); + } break; case INPUT_EVENT_KIND_ABS: s->axis[evt->abs->axis] = evt->abs->value; -- cgit v1.2.1