[gnome-boxes/flatpak-build-with-newer-spice-gtk] flatpak: Update spice-gtk to 0.36



commit 68a0fff84902c713dfdaa0dc7cf2f267256198c1
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Mar 6 12:18:42 2019 +0100

    flatpak: Update spice-gtk to 0.36
    
    0.36 fixes the issues users were having with cursor disappearing
    in the display.
    
    Fixes #259

 build-aux/flatpak/org.gnome.Boxes.json             |  19 ++-
 ...k-ungrab-mounse-on-leave-event-on-wayland.patch |  53 ++++++++
 .../spice-gtk-use-gdkseat-api-on-wayland.patch     | 141 +++++++++++++++++++++
 3 files changed, 208 insertions(+), 5 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Boxes.json b/build-aux/flatpak/org.gnome.Boxes.json
index c5f936b4..dc13a6f1 100644
--- a/build-aux/flatpak/org.gnome.Boxes.json
+++ b/build-aux/flatpak/org.gnome.Boxes.json
@@ -147,8 +147,8 @@
             "sources" : [
                 {
                     "type" : "archive",
-                    "url" : "https://www.spice-space.org/download/releases/spice-protocol-0.12.13.tar.bz2";,
-                    "sha256" : "89ee11b202d2268e061788e6ace114e1ff18c7620ae64d1ca3aba252ee7c9933"
+                    "url" : "https://www.spice-space.org/download/releases/spice-protocol-0.12.15.tar.bz2";,
+                    "sha256" : "8b4db23baa4b1337a50d049d9bf43f932331dd95f204836c0ce46c4962306419"
                 }
             ]
         },
@@ -217,13 +217,22 @@
                 "--enable-vala",
                 "--disable-gtk-doc",
                 "--enable-python-checks",
-                "--enable-webdav"
+                "--enable-webdav",
+                "--enable-celt051"
             ],
             "sources" : [
                 {
                     "type" : "archive",
-                    "url" : "https://www.spice-space.org/download/gtk/spice-gtk-0.34.tar.bz2";,
-                    "sha256" : "e9720e01165f8451c9f3f58ad50e3afb990993b81cc2db86b3661b7ac5b976ee"
+                    "url" : "https://www.spice-space.org/download/gtk/spice-gtk-0.36.tar.bz2";,
+                    "sha256" : "7126c3584df12d40dcf4970f5f46fafd65b757620f911687e549f7da5c8fd7cd"
+                },
+                {
+                    "type" : "patch",
+                    "path" : "spice-gtk-use-gdkseat-api-on-wayland.patch"
+                },
+                {
+                    "type" : "patch",
+                    "path" : "spice-gtk-ungrab-mounse-on-leave-event-on-wayland.patch"
                 }
             ]
         },
