diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c index dd7380b63c..5404f53a1c 100644 --- a/demos/gtk-demo/drawingarea.c +++ b/demos/gtk-demo/drawingarea.c @@ -42,7 +42,9 @@ create_surface (GtkWidget *widget) } static void -scribble_size_allocate (GtkWidget *widget) +scribble_resize (GtkWidget *widget, + int width, + int height) { create_surface (widget); } @@ -242,8 +244,8 @@ do_drawingarea (GtkWidget *do_widget) gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL); gtk_frame_set_child (GTK_FRAME (frame), da); - g_signal_connect (da, "size-allocate", - G_CALLBACK (scribble_size_allocate), NULL); + g_signal_connect (da, "resize", + G_CALLBACK (scribble_resize), NULL); drag = gtk_gesture_drag_new (); gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY); diff --git a/examples/drawing.c b/examples/drawing.c index be45149e5c..4986f69539 100644 --- a/examples/drawing.c +++ b/examples/drawing.c @@ -18,10 +18,10 @@ clear_surface (void) /* Create a new surface of the appropriate size to store our scribbles */ static void -size_allocate_cb (GtkWidget *widget, - GtkAllocation *alloc, - int baseline, - gpointer data) +resize_cb (GtkWidget *widget, + int width, + int height, + gpointer data) { if (surface) { @@ -153,8 +153,7 @@ activate (GtkApplication *app, gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area), draw_cb, NULL, NULL); - g_signal_connect_after (drawing_area, "size-allocate", - G_CALLBACK (size_allocate_cb), NULL); + g_signal_connect_after (drawing_area, "resize", G_CALLBACK (resize_cb), NULL); drag = gtk_gesture_drag_new (); gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY); diff --git a/gtk/a11y/gtkpanedaccessible.c b/gtk/a11y/gtkpanedaccessible.c index 48dc9e454a..de657ef217 100644 --- a/gtk/a11y/gtkpanedaccessible.c +++ b/gtk/a11y/gtkpanedaccessible.c @@ -27,8 +27,7 @@ G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GTK_TYPE_CONT G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) static void -gtk_paned_accessible_size_allocate_gtk (GtkWidget *widget, - GtkAllocation *allocation) +gtk_paned_accessible_position_changed (GtkWidget *widget) { AtkObject *obj = gtk_widget_get_accessible (widget); @@ -41,8 +40,8 @@ gtk_paned_accessible_initialize (AtkObject *obj, { ATK_OBJECT_CLASS (gtk_paned_accessible_parent_class)->initialize (obj, data); - g_signal_connect (data, "size-allocate", - G_CALLBACK (gtk_paned_accessible_size_allocate_gtk), NULL); + g_signal_connect (data, "notify::position", + G_CALLBACK (gtk_paned_accessible_position_changed), NULL); obj->role = ATK_ROLE_SPLIT_PANE; } diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c index 84732dcda5..43b9c8cb9a 100644 --- a/gtk/a11y/gtkwidgetaccessible.c +++ b/gtk/a11y/gtkwidgetaccessible.c @@ -54,28 +54,28 @@ notify_cb (GObject *obj, klass->notify_gtk (obj, pspec); } -/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */ -static void -size_allocate_cb (GtkWidget *widget, - int width, - int height) +/*< private > + * gtk_widget_accessible_update_bounds: + * @self: a #GtkWidgetAccessible + * + * Updates the bounds of the widget's accessible implementation using + * the widget's allocation. + */ +void +gtk_widget_accessible_update_bounds (GtkWidgetAccessible *self) { - AtkObject* accessible; + GtkAllocation alloc; AtkRectangle rect; - accessible = gtk_widget_get_accessible (widget); - if (ATK_IS_COMPONENT (accessible)) - { - GtkAllocation alloc; - gtk_widget_get_allocation (widget, &alloc); + GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); + gtk_widget_get_allocation (widget, &alloc); - rect.x = alloc.x; - rect.y = alloc.y; - rect.width = alloc.width; - rect.height = alloc.height; + rect.x = alloc.x; + rect.y = alloc.y; + rect.width = alloc.width; + rect.height = alloc.height; - g_signal_emit_by_name (accessible, "bounds-changed", &rect); - } + g_signal_emit_by_name (self, "bounds-changed", &rect); } /* Translate GtkWidget mapped state into AtkObject showing */ @@ -109,7 +109,6 @@ gtk_widget_accessible_initialize (AtkObject *obj, widget = GTK_WIDGET (data); g_signal_connect (widget, "notify", G_CALLBACK (notify_cb), NULL); - g_signal_connect (widget, "size-allocate", G_CALLBACK (size_allocate_cb), NULL); g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL); g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL); diff --git a/gtk/a11y/gtkwidgetaccessibleprivate.h b/gtk/a11y/gtkwidgetaccessibleprivate.h index 9623429501..ac60f0e43d 100644 --- a/gtk/a11y/gtkwidgetaccessibleprivate.h +++ b/gtk/a11y/gtkwidgetaccessibleprivate.h @@ -25,6 +25,8 @@ G_BEGIN_DECLS void _gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible, AtkLayer layer); +void gtk_widget_accessible_update_bounds (GtkWidgetAccessible *self); + G_END_DECLS #endif /* __GTK_WIDGET_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index a4351d14c3..3f743c84e7 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -223,7 +223,7 @@ * give every row its minimum or natural height or, if the model content * is expected to fit inside the layouting widget without scrolling, it * would make sense to calculate the allocation for each row at - * #GtkWidget::size-allocate time using gtk_distribute_natural_allocation(). + * the time the widget is allocated using gtk_distribute_natural_allocation(). * * # Handling Events and Driving Keyboard Focus * diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index 0e3fd65bbb..201768e179 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -25,6 +25,7 @@ #include "config.h" #include "gtkdrawingarea.h" #include "gtkintl.h" +#include "gtkmarshalers.h" #include "gtkprivate.h" #include "gtksnapshot.h" #include "gtkstylecontext.h" @@ -50,6 +51,13 @@ enum { static GParamSpec *props[LAST_PROP] = { NULL, }; +enum { + RESIZE, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0, }; + /** * SECTION:gtkdrawingarea * @Short_description: A simple widget for drawing with cairo @@ -64,7 +72,7 @@ static GParamSpec *props[LAST_PROP] = { NULL, }; * when the widget is instantiated on a particular display. * (Create GDK resources in response to this signal.) * - * - The #GtkWidget::size-allocate signal to take any necessary + * - The #GtkDrawingArea::resize signal to take any necessary * actions when the widget changes size. * * - Call gtk_drawing_area_set_draw_func() to handle redrawing the @@ -222,6 +230,15 @@ gtk_drawing_area_measure (GtkWidget *widget, } } +static void +gtk_drawing_area_size_allocate (GtkWidget *widget, + int width, + int height, + int baseline) +{ + g_signal_emit (widget, signals[RESIZE], 0, width, height); +} + static void gtk_drawing_area_snapshot (GtkWidget *widget, GtkSnapshot *snapshot) @@ -264,6 +281,7 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class) widget_class->snapshot = gtk_drawing_area_snapshot; widget_class->focus = gtk_widget_focus_none; widget_class->grab_focus = gtk_widget_grab_focus_none; + widget_class->size_allocate = gtk_drawing_area_size_allocate; /** * GtkDrawingArea:content-width @@ -291,6 +309,29 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class) g_object_class_install_properties (gobject_class, LAST_PROP, props); + /** + * GtkDrawingArea::resize: + * @area: the #GtkDrawingArea that emitted the signal + * @width: the width of the viewport + * @height: the height of the viewport + * + * The ::resize signal is emitted once when the widget is realized, and + * then each time the widget is changed while realized. This is useful + * in order to keep state up to date with the widget size, like for + * instance a backing surface. + */ + signals[RESIZE] = + g_signal_new (I_("resize"), + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkDrawingAreaClass, resize), + NULL, NULL, + _gtk_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + g_signal_set_va_marshaller (signals[RESIZE], + G_TYPE_FROM_CLASS (class), + _gtk_marshal_VOID__INT_INTv); + gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DRAWING_AREA); } @@ -419,7 +460,7 @@ gtk_drawing_area_get_content_height (GtkDrawingArea *self) * @destroy: destroy notifier for @user_data * * Setting a draw function is the main thing you want to do when using a drawing - * area. It is called whenever GTK needs to draw the contents of the drawing area + * area. It is called whenever GTK needs to draw the contents of the drawing area * to the screen. * * The draw function will be called during the drawing stage of GTK. In the diff --git a/gtk/gtkdrawingarea.h b/gtk/gtkdrawingarea.h index 47cd8df622..4d49c3f27e 100644 --- a/gtk/gtkdrawingarea.h +++ b/gtk/gtkdrawingarea.h @@ -75,6 +75,10 @@ struct _GtkDrawingAreaClass { GtkWidgetClass parent_class; + void (* resize) (GtkDrawingArea *area, + int width, + int height); + /*< private >*/ gpointer padding[8]; diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 6ffc7f7126..7b21e2b725 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -122,6 +122,7 @@ #include "gtksnapshot.h" #include "gtkshortcutmanager.h" #include "gtkbuildable.h" +#include "gtktooltipprivate.h" #include "gtkrender.h" #include "gtkstylecontextprivate.h" @@ -1417,6 +1418,8 @@ gtk_popover_size_allocate (GtkWidget *widget, gtk_popover_update_shape (popover); g_clear_pointer (&priv->arrow_render_node, gsk_render_node_unref); } + + gtk_tooltip_maybe_allocate (GTK_NATIVE (popover)); } static void diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index f611b4f562..fc9e665444 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -977,3 +977,16 @@ gtk_tooltip_handle_event_internal (GdkEventType event_type, break; } } + +void +gtk_tooltip_maybe_allocate (GtkNative *native) +{ + GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (native)); + GtkTooltip *tooltip; + + tooltip = g_object_get_qdata (G_OBJECT (display), quark_current_tooltip); + if (!tooltip || GTK_NATIVE (tooltip->native) != native) + return; + + gtk_native_check_resize (GTK_NATIVE (tooltip->window)); +} diff --git a/gtk/gtktooltipprivate.h b/gtk/gtktooltipprivate.h index 5a050da199..ca63406b2c 100644 --- a/gtk/gtktooltipprivate.h +++ b/gtk/gtktooltipprivate.h @@ -27,6 +27,7 @@ #include +#include G_BEGIN_DECLS @@ -42,6 +43,8 @@ GtkWidget * _gtk_widget_find_at_coords (GdkSurface *surface, gint *widget_x, gint *widget_y); +void gtk_tooltip_maybe_allocate (GtkNative *native); + G_END_DECLS diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c index 6f3d0fd945..3c36b82691 100644 --- a/gtk/gtktooltipwindow.c +++ b/gtk/gtktooltipwindow.c @@ -191,13 +191,6 @@ surface_state_changed (GtkWidget *widget) } } -static void -surface_size_changed (GtkWidget *widget, - guint width, - guint height) -{ -} - static gboolean surface_render (GdkSurface *surface, cairo_region_t *region, @@ -228,7 +221,6 @@ gtk_tooltip_window_realize (GtkWidget *widget) gdk_surface_set_widget (window->surface, widget); g_signal_connect_swapped (window->surface, "notify::state", G_CALLBACK (surface_state_changed), widget); - g_signal_connect_swapped (window->surface, "size-changed", G_CALLBACK (surface_size_changed), widget); g_signal_connect (window->surface, "render", G_CALLBACK (surface_render), widget); g_signal_connect (window->surface, "event", G_CALLBACK (surface_event), widget); @@ -248,7 +240,6 @@ gtk_tooltip_window_unrealize (GtkWidget *widget) g_clear_object (&window->renderer); g_signal_handlers_disconnect_by_func (window->surface, surface_state_changed, widget); - g_signal_handlers_disconnect_by_func (window->surface, surface_size_changed, widget); g_signal_handlers_disconnect_by_func (window->surface, surface_render, widget); g_signal_handlers_disconnect_by_func (window->surface, surface_event, widget); gdk_surface_set_widget (window->surface, NULL); @@ -364,22 +355,13 @@ gtk_tooltip_window_hide (GtkWidget *widget) gtk_widget_unmap (widget); } -static void size_changed (GtkWidget *widget, - int width, - int height, - int baseline, - GtkTooltipWindow *window); - static void gtk_tooltip_window_dispose (GObject *object) { GtkTooltipWindow *window = GTK_TOOLTIP_WINDOW (object); if (window->relative_to) - { - g_signal_handlers_disconnect_by_func (window->relative_to, size_changed, window); - gtk_widget_unparent (GTK_WIDGET (window)); - } + gtk_widget_unparent (GTK_WIDGET (window)); g_clear_pointer (&window->box, gtk_widget_unparent); @@ -532,16 +514,6 @@ gtk_tooltip_window_set_custom_widget (GtkTooltipWindow *window, } } -static void -size_changed (GtkWidget *widget, - int width, - int height, - int baseline, - GtkTooltipWindow *window) -{ - gtk_native_check_resize (GTK_NATIVE (window)); -} - void gtk_tooltip_window_set_relative_to (GtkTooltipWindow *window, GtkWidget *relative_to) @@ -554,20 +526,12 @@ gtk_tooltip_window_set_relative_to (GtkTooltipWindow *window, g_object_ref (window); if (window->relative_to) - { - g_signal_handlers_disconnect_by_func (window->relative_to, size_changed, window); - gtk_widget_unparent (GTK_WIDGET (window)); - } + gtk_widget_unparent (GTK_WIDGET (window)); window->relative_to = relative_to; if (window->relative_to) - { - g_signal_connect (window->relative_to, "size-allocate", G_CALLBACK (size_changed), window); - gtk_css_node_set_parent (gtk_widget_get_css_node (GTK_WIDGET (window)), - gtk_widget_get_css_node (relative_to)); - gtk_widget_set_parent (GTK_WIDGET (window), relative_to); - } + gtk_widget_set_parent (GTK_WIDGET (window), relative_to); g_object_unref (window); } diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index b8f8bfeb9d..2b3b46441c 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -2547,7 +2547,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget, GList *tmp_list; double page_size; - /* We size-allocate the columns first because the width of the + /* We allocate the columns first because the width of the * tree view (used in updating the adjustments below) might change. */ gtk_tree_view_size_allocate_columns (widget); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index f52ef856ce..b6beceb8bc 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -74,7 +74,7 @@ #include "gtknativeprivate.h" #include "gtkconstraint.h" -#include "a11y/gtkwidgetaccessible.h" +#include "a11y/gtkwidgetaccessibleprivate.h" #include "inspector/window.h" #include "gdk/gdkeventsprivate.h" @@ -1485,28 +1485,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) NULL, G_TYPE_NONE, 0); - /** - * GtkWidget::size-allocate: - * @widget: the object which received the signal. - * @width: the content width of the widget - * @height: the content height of the widget - * @baseline: the baseline - */ - widget_signals[SIZE_ALLOCATE] = - g_signal_new (I_("size-allocate"), - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GtkWidgetClass, size_allocate), - NULL, NULL, - _gtk_marshal_VOID__INT_INT_INT, - G_TYPE_NONE, 3, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_INT); - g_signal_set_va_marshaller (widget_signals[SIZE_ALLOCATE], - G_TYPE_FROM_CLASS (gobject_class), - _gtk_marshal_VOID__INT_INT_INTv); - /** * GtkWidget::state-flags-changed: * @widget: the object which received the signal. @@ -4095,16 +4073,10 @@ gtk_widget_allocate (GtkWidget *widget, } else { - if (g_signal_has_handler_pending (widget, widget_signals[SIZE_ALLOCATE], 0, FALSE)) - g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, - priv->width, - priv->height, - baseline); - else - GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget, - priv->width, - priv->height, - baseline); + GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget, + priv->width, + priv->height, + baseline); } /* Size allocation is god... after consulting god, no further requests or allocations are needed */ @@ -4123,6 +4095,9 @@ gtk_widget_allocate (GtkWidget *widget, gtk_widget_update_paintables (widget); + if (priv->accessible != NULL) + gtk_widget_accessible_update_bounds (GTK_WIDGET_ACCESSIBLE (priv->accessible)); + skip_allocate: if (size_changed || baseline_changed) gtk_widget_queue_draw (widget); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 19861e3ea5..bc79bd3d28 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -70,6 +70,7 @@ #include "gtkwindowgroup.h" #include "gtkpopovermenubarprivate.h" #include "gtkcssboxesimplprivate.h" +#include "gtktooltipprivate.h" #include "a11y/gtkwindowaccessibleprivate.h" #include "a11y/gtkcontaineraccessibleprivate.h" @@ -3953,11 +3954,6 @@ gtk_window_resize (GtkWindow *window, * stored across sessions; use gtk_window_set_default_size() to * restore them when before showing the window. * - * To avoid potential race conditions, you should only call this - * function in response to a size change notification, for instance - * inside a handler for the #GtkWidget::size-allocate signal, or - * inside a handler for the #GtkWidget::configure-event signal: - * * |[ * static void * on_size_allocate (GtkWidget *widget, @@ -3972,12 +3968,6 @@ gtk_window_resize (GtkWindow *window, * } * ]| * - * Note that, if you connect to the #GtkWidget::size-allocate signal, - * you should not use the dimensions of the #GtkAllocation passed to - * the signal handler, as the allocation may contain client side - * decorations added by GTK+, depending on the windowing system in - * use. - * * If you are getting a window size in order to position the window * on the screen, you should, instead, simply set the window’s semantic * type with gtk_window_set_type_hint(), which allows the window manager @@ -5087,6 +5077,8 @@ gtk_window_size_allocate (GtkWidget *widget, if (child && gtk_widget_get_visible (child)) gtk_widget_size_allocate (child, &child_allocation, -1); + + gtk_tooltip_maybe_allocate (GTK_NATIVE (widget)); } gboolean diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index 659960d7b8..7810854941 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -139,11 +139,8 @@ state_flags_changed (GtkWidget *w, GtkStateFlags old_flags, GtkInspectorMiscInfo } static void -allocation_changed (GtkWidget *w, - int width, - int height, - int baseline, - GtkInspectorMiscInfo *sl) +update_allocation (GtkWidget *w, + GtkInspectorMiscInfo *sl) { GtkAllocation alloc; gchar *size_label; @@ -419,7 +416,6 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl, if (sl->priv->object) { g_signal_handlers_disconnect_by_func (sl->priv->object, state_flags_changed, sl); - g_signal_handlers_disconnect_by_func (sl->priv->object, allocation_changed, sl); disconnect_each_other (sl->priv->object, G_OBJECT (sl)); disconnect_each_other (sl, sl->priv->object); sl->priv->object = NULL; @@ -452,8 +448,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl, g_signal_connect_object (object, "state-flags-changed", G_CALLBACK (state_flags_changed), sl, 0); state_flags_changed (GTK_WIDGET (sl->priv->object), 0, sl); - g_signal_connect_object (object, "size-allocate", G_CALLBACK (allocation_changed), sl, 0); - allocation_changed (GTK_WIDGET (sl->priv->object), 0, 0, -1, sl); + update_allocation (GTK_WIDGET (sl->priv->object), sl); } else { diff --git a/tests/testgtk.c b/tests/testgtk.c index 56f5de45d4..8f0cfe22ec 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -4955,23 +4955,6 @@ create_surface_states (GtkWidget *widget) * Window sizing */ -static void -size_allocate_callback (GtkWidget *widget, - int width, - int height, - int baseline, - gpointer data) -{ - GtkWidget *label = data; - gchar *msg; - - msg = g_strdup_printf ("size: %d x %d\n", width, height); - - gtk_label_set_text (GTK_LABEL (label), msg); - - g_free (msg); -} - static void get_ints (GtkWidget *window, gint *a, @@ -5081,8 +5064,6 @@ window_controls (GtkWidget *window) label = gtk_label_new (""); gtk_container_add (GTK_CONTAINER (vbox), label); - g_signal_connect_after (window, "size-allocate", G_CALLBACK (size_allocate_callback), label); - adjustment = gtk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0); spin = gtk_spin_button_new (adjustment, 0, 0); diff --git a/tests/testoverlaystyleclass.c b/tests/testoverlaystyleclass.c index 8d61b57158..37a8e08c33 100644 --- a/tests/testoverlaystyleclass.c +++ b/tests/testoverlaystyleclass.c @@ -1,22 +1,5 @@ #include -static void -child_size_allocate (GtkWidget *child, - GdkRectangle *allocation, - gint baseline, - gpointer user_data) -{ - GtkStyleContext *context; - context = gtk_widget_get_style_context (child); - - g_print ("Child %p\nHas left? %d\nHas right? %d\nHas top? %d\nHas bottom? %d\n", - child, - gtk_style_context_has_class (context, "left"), - gtk_style_context_has_class (context, "right"), - gtk_style_context_has_class (context, "top"), - gtk_style_context_has_class (context, "bottom")); -} - static gboolean overlay_get_child_position (GtkOverlay *overlay, GtkWidget *child, @@ -94,9 +77,6 @@ main (int argc, char *argv[]) gtk_widget_set_valign (child, GTK_ALIGN_END); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child); - g_signal_connect (child, "size-allocate", - G_CALLBACK (child_size_allocate), overlay); - child = gtk_label_new (NULL); str = g_strdup_printf ("%p", child); gtk_label_set_text (GTK_LABEL (child), str); @@ -106,9 +86,6 @@ main (int argc, char *argv[]) gtk_widget_set_valign (child, GTK_ALIGN_START); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child); - g_signal_connect (child, "size-allocate", - G_CALLBACK (child_size_allocate), overlay); - child = gtk_label_new (NULL); str = g_strdup_printf ("%p", child); gtk_label_set_text (GTK_LABEL (child), str); @@ -118,9 +95,6 @@ main (int argc, char *argv[]) gtk_widget_set_valign (child, GTK_ALIGN_CENTER); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child); - g_signal_connect (child, "size-allocate", - G_CALLBACK (child_size_allocate), overlay); - child = gtk_label_new (NULL); str = g_strdup_printf ("%p", child); gtk_label_set_text (GTK_LABEL (child), str); @@ -132,9 +106,6 @@ main (int argc, char *argv[]) gtk_widget_set_valign (child, GTK_ALIGN_START); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child); - g_signal_connect (child, "size-allocate", - G_CALLBACK (child_size_allocate), overlay); - child = gtk_label_new (NULL); str = g_strdup_printf ("%p", child); gtk_label_set_text (GTK_LABEL (child), str); @@ -144,8 +115,6 @@ main (int argc, char *argv[]) gtk_widget_set_valign (child, GTK_ALIGN_START); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child); - g_signal_connect (child, "size-allocate", - G_CALLBACK (child_size_allocate), overlay); g_signal_connect (overlay, "get-child-position", G_CALLBACK (overlay_get_child_position), child);