[PATCH spice-gtk 2/2] widget: Set cursor during construction

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

 



In a multimonitor environment can easily happen that a cursor is set
before some of the SpiceDisplays are created. IOW the first created
SpiceDisplay has the cursor but others don't.

To avoid the issue check for the cursor in SpiceChannelCursorGtk.

Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1411380
---
 src/channel-cursor-gtk.c | 6 ++++++
 src/channel-cursor-gtk.h | 1 +
 src/spice-widget.c       | 6 ++++++
 3 files changed, 13 insertions(+)

diff --git a/src/channel-cursor-gtk.c b/src/channel-cursor-gtk.c
index 26b5319..c7712d1 100644
--- a/src/channel-cursor-gtk.c
+++ b/src/channel-cursor-gtk.c
@@ -261,3 +261,9 @@ void spice_cursor_channel_gtk_get_hotspot(SpiceCursorChannelGtk *self, GdkPoint
 
     *hotspot = self->hotspot;
 }
+
+gboolean spice_channel_gtk_has_cursor(SpiceCursorChannelGtk *self)
+{
+    g_return_val_if_fail(SPICE_IS_CURSOR_CHANNEL_GTK(self), FALSE);
+    return self->cursor_pixbuf != NULL;
+}
diff --git a/src/channel-cursor-gtk.h b/src/channel-cursor-gtk.h
index 63d3321..1f859c0 100644
--- a/src/channel-cursor-gtk.h
+++ b/src/channel-cursor-gtk.h
@@ -45,6 +45,7 @@ GType spice_cursor_channel_gtk_get_type(void);
 
 SpiceCursorChannelGtk *spice_cursor_channel_gtk_get(SpiceCursorChannel *channel);
 void spice_cursor_channel_gtk_get_hotspot(SpiceCursorChannelGtk *self, GdkPoint *hotspot);
+gboolean spice_channel_gtk_has_cursor(SpiceCursorChannelGtk *self);
 
 G_END_DECLS
 
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 503644b..c36f13b 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2963,6 +2963,12 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
         spice_g_signal_connect_object(channel, "cursor-reset",
                                       G_CALLBACK(cursor_reset), display, 0);
         spice_channel_connect(channel);
+
+        /* Set the initial cursor in case the cursor channel has been initialized
+           See https://bugzilla.redhat.com/show_bug.cgi?id=1411380 */
+        if (spice_channel_gtk_has_cursor(channel_gtk)) {
+            cursor_set(channel_gtk, NULL, display);
+        }
         return;
     }
 
-- 
2.12.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]