[Spice-commits] 2 commits - src/channel-inputs.c src/spice-widget.c subprojects/spice-common

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 28 09:58:43 UTC 2022


 src/channel-inputs.c     |   12 ++++++++++++
 src/spice-widget.c       |   12 ++++++++++++
 subprojects/spice-common |    2 +-
 3 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 3d56b0276d97eb04522f92472acf60d0be52d6ba
Author: Frediano Ziglio <freddy77 at gmail.com>
Date:   Fri Jan 28 09:48:34 2022 +0000

    Update spice-common submodule
    
    This brings in the following changes:
    
    Frediano Ziglio (2):
          build: Correctly check for Python modules
          ci: Set WINEPATH during Windows build
    
    This fixes https://gitlab.freedesktop.org/spice/spice-gtk/-/issues/152.
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>

diff --git a/subprojects/spice-common b/subprojects/spice-common
index 96dd787..8a19611 160000
--- a/subprojects/spice-common
+++ b/subprojects/spice-common
@@ -1 +1 @@
-Subproject commit 96dd7873777583820a19c8261f5adb5807960c4d
+Subproject commit 8a1961104974587883e5ac3ebf4bd057ac556d12
commit fe6469a27feada616f67f3eeb30a53514ed6fbd0
Author: Kevin Pouget <kpouget at redhat.com>
Date:   Thu May 14 16:00:59 2020 +0200

    Capture and forward side mouse buttons (BTN_SIDE and BTN_EXTRA)
    
    Adds support for capturing and forwarding the side mouse buttons some mouses
    have, typically used in web browsers for previous/next website in history.
    (Those are presented by GDK as buttons 8 and 9.)
    
    spice-vdagent requires a corresponding patch to handle the buttons.
    
    At the spice and protocol level, the required changes were previously merged:
    * https://gitlab.freedesktop.org/spice/spice/-/issues/45
    * https://gitlab.freedesktop.org/spice/spice/-/merge_requests/140
    * https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/22
    
    This commit is a rebased and revised version of the patch by Kevin Pouget:
    https://www.spinics.net/lists/spice-devel/msg42582.html
    (I have confirmed with him that it's OK that I submit the updated patches.)
    
    Co-Authored-By: Kevin Pouget <kpouget at redhat.com>
    Co-Authored-By: Joan Bruguera <joanbrugueram at gmail.com>

diff --git a/src/channel-inputs.c b/src/channel-inputs.c
index 5e6c7b4..fcdf701 100644
--- a/src/channel-inputs.c
+++ b/src/channel-inputs.c
@@ -426,6 +426,12 @@ void spice_inputs_channel_button_press(SpiceInputsChannel *channel, gint button,
     case SPICE_MOUSE_BUTTON_RIGHT:
         button_state |= SPICE_MOUSE_BUTTON_MASK_RIGHT;
         break;
+    case SPICE_MOUSE_BUTTON_SIDE:
+        button_state |= SPICE_MOUSE_BUTTON_MASK_SIDE;
+        break;
+    case SPICE_MOUSE_BUTTON_EXTRA:
+        button_state |= SPICE_MOUSE_BUTTON_MASK_EXTRA;
+        break;
     }
 
     c->bs  = button_state;
@@ -491,6 +497,12 @@ void spice_inputs_channel_button_release(SpiceInputsChannel *channel, gint butto
     case SPICE_MOUSE_BUTTON_RIGHT:
         button_state &= ~SPICE_MOUSE_BUTTON_MASK_RIGHT;
         break;
+    case SPICE_MOUSE_BUTTON_SIDE:
+        button_state &= ~SPICE_MOUSE_BUTTON_MASK_SIDE;
+        break;
+    case SPICE_MOUSE_BUTTON_EXTRA:
+        button_state &= ~SPICE_MOUSE_BUTTON_MASK_EXTRA;
+        break;
     }
 
     c->bs = button_state;
diff --git a/src/spice-widget.c b/src/spice-widget.c
index afcf45a..5f7c061 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2037,6 +2037,8 @@ static int button_gdk_to_spice(guint gdk)
         [ 3 ] = SPICE_MOUSE_BUTTON_RIGHT,
         [ 4 ] = SPICE_MOUSE_BUTTON_UP,
         [ 5 ] = SPICE_MOUSE_BUTTON_DOWN,
+        [ 8 ] = SPICE_MOUSE_BUTTON_SIDE,
+        [ 9 ] = SPICE_MOUSE_BUTTON_EXTRA,
     };
 
     if (gdk < SPICE_N_ELEMENTS(map)) {
@@ -2051,6 +2053,8 @@ static int button_gdk_to_spice_mask(guint gdk)
         [1] = SPICE_MOUSE_BUTTON_MASK_LEFT,
         [2] = SPICE_MOUSE_BUTTON_MASK_MIDDLE,
         [3] = SPICE_MOUSE_BUTTON_MASK_RIGHT,
+        [8] = SPICE_MOUSE_BUTTON_MASK_SIDE,
+        [9] = SPICE_MOUSE_BUTTON_MASK_EXTRA,
     };
 
     if (gdk < SPICE_N_ELEMENTS(map)) {
@@ -2069,6 +2073,14 @@ static int button_mask_gdk_to_spice(int gdk)
         spice |= SPICE_MOUSE_BUTTON_MASK_MIDDLE;
     if (gdk & GDK_BUTTON3_MASK)
         spice |= SPICE_MOUSE_BUTTON_MASK_RIGHT;
+    /* Currently, GDK does not define any mask for buttons 8 and 9
+       For X11, no mask is set at all for those buttons:
+       https://gitlab.gnome.org/GNOME/gtk/-/blob/4fff68355a22027791258b900f1f39ca1226b669/gdk/x11/gdkdevice-xi2.c#L639
+       For Wayland, masks of (1 << 15) and (1 << 16) respectively are set:
+       https://gitlab.gnome.org/GNOME/gtk/-/blob/4fff68355a22027791258b900f1f39ca1226b669/gdk/wayland/gdkdevice-wayland.c#L1703
+       While the situation is unclear, completely ignore the GTK mask for SIDE and EXTRA events.
+       Also, note that callers of this function already set/unset the mask based on the button
+       code, so not setting the mask here shouldn't have a noticeable impact anyway */
     return spice;
 }
 


More information about the Spice-commits mailing list