diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2020-11-24 22:02:53 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2020-12-07 09:46:39 +0100 |
commit | ecc861bf06e7e3f3f92c9b9f1ae7127a82bad2c8 (patch) | |
tree | 63dc0dffb1c8d3fc8a66f53840b7e7cb8191af12 /gtk | |
parent | 475c07e935b92c2cdef3a0ff24c74ebdeb694d82 (diff) | |
download | gtk+-ecc861bf06e7e3f3f92c9b9f1ae7127a82bad2c8.tar.gz |
Pass the layout signal via GdkSurface to GtkRoot
Don't have GtkRoot listen directly to the layout signal on the frame
clock, but let it pass through GdkSurface. This will allow GdkSurface to
be more involved in the layout phase.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkroot.c | 21 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 2 | ||||
-rw-r--r-- | gtk/gtkwidgetprivate.h | 2 |
3 files changed, 17 insertions, 8 deletions
diff --git a/gtk/gtkroot.c b/gtk/gtkroot.c index a480173695..6bdf1b74a1 100644 --- a/gtk/gtkroot.c +++ b/gtk/gtkroot.c @@ -195,8 +195,10 @@ gtk_root_after_update_cb (GdkFrameClock *clock, } static void -gtk_root_layout_cb (GdkFrameClock *clock, - GtkRoot *self) +gtk_root_layout_cb (GdkSurface *surface, + int width, + int height, + GtkRoot *self) { GtkWidget *widget = GTK_WIDGET (self); @@ -231,19 +233,22 @@ gtk_root_layout_cb (GdkFrameClock *clock, if (gtk_root_needs_layout (self)) { - gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_UPDATE); - gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_LAYOUT); + gdk_frame_clock_request_phase (gdk_surface_get_frame_clock (surface), + GDK_FRAME_CLOCK_PHASE_UPDATE); + gdk_surface_request_layout (surface); } } void gtk_root_start_layout (GtkRoot *self) { + GdkSurface *surface; GdkFrameClock *clock; if (!gtk_root_needs_layout (self)) return; + surface = gtk_widget_get_surface (GTK_WIDGET (self)); clock = gtk_widget_get_frame_clock (GTK_WIDGET (self)); if (clock == NULL) return; @@ -260,19 +265,20 @@ gtk_root_start_layout (GtkRoot *self) GINT_TO_POINTER (after_update_handler)); layout_handler = - g_signal_connect (clock, "layout", + g_signal_connect (surface, "layout", G_CALLBACK (gtk_root_layout_cb), self); g_object_set_qdata (G_OBJECT (self), quark_layout_handler, GINT_TO_POINTER (layout_handler)); } gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_UPDATE); - gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_LAYOUT); + gdk_surface_request_layout (surface); } void gtk_root_stop_layout (GtkRoot *self) { + GdkSurface *surface; GdkFrameClock *clock; guint layout_handler; guint after_update_handler; @@ -287,8 +293,9 @@ gtk_root_stop_layout (GtkRoot *self) if (layout_handler == 0) return; + surface = gtk_widget_get_surface (GTK_WIDGET (self)); clock = gtk_widget_get_frame_clock (GTK_WIDGET (self)); - g_signal_handler_disconnect (clock, layout_handler); + g_signal_handler_disconnect (surface, layout_handler); g_signal_handler_disconnect (clock, after_update_handler); g_object_set_qdata (G_OBJECT (self), quark_layout_handler, NULL); g_object_set_qdata (G_OBJECT (self), quark_after_update_handler, NULL); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index ab9de00cd2..6d1e3c865d 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -3244,7 +3244,7 @@ gtk_widget_remove_surface_transform_changed_callback (GtkWidget *widget, } } -static GdkSurface * +GdkSurface * gtk_widget_get_surface (GtkWidget *widget) { GtkNative *native = gtk_widget_get_native (widget); diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index a79ee938da..667df882ce 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -228,6 +228,8 @@ void gtk_widget_ensure_resize (GtkWidget *widget); void gtk_widget_ensure_allocate (GtkWidget *widget); void _gtk_widget_scale_changed (GtkWidget *widget); +GdkSurface * gtk_widget_get_surface (GtkWidget *widget); + void gtk_widget_render (GtkWidget *widget, GdkSurface *surface, const cairo_region_t *region); |