[Spice-commits] src/spice-widget.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Wed Feb 3 19:13:43 UTC 2016


 src/spice-widget.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 57df040cc5df1c4748bb19eef23e6c13efb7eb93
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Wed Dec 23 14:01:05 2015 +0100

    gtk: replace configure-event for size-allocate
    
    For size-allocate, it's simpler to connect to the signal rather than
    override the default signal handler since there is no automatic chaining
    to parent handler otherwise. Doing this removes the need to have a
    window.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 614d93e..a1a68a6 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -116,6 +116,7 @@ static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer dat
 static void cursor_invalidate(SpiceDisplay *display);
 static void update_area(SpiceDisplay *display, gint x, gint y, gint width, gint height);
 static void release_keys(SpiceDisplay *display);
+static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer data);
 
 /* ---------------------------------------------------------------- */
 
@@ -560,9 +561,9 @@ static void spice_display_init(SpiceDisplay *display)
     gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_ALL, &targets, 1, GDK_ACTION_COPY);
     g_signal_connect(display, "drag-data-received",
                      G_CALLBACK(drag_data_received_callback), NULL);
+    g_signal_connect(display, "size-allocate", G_CALLBACK(size_allocate), NULL);
 
     gtk_widget_add_events(widget,
-                          GDK_STRUCTURE_MASK |
                           GDK_POINTER_MOTION_MASK |
                           GDK_BUTTON_PRESS_MASK |
                           GDK_BUTTON_RELEASE_MASK |
@@ -577,7 +578,6 @@ static void spice_display_init(SpiceDisplay *display)
     gtk_widget_set_double_buffered(widget, true);
 #endif
     gtk_widget_set_can_focus(widget, true);
-    gtk_widget_set_has_window(widget, true);
     d->grabseq = spice_grab_sequence_new_from_string("Control_L+Alt_L");
     d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms);
 
@@ -1746,14 +1746,14 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
     return true;
 }
 
-static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
+static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer data)
 {
     SpiceDisplay *display = SPICE_DISPLAY(widget);
     SpiceDisplayPrivate *d = display->priv;
 
     if (conf->width == d->ww && conf->height == d->wh &&
             conf->x == d->mx && conf->y == d->my) {
-        return true;
+        return;
     }
 
     if (conf->width != d->ww  || conf->height != d->wh) {
@@ -1771,8 +1771,6 @@ static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
         try_mouse_grab(display);
     }
 #endif
-
-    return true;
 }
 
 static void update_image(SpiceDisplay *display)
@@ -1826,7 +1824,6 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
     gtkwidget_class->motion_notify_event = motion_event;
     gtkwidget_class->button_press_event = button_event;
     gtkwidget_class->button_release_event = button_event;
-    gtkwidget_class->configure_event = configure_event;
     gtkwidget_class->scroll_event = scroll_event;
     gtkwidget_class->realize = realize;
     gtkwidget_class->unrealize = unrealize;


More information about the Spice-commits mailing list