[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 2/3] ps2: add support for mice with extra/side bu
From: |
Fabian Lesniak |
Subject: |
[Qemu-devel] [PATCH v3 2/3] ps2: add support for mice with extra/side buttons |
Date: |
Tue, 6 Dec 2016 20:00:06 +0100 |
This enables the ps2 controller to process mouse events for buttons 4 and 5.
Additionally, distinct definitions for the ps2 mouse button state are
introduced. The legacy definitions from console.h are not used anymore.
Signed-off-by: Fabian Lesniak <address@hidden>
---
hw/input/ps2.c | 8 +++++---
include/hw/input/ps2.h | 6 ++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 0d14de0..598cc86 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -871,9 +871,11 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole
*src,
InputEvent *evt)
{
static const int bmap[INPUT_BUTTON__MAX] = {
- [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
- [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
- [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON,
+ [INPUT_BUTTON_LEFT] = PS2_MOUSE_BUTTON_LEFT,
+ [INPUT_BUTTON_MIDDLE] = PS2_MOUSE_BUTTON_MIDDLE,
+ [INPUT_BUTTON_RIGHT] = PS2_MOUSE_BUTTON_RIGHT,
+ [INPUT_BUTTON_SIDE] = PS2_MOUSE_BUTTON_SIDE,
+ [INPUT_BUTTON_EXTRA] = PS2_MOUSE_BUTTON_EXTRA,
};
PS2MouseState *s = (PS2MouseState *)dev;
InputMoveEvent *move;
diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h
index b9ceee4..0fec91c 100644
--- a/include/hw/input/ps2.h
+++ b/include/hw/input/ps2.h
@@ -25,6 +25,12 @@
#ifndef HW_PS2_H
#define HW_PS2_H
+#define PS2_MOUSE_BUTTON_LEFT 0x01
+#define PS2_MOUSE_BUTTON_MIDDLE 0x02
+#define PS2_MOUSE_BUTTON_RIGHT 0x04
+#define PS2_MOUSE_BUTTON_SIDE 0x08
+#define PS2_MOUSE_BUTTON_EXTRA 0x10
+
/* ps2.c */
void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg);
void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg);
--
2.10.2