All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons
@ 2016-12-06 19:00 Fabian Lesniak
  2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 1/3] qapi: " Fabian Lesniak
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Fabian Lesniak @ 2016-12-06 19:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fabian Lesniak

This patch implements event handling for 5-button ps/2 mice and 
appropriate event generation for gtk and input-linux input methods.

As Gerd suggested, it is now split into three parts and introduces
distinct ps2 mouse button definitions instead of using the legacy
ones from console.h. Please comment on the location of the new
definitions if inappropriate.

The changes to qapi were improved following Eric's hints.

Fabian Lesniak (3):
  qapi: add support for mice with extra/side buttons
  ps2: add support for mice with extra/side buttons
  ui: add support for mice with extra/side buttons

 hw/input/ps2.c         | 8 +++++---
 include/hw/input/ps2.h | 6 ++++++
 qapi-schema.json       | 7 ++++++-
 ui/gtk.c               | 4 ++++
 ui/input-linux.c       | 6 ++++++
 5 files changed, 27 insertions(+), 4 deletions(-)

-- 
2.10.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH v3 1/3] qapi: add support for mice with extra/side buttons
  2016-12-06 19:00 [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons Fabian Lesniak
@ 2016-12-06 19:00 ` Fabian Lesniak
  2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 2/3] ps2: " Fabian Lesniak
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Fabian Lesniak @ 2016-12-06 19:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fabian Lesniak

Adds "side" and "extra" values to enum InputButton. The naming was borrowed
from evdev since it is more descriptive than "button4" and "button5".

Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de>
---
 qapi-schema.json | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index f3e9bfc..7f3272f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4277,10 +4277,15 @@
 #
 # Button of a pointer input device (mouse, tablet).
 #
+# @side: front side button of a 5-button mouse (since 2.9)
+#
+# @extra: rear side button of a 5-button mouse (since 2.9)
+#
 # Since: 2.0
 ##
 { 'enum'  : 'InputButton',
-  'data'  : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down' ] }
+  'data'  : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down', 'side',
+  'extra' ] }
 
 ##
 # @InputAxis
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH v3 2/3] ps2: add support for mice with extra/side buttons
  2016-12-06 19:00 [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons Fabian Lesniak
  2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 1/3] qapi: " Fabian Lesniak
@ 2016-12-06 19:00 ` Fabian Lesniak
  2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 3/3] ui: " Fabian Lesniak
  2017-01-09 23:47 ` [Qemu-devel] [PATCH v3 0/3] " Fabian Lesniak
  3 siblings, 0 replies; 6+ messages in thread
From: Fabian Lesniak @ 2016-12-06 19:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fabian Lesniak

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 <fabian@lesniak-it.de>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH v3 3/3] ui: add support for mice with extra/side buttons
  2016-12-06 19:00 [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons Fabian Lesniak
  2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 1/3] qapi: " Fabian Lesniak
  2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 2/3] ps2: " Fabian Lesniak
@ 2016-12-06 19:00 ` Fabian Lesniak
  2017-01-09 23:47 ` [Qemu-devel] [PATCH v3 0/3] " Fabian Lesniak
  3 siblings, 0 replies; 6+ messages in thread
From: Fabian Lesniak @ 2016-12-06 19:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fabian Lesniak

Adds input event generation for BTN_SIDE and BTN_EXTRA events to gtk and
input-linux methods.

Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de>
---
 ui/gtk.c         | 4 ++++
 ui/input-linux.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index e816428..9cdce83 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -995,6 +995,10 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button,
         btn = INPUT_BUTTON_MIDDLE;
     } else if (button->button == 3) {
         btn = INPUT_BUTTON_RIGHT;
+    } else if (button->button == 8) {
+        btn = INPUT_BUTTON_SIDE;
+    } else if (button->button == 9) {
+        btn = INPUT_BUTTON_EXTRA;
     } else {
         return TRUE;
     }
diff --git a/ui/input-linux.c b/ui/input-linux.c
index f345317..ac31f47 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -291,6 +291,12 @@ static void input_linux_handle_mouse(InputLinux *il, struct input_event *event)
             qemu_input_queue_btn(NULL, INPUT_BUTTON_WHEEL_DOWN,
                                  event->value);
             break;
+        case BTN_SIDE:
+            qemu_input_queue_btn(NULL, INPUT_BUTTON_SIDE, event->value);
+            break;
+        case BTN_EXTRA:
+            qemu_input_queue_btn(NULL, INPUT_BUTTON_EXTRA, event->value);
+            break;
         };
         break;
     case EV_REL:
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons
  2016-12-06 19:00 [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons Fabian Lesniak
                   ` (2 preceding siblings ...)
  2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 3/3] ui: " Fabian Lesniak
@ 2017-01-09 23:47 ` Fabian Lesniak
  2017-01-10 11:37   ` Gerd Hoffmann
  3 siblings, 1 reply; 6+ messages in thread
From: Fabian Lesniak @ 2017-01-09 23:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Ping.

I forgot to CC Gerd.

http://patchwork.ozlabs.org/patch/703302/

http://patchwork.ozlabs.org/patch/703304/

http://patchwork.ozlabs.org/patch/703303/


Am 06.12.2016 um 20:00 schrieb Fabian Lesniak:
> This patch implements event handling for 5-button ps/2 mice and
> appropriate event generation for gtk and input-linux input methods.
>
> As Gerd suggested, it is now split into three parts and introduces
> distinct ps2 mouse button definitions instead of using the legacy
> ones from console.h. Please comment on the location of the new
> definitions if inappropriate.
>
> The changes to qapi were improved following Eric's hints.
>
> Fabian Lesniak (3):
>    qapi: add support for mice with extra/side buttons
>    ps2: add support for mice with extra/side buttons
>    ui: add support for mice with extra/side buttons
>
>   hw/input/ps2.c         | 8 +++++---
>   include/hw/input/ps2.h | 6 ++++++
>   qapi-schema.json       | 7 ++++++-
>   ui/gtk.c               | 4 ++++
>   ui/input-linux.c       | 6 ++++++
>   5 files changed, 27 insertions(+), 4 deletions(-)
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons
  2017-01-09 23:47 ` [Qemu-devel] [PATCH v3 0/3] " Fabian Lesniak
@ 2017-01-10 11:37   ` Gerd Hoffmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2017-01-10 11:37 UTC (permalink / raw)
  To: Fabian Lesniak; +Cc: qemu-devel

On Di, 2017-01-10 at 00:47 +0100, Fabian Lesniak wrote:
> Ping.
> 
> I forgot to CC Gerd.
> 
> http://patchwork.ozlabs.org/patch/703302/
> 
> http://patchwork.ozlabs.org/patch/703304/
> 
> http://patchwork.ozlabs.org/patch/703303/

Added to ui queue now.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-10 11:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-06 19:00 [Qemu-devel] [PATCH v3 0/3] add support for mice with extra/side buttons Fabian Lesniak
2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 1/3] qapi: " Fabian Lesniak
2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 2/3] ps2: " Fabian Lesniak
2016-12-06 19:00 ` [Qemu-devel] [PATCH v3 3/3] ui: " Fabian Lesniak
2017-01-09 23:47 ` [Qemu-devel] [PATCH v3 0/3] " Fabian Lesniak
2017-01-10 11:37   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.