Use actual upstream patches for invisible cursor bug
I made a mistake in the previous build and used patches which were only applied locally
This commit is contained in:
parent
54d1204a92
commit
59556c4023
@ -1,67 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 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: Release GdkSeat cursor on pointer ungrab
|
||||
|
||||
Using different GDK APIs to grab and ungrab the pointer device can lead
|
||||
to the cursor not reappearing on ungrab because GDK keeps a reference of
|
||||
the GdkSeat cursor.
|
||||
|
||||
Use the GdkSeat API to set a `NULL` cursor prior to ungrab the pointer
|
||||
so that the cursor is recovered after the pointer is ungrabbed.
|
||||
|
||||
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
|
||||
---
|
||||
src/spice-widget.c | 27 ++++++++++++++++++++++++++-
|
||||
1 file changed, 26 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/spice-widget.c b/src/spice-widget.c
|
||||
index 8adcc38..853cdcb 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>
|
||||
@@ -1151,9 +1154,31 @@ static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion)
|
||||
static void ungrab_pointer(G_GNUC_UNUSED SpiceDisplay *display)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
+ 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 another gdk_seat_grab() with
|
||||
+ * a NULL cursor so that the previous reference (the blank cursor)
|
||||
+ * held by the GdkSeat is released.
|
||||
+ */
|
||||
+ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default()))
|
||||
+ gdk_seat_grab(seat,
|
||||
+ gtk_widget_get_window(GTK_WIDGET(display)),
|
||||
+ GDK_SEAT_CAPABILITY_ALL_POINTING,
|
||||
+ TRUE,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL);
|
||||
+#endif
|
||||
+
|
||||
/* 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
|
||||
}
|
138
0003-spice-widget-Use-GdkSeat-API-on-Wayland.patch
Normal file
138
0003-spice-widget-Use-GdkSeat-API-on-Wayland.patch
Normal file
@ -0,0 +1,138 @@
|
||||
From 0000000000000000000000000000000000000000 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
|
||||
}
|
@ -16,15 +16,16 @@ 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 853cdcb..80ea831 100644
|
||||
index fd0c935..d924731 100644
|
||||
--- a/src/spice-widget.c
|
||||
+++ b/src/spice-widget.c
|
||||
@@ -1805,8 +1805,21 @@ static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC
|
||||
@@ -1854,8 +1854,21 @@ static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC
|
||||
|
||||
DISPLAY_DEBUG(display, "%s", __FUNCTION__);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Name: spice-gtk
|
||||
Version: 0.36
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: A GTK+ widget for SPICE clients
|
||||
|
||||
License: LGPLv2+
|
||||
@ -12,7 +12,7 @@ Source0: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_v
|
||||
|
||||
Patch0001: 0001-meson-improve-gtk-doc-build.patch
|
||||
Patch0002: 0002-meson-fix-ninja-dist-and-building-from-tarball.patch
|
||||
Patch0003: 0003-spice-widget-Release-GdkSeat-cursor-on-pointer-ungra.patch
|
||||
Patch0003: 0003-spice-widget-Use-GdkSeat-API-on-Wayland.patch
|
||||
Patch0004: 0004-spice-widget-Ungrab-mouse-on-leave-event-on-Wayland.patch
|
||||
Patch0005: 0005-meson-ensure-correct-build-order-of-VAPI.patch
|
||||
|
||||
@ -186,6 +186,10 @@ spicy-screenshot is a tool to capture screen-shots of a SPICE desktop.
|
||||
%{_bindir}/spicy-stats
|
||||
|
||||
%changelog
|
||||
* Thu Mar 07 2019 Christophe Fergeau <cfergeau@redhat.com> - 0.36-5
|
||||
- Use actual upstream patches, I made a mistake in the previous build
|
||||
and used patches which were only applied locally
|
||||
|
||||
* Thu Feb 21 2019 Christophe Fergeau <cfergeau@redhat.com> - 0.36-4
|
||||
- Add upstream patches fixing issues with the cursor becoming invisible
|
||||
in wayland environments
|
||||
|
Loading…
Reference in New Issue
Block a user