diff --git a/build-aux/flatpak/spice-gtk-ungrab-mounse-on-leave-event-on-wayland.patch 
b/build-aux/flatpak/spice-gtk-ungrab-mounse-on-leave-event-on-wayland.patch
new file mode 100644
index 00000000..3644dfe3
--- /dev/null
+++ b/build-aux/flatpak/spice-gtk-ungrab-mounse-on-leave-event-on-wayland.patch
@@ -0,0 +1,53 @@
+From e1bf254f60d78d6a4e7b0664d344b6bfcb70f2ae Mon Sep 17 00:00:00 2001
+From: Olivier Fourdan <ofourdan redhat com>
+Date: Fri, 1 Feb 2019 14:35:39 +0100
+Subject: [PATCH] spice-widget: Ungrab mouse on leave event on Wayland
+
+The Spice Gtk widget relies on pointer grabs to receive all pointer
+events even after the pointer has left the window.
+
+While that works on X11, on Wayland there is no active pointer grab,
+so once the pointer has left the SPICE widget on Wayland, the events
+are routed to the window with the pointer focus instead of ours.
+
+To avoid the problem, on Wayland, we simply ungrab the pointer once it
+leaves the window.
+
+Thanks-to: Peter Hutterer <peter hutterer who-t net>
+Signed-off-by: Olivier Fourdan <ofourdan redhat com>
+https://gitlab.freedesktop.org/spice/spice-gtk/issues/83
+Acked-by: Victor Toso <victortoso redhat com>
+---
+ src/spice-widget.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/src/spice-widget.c b/src/spice-widget.c
+index fd0c935..d924731 100644
+--- a/src/spice-widget.c
++++ b/src/spice-widget.c
+@@ -1854,8 +1854,21 @@ static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC
+ 
+     DISPLAY_DEBUG(display, "%s", __FUNCTION__);
+ 
+-    if (d->mouse_grab_active)
++    if (d->mouse_grab_active) {
++#ifdef GDK_WINDOWING_WAYLAND
++        /* On Wayland, there is no active pointer grab, so once the pointer
++         * has left the window, the events are routed to the window with
++         * pointer focus instead of ours, in which case we should just
++         * ungrab to avoid nasty side effects. */
++        if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
++            GdkWindow *window = gtk_widget_get_window(widget);
++
++            if (window == crossing->window)
++                try_mouse_ungrab(display);
++        }
++#endif
+         return true;
++    }
+ 
+     d->mouse_have_pointer = false;
+     spice_gtk_session_set_mouse_has_pointer(d->gtk_session, false);
+-- 
+2.20.1
+
diff --git a/build-aux/flatpak/spice-gtk-use-gdkseat-api-on-wayland.patch 
b/build-aux/flatpak/spice-gtk-use-gdkseat-api-on-wayland.patch
new file mode 100644
index 00000000..2b7867fb
--- /dev/null
+++ b/build-aux/flatpak/spice-gtk-use-gdkseat-api-on-wayland.patch
@@ -0,0 +1,141 @@
+From ae3a8e1b2d952385646046e33f12d8540407f0a5 Mon Sep 17 00:00:00 2001
+From: Olivier Fourdan <ofourdan redhat com>
+Date: Wed, 6 Feb 2019 15:42:53 +0100
+Subject: [PATCH] spice-widget: Use GdkSeat API on Wayland
+
+Using different GDK APIs to grab and ungrab devices leads to
+undetermined behavior and can cause the cursor to remain hidden on
+ungrab on Wayland because GDK Wayland backend keeps a reference of
+the GdkSeat cursor.
+
+On Wayland, use the GdkSeat API only even for ungrab, by ungrabbing the
+seat and immediately re-grabbing the remaining keyboard or pointer if
+the grab is to be retained.
+
+Thanks-to: Peter Hutterer <peter hutterer who-t net>
+Signed-off-by: Olivier Fourdan <ofourdan redhat com>
+Fixes: https://gitlab.freedesktop.org/spice/spice-gtk/issues/83
+See-also: https://gitlab.gnome.org/GNOME/gtk/issues/787
+Acked-by: Victor Toso <victortoso redhat com>
+---
+ src/spice-widget.c | 82 +++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 78 insertions(+), 4 deletions(-)
+
+diff --git a/src/spice-widget.c b/src/spice-widget.c
+index 8adcc38..fd0c935 100644
+--- a/src/spice-widget.c
++++ b/src/spice-widget.c
+@@ -32,6 +32,9 @@
+ #include <va/va_x11.h>
+ #endif
+ #endif
++#ifdef GDK_WINDOWING_WAYLAND
++#include <gdk/gdkwayland.h>
++#endif
+ #ifdef G_OS_WIN32
+ #include <windows.h>
+ #include <dinput.h>
+@@ -887,12 +890,46 @@ static void try_keyboard_grab(SpiceDisplay *display)
+     }
+ }
+ 
+-static void ungrab_keyboard(G_GNUC_UNUSED SpiceDisplay *display)
++static void ungrab_keyboard(SpiceDisplay *display)
+ {
++    GdkSeat *seat = spice_display_get_default_seat(display);
++    GdkDevice *keyboard = gdk_seat_get_keyboard(seat);
++
++#ifdef GDK_WINDOWING_WAYLAND
++    /* On Wayland, use the GdkSeat API alone.
++     * We simply issue a gdk_seat_ungrab() followed immediately by another
++     * gdk_seat_grab() on the pointer if the pointer grab is to be kept.
++     */
++    if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
++        SpiceDisplayPrivate *d = display->priv;
++
++        gdk_seat_ungrab(seat);
++
++        if (d->mouse_grab_active) {
++            GdkGrabStatus status;
++            GdkCursor *blank = spice_display_get_blank_cursor(display);
++
++            status = gdk_seat_grab(seat,
++                                   gtk_widget_get_window(GTK_WIDGET(display)),
++                                   GDK_SEAT_CAPABILITY_ALL_POINTING,
++                                   TRUE,
++                                   blank,
++                                   NULL,
++                                   NULL,
++                                   NULL);
++            if (status != GDK_GRAB_SUCCESS) {
++                g_warning("pointer grab failed %u", status);
++                d->mouse_grab_active = false;
++            }
++        }
++
++        return;
++    }
++#endif
++
+     G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+     /* we want to ungrab just the keyboard - it is not possible using gdk_seat_ungrab().
+        See also https://bugzilla.gnome.org/show_bug.cgi?id=780133 */
+-    GdkDevice *keyboard = gdk_seat_get_keyboard(spice_display_get_default_seat(display));
+     gdk_device_ungrab(keyboard, GDK_CURRENT_TIME);
+     G_GNUC_END_IGNORE_DEPRECATIONS
+ }
+@@ -1148,12 +1185,49 @@ static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion)
+ 
+ }
+ 
+-static void ungrab_pointer(G_GNUC_UNUSED SpiceDisplay *display)
++static void ungrab_pointer(SpiceDisplay *display)
+ {
++    GdkSeat *seat = spice_display_get_default_seat(display);
++    GdkDevice *pointer = gdk_seat_get_pointer(seat);
++
++#ifdef GDK_WINDOWING_WAYLAND
++    /* On Wayland, mixing the GdkSeat and the GdkDevice APIs leave the
++     * cursor unchanged because the GDK Wayland backend keeps a reference
++     * of the cursor set previously using gdk_seat_grab() attached to the
++     * GdkSeat.
++     * To avoid that issue, we simply issue a gdk_seat_ungrab() followed
++     * immediately by another gdk_seat_grab() on the keyboard if the
++     * keyboard grab is to be kept.
++     */
++    if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
++        SpiceDisplayPrivate *d = display->priv;
++
++        gdk_seat_ungrab(seat);
++
++        if (d->keyboard_grab_active) {
++            GdkGrabStatus status;
++
++            status = gdk_seat_grab(seat,
++                                   gtk_widget_get_window(GTK_WIDGET(display)),
++                                   GDK_SEAT_CAPABILITY_KEYBOARD,
++                                   FALSE,
++                                   NULL,
++                                   NULL,
++                                   NULL,
++                                   NULL);
++            if (status != GDK_GRAB_SUCCESS) {
++                g_warning("keyboard grab failed %u", status);
++                d->keyboard_grab_active = false;
++            }
++        }
++
++        return;
++    }
++#endif
++
+     G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+     /* we want to ungrab just the pointer - it is not possible using gdk_seat_ungrab().
+        See also https://bugzilla.gnome.org/show_bug.cgi?id=780133 */
+-    GdkDevice *pointer = gdk_seat_get_pointer(spice_display_get_default_seat(display));
+     gdk_device_ungrab(pointer, GDK_CURRENT_TIME);
+     G_GNUC_END_IGNORE_DEPRECATIONS
+ }
+-- 
+2.20.1
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]