[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/44] input: mouse: add graphic_rotate support
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 20/44] input: mouse: add graphic_rotate support |
Date: |
Mon, 24 Feb 2014 12:52:27 +0100 |
Transform absolute mouse events according to graphic_rotate.
Legacy input code does it for both absolute and relative events,
but the logic is broken for relative coordinates, so this is
most likely not used anyway.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/input.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/ui/input.c b/ui/input.c
index a02172e..2c4d4d6 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -50,6 +50,33 @@ qemu_input_find_handler(uint32_t mask)
return NULL;
}
+static void qemu_input_transform_abs_rotate(InputEvent *evt)
+{
+ switch (graphic_rotate) {
+ case 90:
+ if (evt->abs->axis == INPUT_AXIS_X) {
+ evt->abs->axis = INPUT_AXIS_Y;
+ }
+ if (evt->abs->axis == INPUT_AXIS_Y) {
+ evt->abs->axis = INPUT_AXIS_X;
+ evt->abs->axis = INPUT_EVENT_ABS_SIZE - 1 - evt->abs->axis;
+ }
+ break;
+ case 180:
+ evt->abs->axis = INPUT_EVENT_ABS_SIZE - 1 - evt->abs->axis;
+ break;
+ case 270:
+ if (evt->abs->axis == INPUT_AXIS_X) {
+ evt->abs->axis = INPUT_AXIS_Y;
+ evt->abs->axis = INPUT_EVENT_ABS_SIZE - 1 - evt->abs->axis;
+ }
+ if (evt->abs->axis == INPUT_AXIS_Y) {
+ evt->abs->axis = INPUT_AXIS_X;
+ }
+ break;
+ }
+}
+
void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
{
QemuInputHandlerState *s;
@@ -58,6 +85,12 @@ void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
return;
}
+ /* pre processing */
+ if (graphic_rotate && (evt->kind == INPUT_EVENT_KIND_ABS)) {
+ qemu_input_transform_abs_rotate(evt);
+ }
+
+ /* send event */
s = qemu_input_find_handler(1 << evt->kind);
s->handler->event(s->dev, src, evt);
s->events++;
--
1.8.3.1
- [Qemu-devel] [PATCH 36/44] input: move mouse mode notifier to new core, (continued)
- [Qemu-devel] [PATCH 36/44] input: move mouse mode notifier to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 28/44] input: mouse: switch monitor to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 41/44] input: move do_mouse_set to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 43/44] console: add head to index to qemu consoles., Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 03/44] sdl2: remove text console logic, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 13/44] input: keyboard: switch gtk ui to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 12/44] input: keyboard: switch qmp_send_key() to new core., Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 23/44] input: mouse: switch gtk ui to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 37/44] input: add input_mouse_mode tracepoint, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 22/44] input: mouse: switch legacy handlers to new core, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 20/44] input: mouse: add graphic_rotate support,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 44/44] console: add QemuUIInfo, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 38/44] sdl2: simplify keymap handling, Gerd Hoffmann, 2014/02/24
- [Qemu-devel] [PATCH 39/44] sdl2: codestyle fixups, Gerd Hoffmann, 2014/02/24
- Re: [Qemu-devel] [PULL v2 00/44] rework input handling, sdl2 support, Peter Maydell, 2014/02/26