Fix invisible cursor bug
Add upstream patches fixing issues with the cursor becoming invisible in wayland environments Resolves: rhbz#1528200
This commit is contained in:
parent
630bb691f9
commit
54d1204a92
@ -0,0 +1,67 @@
|
||||
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
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 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
|
||||
---
|
||||
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
|
||||
--- a/src/spice-widget.c
|
||||
+++ b/src/spice-widget.c
|
||||
@@ -1805,8 +1805,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);
|
32
0005-meson-ensure-correct-build-order-of-VAPI.patch
Normal file
32
0005-meson-ensure-correct-build-order-of-VAPI.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Rasmus Thomsen <rasmus.thomsen@protonmail.com>
|
||||
Date: Sun, 20 Jan 2019 02:09:53 +0100
|
||||
Subject: [PATCH] meson: ensure correct build order of VAPI
|
||||
|
||||
Without this commit spice-client-gtk-3.0.vapi may be built
|
||||
before spice-client-glib-2.0.vapi if build_jobs > 1. This causes
|
||||
the build to fail because the former depends on the latter
|
||||
---
|
||||
vapi/meson.build | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/vapi/meson.build b/vapi/meson.build
|
||||
index 2c4caa0..c9fef3d 100644
|
||||
--- a/vapi/meson.build
|
||||
+++ b/vapi/meson.build
|
||||
@@ -1,12 +1,13 @@
|
||||
if spice_gtk_has_vala
|
||||
- gnome.generate_vapi('spice-client-glib-2.0',
|
||||
+ spice_glib_vapi = gnome.generate_vapi('spice-client-glib-2.0',
|
||||
install : true,
|
||||
packages : ['gio-2.0', 'gstreamer-1.0'],
|
||||
sources : spice_client_glib_gir[0])
|
||||
+
|
||||
if spice_gtk_has_gtk
|
||||
gnome.generate_vapi('spice-client-gtk-3.0',
|
||||
install : true,
|
||||
- packages : ['gtk+-3.0', 'gstreamer-1.0', 'spice-client-glib-2.0'],
|
||||
+ packages : ['gtk+-3.0', 'gstreamer-1.0', spice_glib_vapi],
|
||||
gir_dirs : join_paths(meson.build_root(), 'src'),
|
||||
vapi_dirs : meson.current_build_dir(),
|
||||
sources : spice_client_gtk_gir[0])
|
@ -2,7 +2,7 @@
|
||||
|
||||
Name: spice-gtk
|
||||
Version: 0.36
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: A GTK+ widget for SPICE clients
|
||||
|
||||
License: LGPLv2+
|
||||
@ -12,6 +12,9 @@ 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
|
||||
Patch0004: 0004-spice-widget-Ungrab-mouse-on-leave-event-on-Wayland.patch
|
||||
Patch0005: 0005-meson-ensure-correct-build-order-of-VAPI.patch
|
||||
|
||||
BuildRequires: git-core
|
||||
BuildRequires: meson
|
||||
@ -183,6 +186,11 @@ spicy-screenshot is a tool to capture screen-shots of a SPICE desktop.
|
||||
%{_bindir}/spicy-stats
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
Resolves: rhbz#1528200
|
||||
|
||||
* Mon Feb 04 2019 Kalev Lember <klember@redhat.com> - 0.36-3
|
||||
- Update BRs for vala packaging changes
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user