[Spice-devel] [4/6] [PATCH spice-gtk] Add horizontal mouse wheel support

Matthew Francis mjay.francis at gmail.com
Wed Oct 25 11:23:50 UTC 2017


Signed-off-by: Matthew Francis <mjay.francis at gmail.com>
---
 configure.ac       | 2 +-
 src/spice-widget.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 8fd525b..6c50e3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,7 +89,7 @@ AC_CHECK_LIBM
 AC_SUBST(LIBM)
 
 AC_CONFIG_SUBDIRS([spice-common])
-PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >= 0.12.13])
+PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >= 0.12.14])
 
 COMMON_CFLAGS='-I${top_builddir}/spice-common/ -I${top_srcdir}/spice-common/ ${SPICE_PROTOCOL_CFLAGS}'
 AC_SUBST(COMMON_CFLAGS)
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 5365222..baec454 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1906,6 +1906,8 @@ static int button_gdk_to_spice(guint gdk)
         [ 3 ] = SPICE_MOUSE_BUTTON_RIGHT,
         [ 4 ] = SPICE_MOUSE_BUTTON_UP,
         [ 5 ] = SPICE_MOUSE_BUTTON_DOWN,
+        [ 6 ] = SPICE_MOUSE_BUTTON_WHEEL_LEFT,
+        [ 7 ] = SPICE_MOUSE_BUTTON_WHEEL_RIGHT,
     };
 
     if (gdk < SPICE_N_ELEMENTS(map)) {
@@ -2030,6 +2032,10 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll)
         button = SPICE_MOUSE_BUTTON_UP;
     else if (scroll->direction == GDK_SCROLL_DOWN)
         button = SPICE_MOUSE_BUTTON_DOWN;
+    else if (scroll->direction == GDK_SCROLL_LEFT)
+        button = SPICE_MOUSE_BUTTON_WHEEL_LEFT;
+    else if (scroll->direction == GDK_SCROLL_RIGHT)
+        button = SPICE_MOUSE_BUTTON_WHEEL_RIGHT;
     else {
         DISPLAY_DEBUG(display, "unsupported scroll direction");
         return true;
-- 
2.7.4



More information about the Spice-devel mailing list