[gtk+/wip/baedert/drawing: 351/359] widget: Add baseline and out_clip parameters to size-allocate
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 351/359] widget: Add baseline and out_clip parameters to size-allocate
- Date: Thu, 13 Jul 2017 14:57:18 +0000 (UTC)
commit 6347caa6d3f2bef8cd49f44ce98cb79af92f0198
Author: Timm Bäder <mail baedert org>
Date: Tue Jul 11 09:58:21 2017 +0200
widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.
This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
demos/gtk-demo/application.c | 9 +-
demos/gtk-demo/gtkfishbowl.c | 12 +-
demos/gtk-demo/popover.c | 6 +-
docs/reference/gtk/gtk4-sections.txt | 1 -
gtk/gtkaccellabel.c | 8 +-
gtk/gtkactionbar.c | 13 +--
gtk/gtkappchooserwidget.c | 10 +-
gtk/gtkapplicationwindow.c | 18 ++--
gtk/gtkbbox.c | 26 ++--
gtk/gtkbin.c | 34 ++---
gtk/gtkbox.c | 25 ++--
gtk/gtkbutton.c | 21 ---
gtk/gtkcalendar.c | 15 ++-
gtk/gtkcellview.c | 14 ++-
gtk/gtkcenterbox.c | 18 +--
gtk/gtkcheckbutton.c | 23 ++--
gtk/gtkcheckmenuitem.c | 27 ++--
gtk/gtkcolorbutton.c | 12 +-
gtk/gtkcolorplane.c | 7 +-
gtk/gtkcolorswatch.c | 15 +--
gtk/gtkcombobox.c | 14 +--
gtk/gtkcontainer.c | 3 +-
gtk/gtkentry.c | 29 ++---
gtk/gtkeventbox.c | 16 ++-
gtk/gtkexpander.c | 19 ++--
gtk/gtkfilechooserbutton.c | 12 +-
gtk/gtkfilechooserdialog.c | 16 ++-
gtk/gtkfilechooserwidget.c | 13 ++-
gtk/gtkfixed.c | 14 ++-
gtk/gtkflowbox.c | 32 ++---
gtk/gtkfontbutton.c | 12 +-
gtk/gtkfontchooserwidget.c | 10 +-
gtk/gtkframe.c | 27 ++--
gtk/gtkgizmo.c | 13 +-
gtk/gtkglarea.c | 8 +-
gtk/gtkgrid.c | 23 ++---
gtk/gtkheaderbar.c | 31 ++---
gtk/gtkicon.c | 8 --
gtk/gtkiconview.c | 17 ++-
gtk/gtkimage.c | 21 ++--
gtk/gtkinvisible.c | 11 --
gtk/gtklabel.c | 17 ++--
gtk/gtklayout.c | 19 ++--
gtk/gtklevelbar.c | 36 +++---
gtk/gtklistbox.c | 45 +++----
gtk/gtkmagnifier.c | 2 +
gtk/gtkmenu.c | 21 ++--
gtk/gtkmenubar.c | 19 ++--
gtk/gtkmenuitem.c | 21 ++--
gtk/gtkmodelbutton.c | 27 ++---
gtk/gtknotebook.c | 53 ++++-----
gtk/gtkoverlay.c | 13 ++-
gtk/gtkpaned.c | 40 +++----
gtk/gtkpathbar.c | 40 +++---
gtk/gtkpopover.c | 33 ++---
gtk/gtkprogressbar.c | 33 ++---
gtk/gtkrange.c | 29 ++---
gtk/gtkrecentchooserwidget.c | 10 +-
gtk/gtkrevealer.c | 24 ++--
gtk/gtkscale.c | 45 +++----
gtk/gtkscrollbar.c | 10 +-
gtk/gtkscrolledwindow.c | 23 ++--
gtk/gtkseparator.c | 9 --
gtk/gtkseparatortoolitem.c | 11 --
gtk/gtkshortcutsshortcut.c | 10 +-
gtk/gtkspinbutton.c | 19 ++--
gtk/gtkspinner.c | 8 --
gtk/gtkstack.c | 26 ++--
gtk/gtkswitch.c | 23 ++--
gtk/gtktextview.c | 23 ++--
gtk/gtktoolbar.c | 20 ++--
gtk/gtktoolitemgroup.c | 23 ++--
gtk/gtktoolpalette.c | 14 ++-
gtk/gtktreeview.c | 22 ++--
gtk/gtktreeviewcolumn.c | 3 +-
gtk/gtkviewport.c | 21 ++--
gtk/gtkwidget.c | 223 ++++++++++++++++++----------------
gtk/gtkwidget.h | 16 ++--
gtk/gtkwidgetprivate.h | 3 +-
gtk/gtkwindow.c | 38 ++++---
gtk/inspector/gtkstackcombo.c | 13 +--
gtk/inspector/misc-info.c | 8 +-
tests/testwidgetfocus.c | 13 ++-
83 files changed, 845 insertions(+), 924 deletions(-)
---
diff --git a/demos/gtk-demo/application.c b/demos/gtk-demo/application.c
index 217947f..d2aa1f7 100644
--- a/demos/gtk-demo/application.c
+++ b/demos/gtk-demo/application.c
@@ -455,12 +455,15 @@ demo_application_window_constructed (GObject *object)
}
static void
-demo_application_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+demo_application_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
- GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation,
+ baseline, out_clip);
if (!window->maximized && !window->fullscreen)
gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
diff --git a/demos/gtk-demo/gtkfishbowl.c b/demos/gtk-demo/gtkfishbowl.c
index d3343eb..a41a39c 100644
--- a/demos/gtk-demo/gtkfishbowl.c
+++ b/demos/gtk-demo/gtkfishbowl.c
@@ -114,8 +114,10 @@ gtk_fishbowl_measure (GtkWidget *widget,
}
static void
-gtk_fishbowl_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_fishbowl_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
@@ -126,6 +128,8 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
for (children = priv->children; children; children = children->next)
{
+ GtkAllocation child_clip;
+
child = children->data;
if (!gtk_widget_get_visible (child->widget))
@@ -137,10 +141,8 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
- gtk_widget_size_allocate (child->widget, &child_allocation);
+ gtk_widget_size_allocate (child->widget, &child_allocation, -1, &child_clip);
}
-
- gtk_widget_set_clip (widget, allocation);
}
static double
diff --git a/demos/gtk-demo/popover.c b/demos/gtk-demo/popover.c
index 8f0573d..a95ca1b 100644
--- a/demos/gtk-demo/popover.c
+++ b/demos/gtk-demo/popover.c
@@ -55,8 +55,10 @@ create_complex_popover (GtkWidget *parent,
}
static void
-entry_size_allocate_cb (GtkEntry *entry,
- GtkAllocation *allocation,
+entry_size_allocate_cb (GtkEntry *entry,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip,
gpointer user_data)
{
GtkEntryIconPosition popover_pos;
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 66bcd1b..b472333 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4529,7 +4529,6 @@ GtkTickCallback
gtk_widget_add_tick_callback
gtk_widget_remove_tick_callback
gtk_widget_size_allocate
-gtk_widget_size_allocate_with_baseline
gtk_widget_add_accelerator
gtk_widget_remove_accelerator
gtk_widget_set_accel_path
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index bb5cac8..8eac6d5 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -159,13 +159,15 @@ static void gtk_accel_label_measure (GtkWidget *widget,
G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET)
static void
-gtk_accel_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_accel_label_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkAccelLabel *al = GTK_ACCEL_LABEL (widget);
GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (al);
- gtk_widget_size_allocate (priv->box, allocation);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtkactionbar.c b/gtk/gtkactionbar.c
index c645769..569d740 100644
--- a/gtk/gtkactionbar.c
+++ b/gtk/gtkactionbar.c
@@ -268,16 +268,13 @@ gtk_action_bar_snapshot (GtkWidget *widget,
}
static void
-gtk_action_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_action_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (priv->revealer, (GtkAllocation *)allocation);
- gtk_widget_get_clip (priv->revealer, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->revealer, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtkappchooserwidget.c b/gtk/gtkappchooserwidget.c
index 9086bfb..1cd3b14 100644
--- a/gtk/gtkappchooserwidget.c
+++ b/gtk/gtkappchooserwidget.c
@@ -971,15 +971,17 @@ gtk_app_chooser_widget_snapshot (GtkWidget *widget,
}
static void
-gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (widget);
GtkAppChooserWidgetPrivate *priv = gtk_app_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation, baseline,
out_clip);
- gtk_widget_size_allocate (priv->overlay, allocation);
+ gtk_widget_size_allocate (priv->overlay, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index c0094c3..daa66e3 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -594,8 +594,10 @@ gtk_application_window_measure (GtkWidget *widget,
}
static void
-gtk_application_window_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_application_window_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
@@ -614,19 +616,19 @@ gtk_application_window_real_size_allocate (GtkWidget *widget,
&menubar_height, NULL, NULL, NULL);
menubar_allocation.height = menubar_height;
- gtk_widget_size_allocate (window->priv->menubar, &menubar_allocation);
+ gtk_widget_size_allocate (window->priv->menubar, &menubar_allocation, baseline, out_clip);
child_allocation.y += menubar_height;
child_allocation.height -= menubar_height;
child = gtk_bin_get_child (GTK_BIN (window));
if (child != NULL && gtk_widget_get_visible (child))
- gtk_widget_size_allocate (child, &child_allocation);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, out_clip);
}
else
- GTK_WIDGET_CLASS (gtk_application_window_parent_class)
- ->size_allocate (widget, allocation);
-
- gtk_widget_set_clip (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_application_window_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
}
static void
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index f35f67e..2661001 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -97,8 +97,10 @@ static void gtk_button_box_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_button_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_button_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_button_box_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_button_box_set_child_property (GtkContainer *container,
@@ -742,8 +744,10 @@ gtk_button_box_measure (GtkWidget *widget,
}
static void
-gtk_button_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_button_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkButtonBox *bbox = GTK_BUTTON_BOX (widget);
GtkButtonBoxPrivate *priv = bbox->priv;
@@ -769,15 +773,16 @@ gtk_button_box_size_allocate (GtkWidget *widget,
gint secondary_size;
gint total_size;
gint baseline_height;
- gint baseline;
gint child_baseline;
gint i;
- GtkAllocation clip = *allocation;
GdkRectangle child_clip;
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
{
- GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
return;
}
@@ -1029,9 +1034,8 @@ gtk_button_box_size_allocate (GtkWidget *widget,
}
}
- gtk_widget_size_allocate_with_baseline (child, &child_allocation, child_baseline);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, child_baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
i++;
}
}
@@ -1040,8 +1044,6 @@ gtk_button_box_size_allocate (GtkWidget *widget,
g_free (widths);
g_free (heights);
g_free (baselines);
-
- gtk_widget_set_clip (widget, &clip);
}
/**
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 0b65927..7323d07 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -60,12 +60,23 @@ static void gtk_bin_measure (GtkWidget
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
static void
+gtk_bin_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
+
+ if (priv->child && gtk_widget_get_visible (priv->child))
+ gtk_widget_size_allocate (priv->child, allocation, baseline, out_clip);
+}
+
+static void
gtk_bin_class_init (GtkBinClass *class)
{
GtkWidgetClass *widget_class = (GtkWidgetClass*) class;
@@ -86,7 +97,6 @@ gtk_bin_init (GtkBin *bin)
gtk_widget_set_has_window (GTK_WIDGET (bin), FALSE);
}
-
static GType
gtk_bin_child_type (GtkContainer *container)
{
@@ -181,24 +191,6 @@ gtk_bin_measure (GtkWidget *widget,
}
}
-static void
-gtk_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin = GTK_BIN (widget);
- GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
-
- if (priv->child && gtk_widget_get_visible (priv->child))
- {
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (priv->child, allocation);
- gtk_widget_get_clip (priv->child, &clip);
-
- gtk_widget_set_clip (widget, &clip);
- }
-}
-
/**
* gtk_bin_get_child:
* @bin: a #GtkBin
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 86a9ba5..194c98b 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -142,7 +142,9 @@ struct _GtkBoxChild
};
static void gtk_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_box_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
@@ -369,6 +371,7 @@ get_spacing (GtkBox *box)
static void
gtk_box_size_allocate_no_center (GtkWidget *widget,
const GtkAllocation *allocation,
+ int baseline,
GdkRectangle *out_clip)
{
GtkBox *box = GTK_BOX (widget);
@@ -385,7 +388,6 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
gint minimum_above, natural_above;
gint minimum_below, natural_below;
gboolean have_baseline;
- int baseline = -1;
GtkPackType packing;
@@ -550,8 +552,8 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
}
}
- if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- baseline = gtk_widget_get_allocated_baseline (widget);
+ if (private->orientation == GTK_ORIENTATION_VERTICAL)
+ baseline = -1;
/* we only calculate our own baseline if we don't get one passed from the parent
* and any of the child widgets explicitly request one */
@@ -656,8 +658,7 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
child_allocation.y -= child_size;
}
}
- gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
- gtk_widget_get_clip (child->widget, &clip);
+ gtk_widget_size_allocate (child->widget, &child_allocation, baseline, &clip);
gdk_rectangle_union (&clip, out_clip, out_clip);
i++;
@@ -666,14 +667,12 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
}
static void
-gtk_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
-
- gtk_box_size_allocate_no_center (widget, allocation, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_box_size_allocate_no_center (widget, allocation, baseline, out_clip);
}
static GType
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index d663d12..ad6c3df 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -119,8 +119,6 @@ static void gtk_button_get_property (GObject *object,
static void gtk_button_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_button_unrealize (GtkWidget * widget);
-static void gtk_button_size_allocate (GtkWidget * widget,
- GtkAllocation * allocation);
static gint gtk_button_grab_broken (GtkWidget * widget,
GdkEventGrabBroken * event);
static gint gtk_button_key_release (GtkWidget * widget, GdkEventKey * event);
@@ -208,7 +206,6 @@ gtk_button_class_init (GtkButtonClass *klass)
widget_class->measure = gtk_button_measure_;
widget_class->screen_changed = gtk_button_screen_changed;
widget_class->unrealize = gtk_button_unrealize;
- widget_class->size_allocate = gtk_button_size_allocate;
widget_class->grab_broken_event = gtk_button_grab_broken;
widget_class->key_release_event = gtk_button_key_release;
widget_class->enter_notify_event = gtk_button_enter_notify;
@@ -753,24 +750,6 @@ gtk_button_unrealize (GtkWidget *widget)
}
static void
-gtk_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkAllocation clip = *allocation;
- GtkWidget *child;
-
- child = gtk_bin_get_child (GTK_BIN (widget));
- if (child && gtk_widget_get_visible (child))
- {
- gtk_widget_size_allocate_with_baseline (child, allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (child, &clip);
- }
-
- gtk_widget_set_clip (widget, &clip);
-}
-
-static void
gtk_button_do_release (GtkButton *button,
gboolean emit_clicked)
{
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 4defe6e..b9b55dd 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -264,8 +264,10 @@ static void gtk_calendar_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_calendar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_calendar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_calendar_button_press (GtkWidget *widget,
@@ -1823,8 +1825,10 @@ gtk_calendar_measure (GtkWidget *widget,
}
static void
-gtk_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_calendar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = calendar->priv;
@@ -1853,9 +1857,6 @@ gtk_calendar_size_allocate (GtkWidget *widget,
- (DAY_XSEP * 6))/7;
priv->week_width = 0;
}
-
-
- gtk_widget_set_clip (widget, allocation);
}
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 6c02a23..b3ffecc 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -66,8 +66,10 @@ static void gtk_cell_view_set_property (GObject *obj
GParamSpec *pspec);
static void gtk_cell_view_finalize (GObject *object);
static void gtk_cell_view_dispose (GObject *object);
-static void gtk_cell_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_cell_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_cell_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_cell_view_set_value (GtkCellView *cell_view,
@@ -458,8 +460,10 @@ gtk_cell_view_dispose (GObject *object)
}
static void
-gtk_cell_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_cell_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCellView *cellview;
GtkCellViewPrivate *priv;
@@ -486,8 +490,6 @@ gtk_cell_view_size_allocate (GtkWidget *widget,
gtk_cell_area_context_allocate (priv->context, width, -1);
else if (alloc_height != allocation->height && priv->orientation == GTK_ORIENTATION_VERTICAL)
gtk_cell_area_context_allocate (priv->context, -1, height);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
diff --git a/gtk/gtkcenterbox.c b/gtk/gtkcenterbox.c
index edcd572..74c52a7 100644
--- a/gtk/gtkcenterbox.c
+++ b/gtk/gtkcenterbox.c
@@ -379,12 +379,13 @@ gtk_center_box_measure (GtkWidget *widget,
}
static void
-gtk_center_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_center_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCenterBox *self = GTK_CENTER_BOX (widget);
GtkAllocation child_allocation;
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
GtkWidget *child[3];
int child_size[3];
@@ -392,16 +393,12 @@ gtk_center_box_size_allocate (GtkWidget *widget,
GtkRequestedSize sizes[3];
int size;
int for_size;
- int baseline;
int i;
- GTK_WIDGET_CLASS (gtk_center_box_parent_class)->size_allocate (widget, allocation);
-
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
{
size = allocation->width;
for_size = allocation->height;
- baseline = gtk_widget_get_allocated_baseline (widget);
}
else
{
@@ -528,12 +525,9 @@ gtk_center_box_size_allocate (GtkWidget *widget,
child_allocation.height = child_size[i];
}
- gtk_widget_size_allocate_with_baseline (child[i], &child_allocation, allocation->y + baseline);
- gtk_widget_get_clip (child[i], &child_clip);
- gdk_rectangle_union (&clip, &clip, &child_clip);
+ gtk_widget_size_allocate (child[i], &child_allocation, allocation->y + baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 3881db5..b42b158 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -78,7 +78,9 @@
static void gtk_check_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
typedef struct {
GtkWidget *indicator_widget;
@@ -432,12 +434,13 @@ gtk_check_button_new_with_mnemonic (const gchar *label)
}
static void
-gtk_check_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_check_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
GtkAllocation child_alloc = { 0 };
- GdkRectangle clip = *allocation;
GdkRectangle child_clip;
GtkWidget *child;
gboolean is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
@@ -462,9 +465,8 @@ gtk_check_button_size_allocate (GtkWidget *widget,
child_alloc.x = allocation->x;
}
- gtk_widget_size_allocate (priv->indicator_widget, &child_alloc);
- gtk_widget_get_clip (priv->indicator_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->indicator_widget, &child_alloc, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
child = gtk_bin_get_child (GTK_BIN (widget));
@@ -475,12 +477,9 @@ gtk_check_button_size_allocate (GtkWidget *widget,
child_alloc.width = allocation->width - child_alloc.width; /* Indicator width */
child_alloc.height = allocation->height;
- gtk_widget_size_allocate (child, &child_alloc);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_alloc, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
GtkCssNode *
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index 24dd548..0987fc1 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -108,17 +108,21 @@ G_DEFINE_TYPE_WITH_CODE (GtkCheckMenuItem, gtk_check_menu_item, GTK_TYPE_MENU_IT
G_ADD_PRIVATE (GtkCheckMenuItem))
static void
-gtk_check_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_check_menu_item_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip, widget_clip;
+ GtkAllocation child_clip;
GtkAllocation indicator_alloc;
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
gint toggle_size;
- GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate
- (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
gtk_widget_measure (priv->indicator_widget,
GTK_ORIENTATION_HORIZONTAL,
@@ -140,14 +144,11 @@ gtk_check_menu_item_size_allocate (GtkWidget *widget,
indicator_alloc.y = (allocation->height - indicator_alloc.height) / 2;
- gtk_widget_size_allocate_with_baseline (priv->indicator_widget,
- &indicator_alloc,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (priv->indicator_widget, &clip);
-
- gtk_widget_get_clip (widget, &widget_clip);
- gdk_rectangle_union (&widget_clip, &clip, &widget_clip);
- gtk_widget_set_clip (widget, &widget_clip);
+ gtk_widget_size_allocate (priv->indicator_widget,
+ &indicator_alloc,
+ baseline,
+ &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
static void
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index bfe716b..b844d51 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -168,17 +168,15 @@ gtk_color_button_snapshot (GtkWidget *widget,
}
static void
-gtk_color_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_color_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkColorButton *button = GTK_COLOR_BUTTON (widget);
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->button, allocation);
- gtk_widget_get_clip (priv->button, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->button, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c
index addc155..10c2ede 100644
--- a/gtk/gtkcolorplane.c
+++ b/gtk/gtkcolorplane.c
@@ -179,13 +179,14 @@ create_surface (GtkColorPlane *plane)
}
static void
-plane_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+plane_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
create_surface (plane);
- gtk_widget_set_clip (widget, allocation);
}
static void
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 507039c..e24fa2e 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -380,18 +380,13 @@ tap_action (GtkGestureMultiPress *gesture,
}
static void
-swatch_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+swatch_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
- GtkAllocation clip = *allocation, clip2 = *allocation;
-
-
- gtk_widget_size_allocate (swatch->priv->overlay_widget, allocation);
- gtk_widget_get_clip (swatch->priv->overlay_widget, &clip2);
- gdk_rectangle_union (&clip, &clip2, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (swatch->priv->overlay_widget, allocation, -1, out_clip);
}
static void
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index f5c7ce4..ce4097b 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -367,17 +367,15 @@ gtk_combo_box_measure (GtkWidget *widget,
}
static void
-gtk_combo_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_combo_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv;
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate_with_baseline (priv->box, allocation,
- gtk_widget_get_allocated_baseline (widget));
-
- gtk_widget_get_clip (priv->box, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
if (gtk_widget_get_visible (priv->popup_widget))
{
@@ -401,8 +399,6 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
/* reposition the menu after giving it a new width */
gtk_menu_reposition (GTK_MENU (priv->popup_widget));
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 8180939..0a2dbf9 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1818,6 +1818,7 @@ gtk_container_real_check_resize (GtkContainer *container)
{
if (!_gtk_widget_is_toplevel (widget))
{
+ GtkAllocation clip;
gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_get_allocated_size (widget, &allocation, &baseline);
@@ -1825,7 +1826,7 @@ gtk_container_real_check_resize (GtkContainer *container)
allocation.width = requisition.width;
if (allocation.height < requisition.height)
allocation.height = requisition.height;
- gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline);
+ gtk_widget_size_allocate (widget, &allocation, baseline, &clip);
}
else
gtk_widget_queue_resize (widget);
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index baaa690..4780920 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -398,8 +398,10 @@ static void gtk_entry_realize (GtkWidget *widget);
static void gtk_entry_unrealize (GtkWidget *widget);
static void gtk_entry_map (GtkWidget *widget);
static void gtk_entry_unmap (GtkWidget *widget);
-static void gtk_entry_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_entry_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_entry_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_entry_event (GtkWidget *widget,
@@ -3101,17 +3103,17 @@ gtk_entry_measure (GtkWidget *widget,
}
static void
-gtk_entry_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_entry_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
- GdkRectangle clip = *allocation;
GtkAllocation child_clip;
gint i;
- priv->text_baseline = gtk_widget_get_allocated_baseline (widget);
-
+ priv->text_baseline = baseline;
priv->text_x = 0;
priv->text_width = allocation->width;
@@ -3150,9 +3152,8 @@ gtk_entry_size_allocate (GtkWidget *widget,
icon_alloc.height = height;
priv->text_width -= width;
- gtk_widget_size_allocate (icon_info->widget, &icon_alloc);
- gtk_widget_get_clip (icon_info->widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (icon_info->widget, &icon_alloc, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
@@ -3164,10 +3165,8 @@ gtk_entry_size_allocate (GtkWidget *widget,
progress_alloc.width = allocation->width;
progress_alloc.height = allocation->height;
- gtk_widget_size_allocate (priv->progress_widget, &progress_alloc);
- gtk_widget_get_clip (priv->progress_widget, &child_clip);
-
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->progress_widget, &progress_alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
/* Do this here instead of gtk_entry_size_allocate() so it works
@@ -3183,8 +3182,6 @@ gtk_entry_size_allocate (GtkWidget *widget,
if (completion)
_gtk_entry_completion_resize_popup (completion);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c
index 42a2cab..ae1b533 100644
--- a/gtk/gtkeventbox.c
+++ b/gtk/gtkeventbox.c
@@ -60,8 +60,10 @@ static void gtk_event_box_realize (GtkWidget *widget);
static void gtk_event_box_unrealize (GtkWidget *widget);
static void gtk_event_box_map (GtkWidget *widget);
static void gtk_event_box_unmap (GtkWidget *widget);
-static void gtk_event_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_event_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_event_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -428,12 +430,13 @@ gtk_event_box_unmap (GtkWidget *widget)
}
static void
-gtk_event_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_event_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkBin *bin;
GtkAllocation child_allocation;
- gint baseline;
GtkEventBoxPrivate *priv;
GtkWidget *child;
@@ -464,8 +467,7 @@ gtk_event_box_size_allocate (GtkWidget *widget,
child_allocation.height);
}
- baseline = gtk_widget_get_allocated_baseline (widget);
child = gtk_bin_get_child (bin);
if (child)
- gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, out_clip);
}
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 12f8191..e1f3617 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -170,8 +170,10 @@ static void gtk_expander_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_expander_destroy (GtkWidget *widget);
-static void gtk_expander_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_expander_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gboolean gtk_expander_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gtk_expander_leave_notify (GtkWidget *widget,
@@ -525,16 +527,13 @@ gtk_expander_destroy (GtkWidget *widget)
}
static void
-gtk_expander_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_expander_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate_with_baseline (priv->box, allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (priv->box, &clip);
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 18fdde9..48d13cb 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -381,17 +381,15 @@ gtk_file_chooser_button_measure (GtkWidget *widget,
}
static void
-gtk_file_chooser_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_file_chooser_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->child, allocation);
- gtk_widget_get_clip (priv->child, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->child, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index 833738e..57bef49 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -231,7 +231,9 @@ static void gtk_file_chooser_dialog_notify (GObject *obj
static void gtk_file_chooser_dialog_map (GtkWidget *widget);
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
static void gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void file_chooser_widget_file_activated (GtkFileChooser *chooser,
GtkFileChooserDialog *dialog);
static void file_chooser_widget_default_size_changed (GtkWidget *widget,
@@ -616,11 +618,15 @@ gtk_file_chooser_dialog_unmap (GtkWidget *widget)
}
static void
-gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget, allocation);
-
+ GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
if (gtk_widget_is_drawable (widget))
save_dialog_geometry (GTK_FILE_CHOOSER_DIALOG (widget));
}
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index b2c4c13..af607d4 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -8076,15 +8076,20 @@ gtk_file_chooser_widget_snapshot (GtkWidget *widget,
}
static void
-gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
- gtk_widget_size_allocate (priv->box, allocation);
+ gtk_widget_size_allocate (priv->box, allocation, -1, out_clip);
}
static void
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 4716dd6..a4be439 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -96,8 +96,10 @@ static void gtk_fixed_measure (GtkWidget *widget,
int *natural_baseline);
-static void gtk_fixed_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_fixed_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_fixed_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_fixed_add (GtkContainer *container,
@@ -385,8 +387,10 @@ gtk_fixed_measure (GtkWidget *widget,
}
static void
-gtk_fixed_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_fixed_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFixed *fixed = GTK_FIXED (widget);
GtkFixedPrivate *priv = fixed->priv;
@@ -408,7 +412,7 @@ gtk_fixed_size_allocate (GtkWidget *widget,
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
- gtk_widget_size_allocate (child->widget, &child_allocation);
+ gtk_widget_size_allocate (child->widget, &child_allocation, -1, out_clip);
}
}
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 1fec4ce..6a26d35 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -417,24 +417,16 @@ gtk_flow_box_child_measure (GtkWidget *widget,
}
static void
-gtk_flow_box_child_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_flow_box_child_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
- {
- GdkRectangle child_clip;
-
- gtk_widget_size_allocate (child, allocation);
- gtk_widget_get_clip (child, &child_clip);
-
- gdk_rectangle_union (&child_clip, &clip, &clip);
- }
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (child, allocation, -1, out_clip);
}
/* GObject implementation {{{2 */
@@ -1402,12 +1394,13 @@ get_offset_pixels (GtkAlign align,
}
static void
-gtk_flow_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_flow_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFlowBox *box = GTK_FLOW_BOX (widget);
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
- GtkAllocation clip = *allocation;
GdkRectangle child_clip;
GtkAllocation widget_allocation;
GtkAllocation child_allocation;
@@ -1748,9 +1741,8 @@ gtk_flow_box_size_allocate (GtkWidget *widget,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
child_allocation.x = allocation->width - child_allocation.x - child_allocation.width;
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
item_offset += this_item_size;
item_offset += item_spacing;
@@ -1760,8 +1752,6 @@ gtk_flow_box_size_allocate (GtkWidget *widget,
g_free (item_sizes);
g_free (line_sizes);
-
- gtk_widget_set_clip (widget, &clip);
}
static GtkSizeRequestMode
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 4f06b92..ada2258 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -463,17 +463,15 @@ gtk_font_button_measure (GtkWidget *widget,
}
static void
-gtk_font_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_font_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFontButton *button = GTK_FONT_BUTTON (widget);
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->button, allocation);
- gtk_widget_get_clip (priv->button, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->button, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 3979872..2777579 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -593,15 +593,17 @@ gtk_font_chooser_widget_snapshot (GtkWidget *widget,
}
static void
-gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFontChooserWidget *self = GTK_FONT_CHOOSER_WIDGET (widget);
GtkFontChooserWidgetPrivate *priv = gtk_font_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation, -1, out_clip);
- gtk_widget_size_allocate (priv->grid, allocation);
+ gtk_widget_size_allocate (priv->grid, allocation, -1, out_clip);
}
static void
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index ff59bac..2bfa6cf 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -117,8 +117,10 @@ static void gtk_frame_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_frame_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_frame_remove (GtkContainer *container,
GtkWidget *child);
static void gtk_frame_forall (GtkContainer *container,
@@ -611,15 +613,16 @@ gtk_frame_get_shadow_type (GtkFrame *frame)
}
static void
-gtk_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_frame_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFrame *frame = GTK_FRAME (widget);
GtkFramePrivate *priv = frame->priv;
GtkWidget *child;
GtkAllocation new_allocation;
- GtkAllocation clip = *allocation;
- GtkAllocation child_clip = *allocation;
+ GtkAllocation child_clip;
gtk_frame_compute_child_allocation (frame, &new_allocation);
priv->child_allocation = new_allocation;
@@ -646,20 +649,16 @@ gtk_frame_size_allocate (GtkWidget *widget,
priv->label_allocation.height = height;
priv->label_allocation.width = width;
- gtk_widget_size_allocate (priv->label_widget, &priv->label_allocation);
- gtk_widget_get_clip (priv->label_widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->label_widget, &priv->label_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
- gtk_widget_size_allocate (child, &priv->child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (child, &priv->child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkgizmo.c b/gtk/gtkgizmo.c
index f80fabe..69544c7 100644
--- a/gtk/gtkgizmo.c
+++ b/gtk/gtkgizmo.c
@@ -23,19 +23,18 @@ gtk_gizmo_measure (GtkWidget *widget,
}
static void
-gtk_gizmo_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_gizmo_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkGizmo *self = GTK_GIZMO (widget);
- GtkAllocation clip = *allocation;
if (self->allocate_func)
self->allocate_func (self,
allocation,
- gtk_widget_get_allocated_baseline (widget),
- &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ baseline,
+ out_clip);
}
static void
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index 9b9c021..c313518 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -576,13 +576,15 @@ gtk_gl_area_unrealize (GtkWidget *widget)
}
static void
-gtk_gl_area_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_gl_area_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkGLArea *area = GTK_GL_AREA (widget);
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
- GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
if (gtk_widget_get_realized (widget))
priv->needs_resize = TRUE;
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index 937f3bb..fbd7814 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -1575,20 +1575,19 @@ gtk_grid_request_allocate_children (GtkGridRequest *request,
child_allocation.x = allocation->x + allocation->width
- (child_allocation.x - allocation->x) - child_allocation.width;
- gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
- gtk_widget_get_clip (child->widget, &child_clip);
- gdk_rectangle_union (&child_clip, out_clip, out_clip);
+ gtk_widget_size_allocate (child->widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
}
#define GET_SIZE(allocation, orientation) (orientation == GTK_ORIENTATION_HORIZONTAL ? allocation->width :
allocation->height)
static void
-gtk_grid_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_grid_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
- GtkAllocation children_clip = *allocation;
GtkGrid *grid = GTK_GRID (widget);
GtkGridPrivate *priv = grid->priv;
GtkGridRequest request;
@@ -1596,10 +1595,7 @@ gtk_grid_size_allocate (GtkWidget *widget,
GtkOrientation orientation;
if (priv->children == NULL)
- {
- gtk_widget_set_clip (widget, &clip);
- return;
- }
+ return;
request.grid = grid;
@@ -1625,10 +1621,7 @@ gtk_grid_size_allocate (GtkWidget *widget,
gtk_grid_request_position (&request, 0);
gtk_grid_request_position (&request, 1);
- gtk_grid_request_allocate_children (&request, allocation, &children_clip);
- gdk_rectangle_union (&children_clip, &clip, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_grid_request_allocate_children (&request, allocation, out_clip);
}
static void
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index e415a4c..c5d4401 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -893,11 +893,12 @@ gtk_header_bar_measure (GtkWidget *widget,
}
static void
-gtk_header_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_header_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
- GtkAllocation clip = *allocation;
GtkWidget *title_widget;
GtkHeaderBar *bar = GTK_HEADER_BAR (widget);
GtkRequestedSize *sizes;
@@ -919,7 +920,7 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
gint x;
gint child_size;
GtkTextDirection direction;
- GtkAllocation child_clip;
+ GtkAllocation child_clip = {0, };
direction = gtk_widget_get_direction (widget);
nvis_children = count_visible_children (bar);
@@ -1096,9 +1097,8 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
if (direction == GTK_TEXT_DIR_RTL)
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) -
child_allocation.width;
- gtk_widget_size_allocate (child->widget, &child_allocation);
- gtk_widget_get_clip (child->widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (child->widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
next:
i++;
@@ -1135,9 +1135,8 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
if (title_widget != NULL)
{
- gtk_widget_size_allocate (title_widget, &child_allocation);
- gtk_widget_get_clip (title_widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (title_widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
child_allocation.y = allocation->y;
@@ -1151,9 +1150,8 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
else
child_allocation.x = allocation->x + allocation->width - start_width + priv->spacing;
child_allocation.width = start_width - priv->spacing;
- gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation);
- gtk_widget_get_clip (priv->titlebar_start_box, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
if (priv->titlebar_end_box)
@@ -1164,12 +1162,9 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
else
child_allocation.x = allocation->x + allocation->width - end_width + priv->spacing;
child_allocation.width = end_width - priv->spacing;
- gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation);
- gtk_widget_get_clip (priv->titlebar_end_box, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
/**
diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c
index 56b4fdd..aefd1c7 100644
--- a/gtk/gtkicon.c
+++ b/gtk/gtkicon.c
@@ -34,13 +34,6 @@
G_DEFINE_TYPE (GtkIcon, gtk_icon, GTK_TYPE_WIDGET)
static void
-gtk_icon_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
-static void
gtk_icon_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
@@ -61,7 +54,6 @@ gtk_icon_class_init (GtkIconClass *klass)
{
GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
- wclass->size_allocate = gtk_icon_size_allocate;
wclass->snapshot = gtk_icon_snapshot;
}
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index cf06fb1..c7ae2a3 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -150,8 +150,10 @@ static void gtk_icon_view_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_icon_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_icon_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_icon_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_icon_view_motion (GtkWidget *widget,
@@ -1604,15 +1606,18 @@ gtk_icon_view_allocate_children (GtkIconView *icon_view)
for (list = icon_view->priv->children; list; list = list->next)
{
GtkIconViewChild *child = list->data;
+ GtkAllocation clip;
/* totally ignore our child's requisition */
- gtk_widget_size_allocate (child->widget, &child->area);
+ gtk_widget_size_allocate (child->widget, &child->area, -1, &clip);
}
}
static void
-gtk_icon_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_icon_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
@@ -1645,8 +1650,6 @@ gtk_icon_view_size_allocate (GtkWidget *widget,
/* Emit any pending signals now */
g_object_thaw_notify (G_OBJECT (icon_view->priv->hadjustment));
g_object_thaw_notify (G_OBJECT (icon_view->priv->vadjustment));
-
- gtk_widget_set_clip (widget, allocation);
}
static void
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 2e3663d..bb0cb61 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -141,8 +141,10 @@ struct _GtkImagePrivate
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_BUTTON
static void gtk_image_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_image_size_allocate (GtkWidget *widget,
- GtkAllocation*allocation);
+static void gtk_image_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_image_unmap (GtkWidget *widget);
static void gtk_image_unrealize (GtkWidget *widget);
static void gtk_image_measure (GtkWidget *widget,
@@ -1271,22 +1273,17 @@ gtk_image_reset_anim_iter (GtkImage *image)
}
static void
-gtk_image_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_image_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
- GdkRectangle extents;
-
_gtk_style_context_get_icon_extents (gtk_widget_get_style_context (widget),
- &extents,
+ out_clip,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
-
- gdk_rectangle_union (&clip, &extents, &clip);
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c
index 9478977..2ead489 100644
--- a/gtk/gtkinvisible.c
+++ b/gtk/gtkinvisible.c
@@ -59,8 +59,6 @@ static void gtk_invisible_destroy (GtkWidget *widget);
static void gtk_invisible_realize (GtkWidget *widget);
static void gtk_invisible_style_updated (GtkWidget *widget);
static void gtk_invisible_show (GtkWidget *widget);
-static void gtk_invisible_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
static void gtk_invisible_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -85,7 +83,6 @@ gtk_invisible_class_init (GtkInvisibleClass *class)
widget_class->realize = gtk_invisible_realize;
widget_class->style_updated = gtk_invisible_style_updated;
widget_class->show = gtk_invisible_show;
- widget_class->size_allocate = gtk_invisible_size_allocate;
widget_class->destroy = gtk_invisible_destroy;
gobject_class->set_property = gtk_invisible_set_property;
@@ -251,14 +248,6 @@ gtk_invisible_show (GtkWidget *widget)
gtk_widget_map (widget);
}
-static void
-gtk_invisible_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
-
static void
gtk_invisible_set_property (GObject *object,
guint prop_id,
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 5b5525f..ab8ce36 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -398,8 +398,10 @@ static void gtk_label_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_label_finalize (GObject *object);
static void gtk_label_destroy (GtkWidget *widget);
-static void gtk_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_label_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_label_state_flags_changed (GtkWidget *widget,
GtkStateFlags prev_state);
static void gtk_label_style_updated (GtkWidget *widget);
@@ -3722,19 +3724,18 @@ gtk_label_get_ink_rect (GtkLabel *label,
}
static void
-gtk_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_label_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = label->priv;
- GdkRectangle clip_rect;
if (priv->layout)
gtk_label_update_layout_width (label);
- gtk_label_get_ink_rect (label, &clip_rect);
- gdk_rectangle_union (&clip_rect, allocation, &clip_rect);
- gtk_widget_set_clip (widget, &clip_rect);
+ gtk_label_get_ink_rect (label, out_clip);
}
static void
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index c510934..c4e46ae 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -122,8 +122,10 @@ static void gtk_layout_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_layout_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_layout_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_layout_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_layout_remove (GtkContainer *container,
@@ -757,8 +759,10 @@ gtk_layout_measure (GtkWidget *widget,
static void
-gtk_layout_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_layout_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkLayout *layout = GTK_LAYOUT (widget);
GtkLayoutPrivate *priv = layout->priv;
@@ -776,8 +780,6 @@ gtk_layout_size_allocate (GtkWidget *widget,
gtk_layout_set_hadjustment_values (layout);
gtk_layout_set_vadjustment_values (layout);
-
- gtk_widget_set_clip (widget, allocation);
}
/* Container methods
@@ -846,6 +848,7 @@ gtk_layout_allocate_child (GtkLayout *layout,
{
GtkAllocation allocation;
GtkRequisition requisition;
+ GtkAllocation child_clip;
allocation.x = child->x;
allocation.y = child->y;
@@ -853,8 +856,8 @@ gtk_layout_allocate_child (GtkLayout *layout,
gtk_widget_get_preferred_size (child->widget, &requisition, NULL);
allocation.width = requisition.width;
allocation.height = requisition.height;
-
- gtk_widget_size_allocate (child->widget, &allocation);
+
+ gtk_widget_size_allocate (child->widget, &allocation, -1, &child_clip);
}
/* Callbacks */
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 969fe47..523b1f3 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -436,10 +436,10 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
/* allocate the empty (unfilled) part */
block_area = *allocation;
- gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 0 : 1],
- &block_area,
- baseline);
- gtk_widget_get_clip (self->priv->block_widget[inverted ? 0 : 1], out_clip);
+ gtk_widget_size_allocate (self->priv->block_widget[inverted ? 0 : 1],
+ &block_area,
+ baseline,
+ out_clip);
/* now allocate the filled part */
block_area = *allocation;
@@ -466,10 +466,10 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
block_area.y += allocation->height - block_area.height;
}
- gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 1 : 0],
- &block_area,
- baseline);
- gtk_widget_get_clip (self->priv->block_widget[inverted ? 1 : 0], &clip);
+ gtk_widget_size_allocate (self->priv->block_widget[inverted ? 1 : 0],
+ &block_area,
+ baseline,
+ &clip);
gdk_rectangle_intersect (out_clip, &clip, out_clip);
}
@@ -507,10 +507,10 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
for (i = 0; i < num_blocks; i++)
{
- gtk_widget_size_allocate_with_baseline (self->priv->block_widget[i],
- &block_area,
- baseline);
- gtk_widget_get_clip (self->priv->block_widget[i], &clip);
+ gtk_widget_size_allocate (self->priv->block_widget[i],
+ &block_area,
+ baseline,
+ &clip);
gdk_rectangle_intersect (out_clip, &clip, out_clip);
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -536,16 +536,14 @@ gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
}
static void
-gtk_level_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_level_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget));
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->trough_widget, allocation);
- gtk_widget_get_clip (priv->trough_widget, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->trough_widget, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 12d76fe..c19e01b 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -214,7 +214,9 @@ static void gtk_list_box_compute_expand (GtkWidget
static GType gtk_list_box_child_type (GtkContainer *container);
static GtkSizeRequestMode gtk_list_box_get_request_mode (GtkWidget *widget);
static void gtk_list_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_list_box_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint time_);
@@ -2509,11 +2511,12 @@ gtk_list_box_measure (GtkWidget *widget,
}
static void
-gtk_list_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_list_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkListBoxPrivate *priv = BOX_PRIV (widget);
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
GtkAllocation child_allocation;
GtkAllocation header_allocation;
@@ -2539,9 +2542,8 @@ gtk_list_box_size_allocate (GtkWidget *widget,
&child_min, NULL, NULL, NULL);
header_allocation.height = allocation->height;
header_allocation.y = child_allocation.y;
- gtk_widget_size_allocate (priv->placeholder, &header_allocation);
- gtk_widget_get_clip (priv->placeholder, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->placeholder, &header_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
@@ -2564,9 +2566,11 @@ gtk_list_box_size_allocate (GtkWidget *widget,
&child_min, NULL, NULL, NULL);
header_allocation.height = child_min;
header_allocation.y = child_allocation.y;
- gtk_widget_size_allocate (ROW_PRIV (row)->header, &header_allocation);
- gtk_widget_get_clip (ROW_PRIV (row)->header, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (ROW_PRIV (row)->header,
+ &header_allocation,
+ -1,
+ &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
@@ -2578,13 +2582,10 @@ gtk_list_box_size_allocate (GtkWidget *widget,
child_allocation.height = child_min;
ROW_PRIV (row)->height = child_allocation.height;
- gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation);
- gtk_widget_get_clip (GTK_WIDGET (row), &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
-
- gtk_widget_set_clip (widget, &clip);
}
/**
@@ -3061,20 +3062,16 @@ gtk_list_box_row_measure (GtkWidget *widget,
}
static void
-gtk_list_box_row_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_list_box_row_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWidget *child;
- GtkAllocation clip = *allocation;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
- {
- gtk_widget_size_allocate (child, allocation);
- gtk_widget_get_clip (child, &clip);
- }
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (child, allocation, baseline, out_clip);
}
/**
diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c
index 5b3560c..4827d63 100644
--- a/gtk/gtkmagnifier.c
+++ b/gtk/gtkmagnifier.c
@@ -164,6 +164,8 @@ gtk_magnifier_measure (GtkWidget *widget,
static void
resize_handler (GtkWidget *widget,
GtkAllocation *alloc,
+ int baseline,
+ GtkAllocation *out_clip,
GtkWidget *magnifier)
{
gtk_widget_queue_resize (magnifier);
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 5a66f30..1ad97d0 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -231,8 +231,10 @@ static void gtk_menu_get_child_property(GtkContainer *container,
static void gtk_menu_destroy (GtkWidget *widget);
static void gtk_menu_realize (GtkWidget *widget);
static void gtk_menu_unrealize (GtkWidget *widget);
-static void gtk_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_menu_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_menu_show (GtkWidget *widget);
static void gtk_menu_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
@@ -2691,15 +2693,16 @@ calculate_line_heights (GtkMenu *menu,
}
static void
-gtk_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_menu_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkMenu *menu;
GtkMenuPrivate *priv;
GtkMenuShell *menu_shell;
GtkWidget *child;
GtkAllocation arrow_allocation, child_allocation;
- GtkAllocation clip = *allocation;
GList *children;
gint x, y, i;
gint width, height;
@@ -2739,13 +2742,13 @@ gtk_menu_size_allocate (GtkWidget *widget,
arrow_allocation.height = arrow_border.top;
if (priv->upper_arrow_visible)
- gtk_widget_size_allocate (priv->top_arrow_widget, &arrow_allocation);
+ gtk_widget_size_allocate (priv->top_arrow_widget, &arrow_allocation, -1, out_clip);
arrow_allocation.y = height - y - arrow_border.bottom;
arrow_allocation.height = arrow_border.bottom;
if (priv->lower_arrow_visible)
- gtk_widget_size_allocate (priv->bottom_arrow_widget, &arrow_allocation);
+ gtk_widget_size_allocate (priv->bottom_arrow_widget, &arrow_allocation, -1, out_clip);
width = MAX (1, width);
height = MAX (1, height);
@@ -2790,12 +2793,10 @@ gtk_menu_size_allocate (GtkWidget *widget,
gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
priv->toggle_size);
- gtk_widget_size_allocate (child, &child_allocation);
+ gtk_widget_size_allocate (child, &child_allocation, -1, out_clip);
}
}
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 955d39a..d18ea69 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -88,8 +88,10 @@ static void gtk_menu_bar_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_menu_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_menu_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
@@ -342,12 +344,13 @@ gtk_menu_bar_measure (GtkWidget *widget,
}
static void
-gtk_menu_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_menu_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkMenuBar *menu_bar = GTK_MENU_BAR (widget);
GtkMenuBarPrivate *priv = menu_bar->priv;
- GtkAllocation clip = *allocation;
GtkMenuShell *menu_shell;
GtkWidget *child;
GList *children;
@@ -416,7 +419,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
else
child_allocation.x += remaining_space.width;
- gtk_widget_size_allocate (request->data, &child_allocation);
+ gtk_widget_size_allocate (request->data, &child_allocation, -1, out_clip);
}
}
else
@@ -470,13 +473,11 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
else
child_allocation.y += remaining_space.height;
- gtk_widget_size_allocate (request->data, &child_allocation);
+ gtk_widget_size_allocate (request->data, &child_allocation, -1, out_clip);
}
}
g_array_free (requested_sizes, TRUE);
-
- gtk_widget_set_clip (widget, &clip);
}
static GList *
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index ab130da..1dfdef0 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -246,12 +246,13 @@ gtk_menu_item_actionable_interface_init (GtkActionableInterface *iface)
}
static void
-gtk_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_menu_item_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
GtkMenuItemPrivate *priv = menu_item->priv;
- GtkAllocation clip = *allocation;
GtkAllocation child_allocation;
GtkAllocation arrow_clip = { 0 };
GtkAllocation child_clip = *allocation;
@@ -324,22 +325,18 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
arrow_alloc.y = child_allocation.y +
(child_allocation.height - arrow_alloc.height) / 2;
- gtk_widget_size_allocate (priv->arrow_widget, &arrow_alloc);
- gtk_widget_get_clip (priv->arrow_widget, &arrow_clip);
- gdk_rectangle_union (&arrow_clip, &clip, &clip);
- }
+ gtk_widget_size_allocate(priv->arrow_widget, &arrow_alloc, baseline, &arrow_clip);
+ gdk_rectangle_union (out_clip, &arrow_clip, out_clip);
+ }
child_allocation.width = MAX (1, child_allocation.width);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
if (priv->submenu)
gtk_menu_reposition (GTK_MENU (priv->submenu));
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index d87f838..9a346a8 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -755,23 +755,26 @@ gtk_model_button_measure (GtkWidget *widget,
}
static void
-gtk_model_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_model_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
if (GTK_MODEL_BUTTON (widget)->iconic)
{
- GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
}
else
{
- GtkAllocation clip = *allocation;
GtkAllocation child_clip = *allocation;
GtkModelButton *button;
GtkAllocation child_allocation;
GtkWidget *child;
gint check_min_width, check_nat_width;
gint check_min_height, check_nat_height;
- int baseline;
button = GTK_MODEL_BUTTON (widget);
child = gtk_bin_get_child (GTK_BIN (widget));
@@ -797,10 +800,8 @@ gtk_model_button_size_allocate (GtkWidget *widget,
child_allocation.width = check_nat_width;
child_allocation.height = check_nat_height;
- gtk_widget_size_allocate_with_baseline (button->indicator_widget, &child_allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (button->indicator_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (button->indicator_widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (child && gtk_widget_get_visible (child))
{
@@ -824,16 +825,12 @@ gtk_model_button_size_allocate (GtkWidget *widget,
child_allocation.width = allocation->width - border.left - border.right;
child_allocation.height = allocation->height - border.top - border.bottom;
- baseline = gtk_widget_get_allocated_baseline (widget);
if (baseline != -1)
baseline -= border.top;
- gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
}
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 64576a5..6b313e9 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -362,8 +362,10 @@ static void gtk_notebook_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_notebook_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_notebook_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_notebook_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_notebook_popup_menu (GtkWidget *widget);
@@ -2071,17 +2073,15 @@ gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
}
static void
-gtk_notebook_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_notebook_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (priv->box, allocation);
- gtk_widget_get_clip (priv->box, &clip);
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, -1, out_clip);
}
static void
@@ -3959,11 +3959,7 @@ allocate_tab (GtkGizmo *gizmo,
}
}
- gtk_widget_size_allocate_with_baseline (page->tab_label,
- &child_allocation,
- baseline);
-
- gtk_widget_get_clip (page->tab_label, out_clip);
+ gtk_widget_size_allocate (page->tab_label, &child_allocation, baseline, out_clip);
}
static gint
@@ -4534,8 +4530,10 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
{
arrow_allocation.x = allocation->x;
arrow_allocation.width = min;
- gtk_widget_size_allocate (priv->arrow_widget[ii], &arrow_allocation);
- gtk_widget_get_clip (priv->arrow_widget[ii], &arrow_clip);
+ gtk_widget_size_allocate (priv->arrow_widget[ii],
+ &arrow_allocation,
+ -1,
+ &arrow_clip);
allocation->x += min;
allocation->width -= min;
}
@@ -4543,8 +4541,10 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
{
arrow_allocation.x = allocation->x + allocation->width - min;
arrow_allocation.width = min;
- gtk_widget_size_allocate (priv->arrow_widget[ii], &arrow_allocation);
- gtk_widget_get_clip (priv->arrow_widget[ii], &arrow_clip);
+ gtk_widget_size_allocate (priv->arrow_widget[ii],
+ &arrow_allocation,
+ -1,
+ &arrow_clip);
allocation->width -= min;
}
}
@@ -4566,11 +4566,11 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
arrow_allocation.width = size1;
arrow_allocation.height = min;
if (priv->arrow_widget[0])
- gtk_widget_size_allocate (priv->arrow_widget[0], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[0], &arrow_allocation, -1, &arrow_clip);
arrow_allocation.x += size1;
arrow_allocation.width = size2;
if (priv->arrow_widget[1])
- gtk_widget_size_allocate (priv->arrow_widget[1], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[1], &arrow_allocation, -1, &arrow_clip);
allocation->y += min;
allocation->height -= min;
}
@@ -4588,11 +4588,11 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
arrow_allocation.width = size1;
arrow_allocation.height = min;
if (priv->arrow_widget[2])
- gtk_widget_size_allocate (priv->arrow_widget[2], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[2], &arrow_allocation, -1, &arrow_clip);
arrow_allocation.x += size1;
arrow_allocation.width = size2;
if (priv->arrow_widget[3])
- gtk_widget_size_allocate (priv->arrow_widget[3], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[3], &arrow_allocation, -1, &arrow_clip);
allocation->height -= min;
}
break;
@@ -5098,21 +5098,18 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
{
GtkAllocation fixed_allocation = { priv->drag_window_x, priv->drag_window_y,
child_allocation.width, child_allocation.height };
- gtk_widget_size_allocate (page->tab_widget, &fixed_allocation);
- gtk_widget_get_clip (page->tab_widget, &page_clip);
+ gtk_widget_size_allocate (page->tab_widget, &fixed_allocation, -1, &page_clip);
}
else if (page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH)
{
/* needs to be allocated at 0,0
* to be shown in the drag window */
GtkAllocation fixed_allocation = { 0, 0, child_allocation.width, child_allocation.height };
- gtk_widget_size_allocate (page->tab_widget, &fixed_allocation);
- gtk_widget_get_clip (page->tab_widget, &page_clip);
+ gtk_widget_size_allocate (page->tab_widget, &fixed_allocation, -1, &page_clip);
}
else if (gtk_notebook_page_tab_label_is_visible (page))
{
- gtk_widget_size_allocate (page->tab_widget, &child_allocation);
- gtk_widget_get_clip (page->tab_widget, &page_clip);
+ gtk_widget_size_allocate (page->tab_widget, &child_allocation, -1, &page_clip);
}
/* calculate whether to leave a gap based on reorder operation or not */
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index baea9d3..71dfd2d 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -238,6 +238,7 @@ gtk_overlay_child_allocate (GtkOverlay *overlay,
GtkOverlayChild *child)
{
GtkAllocation child_allocation;
+ GtkAllocation child_clip;
if (!gtk_widget_get_visible (child->widget))
return;
@@ -245,23 +246,25 @@ gtk_overlay_child_allocate (GtkOverlay *overlay,
gtk_overlay_compute_child_allocation (overlay, child, &child_allocation);
gtk_overlay_child_update_style_classes (overlay, child->widget, &child_allocation);
- gtk_widget_size_allocate (child->widget, &child_allocation);
+ gtk_widget_size_allocate (child->widget, &child_allocation, -1, &child_clip);
}
static void
-gtk_overlay_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_overlay_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkOverlay *overlay = GTK_OVERLAY (widget);
GtkOverlayPrivate *priv = overlay->priv;
GSList *children;
GtkWidget *main_widget;
- GTK_WIDGET_CLASS (gtk_overlay_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_overlay_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
if (main_widget && gtk_widget_get_visible (main_widget))
- gtk_widget_size_allocate (main_widget, allocation);
+ gtk_widget_size_allocate (main_widget, allocation, -1, out_clip);
for (children = priv->children; children; children = children->next)
gtk_overlay_child_allocate (overlay, children->data);
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 7ce9e5d..b22aca4 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -209,8 +209,10 @@ static void gtk_paned_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_paned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_paned_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_paned_unrealize (GtkWidget *widget);
static void gtk_paned_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
@@ -1224,12 +1226,13 @@ gtk_paned_set_child_visible (GtkPaned *paned,
}
static void
-gtk_paned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_paned_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkPaned *paned = GTK_PANED (widget);
GtkPanedPrivate *priv = paned->priv;
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
if (priv->child1 && gtk_widget_get_visible (priv->child1) &&
@@ -1337,9 +1340,8 @@ gtk_paned_size_allocate (GtkWidget *widget,
child2_allocation.height = child2_height;
}
- gtk_widget_size_allocate (priv->handle_widget, &priv->handle_pos);
- gtk_widget_get_clip (priv->handle_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->handle_widget, &priv->handle_pos, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (gtk_widget_get_mapped (widget) &&
(old_handle_pos.x != priv->handle_pos.x ||
@@ -1356,13 +1358,11 @@ gtk_paned_size_allocate (GtkWidget *widget,
}
- gtk_widget_size_allocate (priv->child1, &child1_allocation);
- gtk_widget_get_clip (priv->child1, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child1, &child1_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
- gtk_widget_size_allocate (priv->child2, &child2_allocation);
- gtk_widget_get_clip (priv->child2, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child2, &child2_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
else
{
@@ -1378,18 +1378,16 @@ gtk_paned_size_allocate (GtkWidget *widget,
gtk_paned_set_child_visible (paned, CHILD1, TRUE);
gtk_paned_set_child_visible (paned, CHILD2, FALSE);
- gtk_widget_size_allocate (priv->child1, &child_allocation);
- gtk_widget_get_clip (priv->child1, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child1, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
else if (priv->child2 && gtk_widget_get_visible (priv->child2))
{
gtk_paned_set_child_visible (paned, CHILD1, FALSE);
gtk_paned_set_child_visible (paned, CHILD2, TRUE);
- gtk_widget_size_allocate (priv->child2, &child_allocation);
- gtk_widget_get_clip (priv->child2, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child2, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
else
{
@@ -1397,8 +1395,6 @@ gtk_paned_size_allocate (GtkWidget *widget,
gtk_paned_set_child_visible (paned, CHILD2, FALSE);
}
}
-
- gtk_widget_set_clip (widget, &clip);
}
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 399bb94..3775505 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -121,8 +121,10 @@ static void gtk_path_bar_measure (GtkWidget *widget,
int *minimum_baseline,
int *natural_baseline);
static void gtk_path_bar_unmap (GtkWidget *widget);
-static void gtk_path_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_path_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_path_bar_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_path_bar_remove (GtkContainer *container,
@@ -449,8 +451,10 @@ gtk_path_bar_unmap (GtkWidget *widget)
/* This is a tad complicated
*/
static void
-gtk_path_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_path_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWidget *child;
GtkPathBar *path_bar = GTK_PATH_BAR (widget);
@@ -463,16 +467,11 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
gint up_slider_offset = 0;
gint down_slider_offset = 0;
GtkRequisition child_requisition;
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
/* No path is set; we don't have to allocate anything. */
if (path_bar->priv->button_list == NULL)
- {
- gtk_widget_set_clip (widget, allocation);
-
- return;
- }
+ return;
direction = gtk_widget_get_direction (widget);
allocation_width = allocation->width;
@@ -623,9 +622,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
gtk_widget_set_tooltip_text (child, NULL);
gtk_widget_set_child_visible (child, TRUE);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (direction == GTK_TEXT_DIR_RTL)
{
@@ -654,9 +652,10 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
{
child_allocation.width = path_bar->priv->slider_width;
child_allocation.x = up_slider_offset + allocation->x;
- gtk_widget_size_allocate (path_bar->priv->up_slider_button, &child_allocation);
- gtk_widget_get_clip (path_bar->priv->up_slider_button, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (path_bar->priv->up_slider_button,
+ &child_allocation,
+ -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
gtk_widget_show (path_bar->priv->up_slider_button);
@@ -674,9 +673,10 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
child_allocation.width = path_bar->priv->slider_width;
child_allocation.x = down_slider_offset + allocation->x;
- gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
- gtk_widget_get_clip (path_bar->priv->down_slider_button, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (path_bar->priv->down_slider_button,
+ &child_allocation,
+ -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, TRUE);
gtk_widget_show (path_bar->priv->down_slider_button);
@@ -686,8 +686,6 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
{
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, FALSE);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index b1ca46a..3c0d360 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -252,7 +252,7 @@ allocate_contents (GtkGizmo *gizmo,
GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
if (child)
- gtk_widget_size_allocate (child, (GtkAllocation*)allocation);
+ gtk_widget_size_allocate (child, allocation, -1, out_clip);
}
static void
@@ -368,6 +368,7 @@ gtk_popover_get_property (GObject *object,
static gboolean
transitions_enabled (GtkPopover *popover)
{
+ /*return FALSE;*/
return gtk_settings_get_enable_animations (gtk_widget_get_settings (GTK_WIDGET (popover)));
}
@@ -1366,13 +1367,13 @@ gtk_popover_measure (GtkWidget *widget,
}
static void
-gtk_popover_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_popover_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkPopover *popover = GTK_POPOVER (widget);
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
- GtkAllocation child_clip;
- GtkAllocation clip = *allocation;
GtkAllocation child_alloc = *allocation;
/* Note that we in measure() we add TAIL_HEIGHT in both directions, regardless
@@ -1401,20 +1402,10 @@ gtk_popover_size_allocate (GtkWidget *widget,
break;
}
- gtk_widget_size_allocate (priv->contents_widget, &child_alloc);
- gtk_widget_get_clip (priv->contents_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->contents_widget, &child_alloc, -1, out_clip);
if (gtk_widget_get_realized (widget))
- {
- GtkAllocation a;
- gtk_widget_get_window_allocation (widget, &a);
- gdk_window_move_resize (gtk_widget_get_window (widget),
- a.x, a.y, a.width, a.height);
- gtk_popover_update_shape (popover);
- }
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_popover_update_shape (popover);
}
static gboolean
@@ -1835,9 +1826,11 @@ _gtk_popover_parent_unmap (GtkWidget *widget,
}
static void
-_gtk_popover_parent_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- GtkPopover *popover)
+_gtk_popover_parent_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip,
+ GtkPopover *popover)
{
gtk_popover_update_position (popover);
}
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 3998f29..3022032 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -140,8 +140,10 @@ static void gtk_progress_bar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_progress_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_progress_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_progress_bar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
@@ -445,8 +447,7 @@ allocate_trough (GtkGizmo *gizmo,
}
}
- gtk_widget_size_allocate (priv->progress_widget, &alloc);
- gtk_widget_get_clip (priv->progress_widget, out_clip);
+ gtk_widget_size_allocate (priv->progress_widget, &alloc,-1, out_clip);
}
@@ -624,10 +625,11 @@ get_current_text (GtkProgressBar *pbar)
}
static void
-gtk_progress_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_progress_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
GtkAllocation child_clip = *allocation;
GtkProgressBarPrivate *priv;
gint bar_width, bar_height;
@@ -657,15 +659,11 @@ gtk_progress_bar_size_allocate (GtkWidget *widget,
alloc.width = bar_width;
alloc.height = bar_height;
- gtk_widget_size_allocate (priv->trough_widget, &alloc);
- gtk_widget_get_clip (priv->trough_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->trough_widget, &alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (!priv->show_text)
- {
- gtk_widget_set_clip (widget, &clip);
- return;
- }
+ return;
gtk_widget_measure (priv->label, GTK_ORIENTATION_HORIZONTAL, -1,
&text_min, &text_nat,
@@ -691,11 +689,8 @@ gtk_progress_bar_size_allocate (GtkWidget *widget,
alloc.height = text_height;
}
- gtk_widget_size_allocate (priv->label, &alloc);
- gtk_widget_get_clip (priv->label, &text_clip);
- gdk_rectangle_union (&clip, &text_clip, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->label, &alloc, -1, &text_clip);
+ gdk_rectangle_union (out_clip, &text_clip, out_clip);
}
static void
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 839d22c..2da3658 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -162,8 +162,10 @@ static void gtk_range_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_range_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_range_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_range_unmap (GtkWidget *widget);
static void gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
@@ -1422,8 +1424,7 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
gtk_adjustment_get_value (priv->adjustment),
&slider_alloc);
- gtk_widget_size_allocate (priv->slider_widget, &slider_alloc);
- gtk_widget_get_clip (priv->slider_widget, out_clip);
+ gtk_widget_size_allocate (priv->slider_widget, &slider_alloc, -1, out_clip);
if (gtk_adjustment_get_lower (priv->adjustment) == gtk_adjustment_get_upper (priv->adjustment))
value = 0;
@@ -1465,8 +1466,7 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
fill_alloc.y += allocation->height - fill_alloc.height;
}
- gtk_widget_size_allocate (priv->fill_widget, &fill_alloc);
- gtk_widget_get_clip (priv->fill_widget, &fill_clip);
+ gtk_widget_size_allocate (priv->fill_widget, &fill_alloc, -1, &fill_clip);
gdk_rectangle_union (out_clip, &fill_clip, out_clip);
}
@@ -1505,9 +1505,7 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
highlight_alloc.height = MAX (min, allocation->height* value);
}
- gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc);
- gtk_widget_get_clip (priv->highlight_widget, &highlight_clip);
- gdk_rectangle_union (out_clip, &highlight_clip, out_clip);
+ gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc, -1, &highlight_clip);
}
}
@@ -1599,13 +1597,13 @@ clamp_dimensions (const GtkAllocation *allocation,
}
static void
-gtk_range_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_range_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
- GtkAllocation clip = *allocation;
- GtkAllocation child_clip;
GtkBorder border = { 0 };
GtkAllocation box_alloc;
int box_min_width, box_min_height;
@@ -1632,14 +1630,11 @@ gtk_range_size_allocate (GtkWidget *widget,
box_alloc.width = box_min_width;
box_alloc.height = box_min_height;
- gtk_widget_size_allocate (priv->trough_widget, &box_alloc);
- gtk_widget_get_clip (priv->trough_widget, &child_clip);
+ gtk_widget_size_allocate (priv->trough_widget, &box_alloc, -1, out_clip);
/* TODO: we should compute a proper clip from get_range_border(),
* but this will at least give us outset shadows.
*/
- gdk_rectangle_union (&child_clip, &clip, &clip);
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkrecentchooserwidget.c b/gtk/gtkrecentchooserwidget.c
index 0d50098..862277e 100644
--- a/gtk/gtkrecentchooserwidget.c
+++ b/gtk/gtkrecentchooserwidget.c
@@ -154,15 +154,17 @@ gtk_recent_chooser_widget_snapshot (GtkWidget *widget,
}
static void
-gtk_recent_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_recent_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkRecentChooserWidget *self = GTK_RECENT_CHOOSER_WIDGET (widget);
GtkRecentChooserWidgetPrivate *priv = gtk_recent_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_recent_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_recent_chooser_widget_parent_class)->size_allocate (widget, allocation, -1,
out_clip);
- gtk_widget_size_allocate (priv->chooser, allocation);
+ gtk_widget_size_allocate (priv->chooser, allocation, -1, out_clip);
}
static void
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 1d2baf5..828453b 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -94,8 +94,10 @@ static GParamSpec *props[LAST_PROP] = { NULL, };
static void gtk_revealer_real_add (GtkContainer *widget,
GtkWidget *child);
-static void gtk_revealer_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_revealer_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_revealer_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
@@ -293,9 +295,9 @@ effective_transition (GtkRevealer *revealer)
}
static void
-gtk_revealer_get_child_allocation (GtkRevealer *revealer,
- GtkAllocation *allocation,
- GtkAllocation *child_allocation)
+gtk_revealer_get_child_allocation (GtkRevealer *revealer,
+ const GtkAllocation *allocation,
+ GtkAllocation *child_allocation)
{
GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
GtkWidget *child;
@@ -357,12 +359,13 @@ gtk_revealer_real_add (GtkContainer *container,
}
static void
-gtk_revealer_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_revealer_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkRevealer *revealer = GTK_REVEALER (widget);
GtkWidget *child;
- GtkAllocation clip = *allocation;
child = gtk_bin_get_child (GTK_BIN (revealer));
if (child != NULL && gtk_widget_get_visible (child))
@@ -370,11 +373,8 @@ gtk_revealer_real_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation;
gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, -1, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 75b89ad..28431e7 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -403,8 +403,7 @@ gtk_scale_allocate_value (GtkScale *scale,
}
}
- gtk_widget_size_allocate (priv->value_widget, &value_alloc);
- gtk_widget_get_clip (priv->value_widget, out_clip);
+ gtk_widget_size_allocate (priv->value_widget, &value_alloc, -1, out_clip);
}
static void
@@ -451,8 +450,7 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
indicator_alloc.height = indicator_height;
}
- gtk_widget_size_allocate_with_baseline (mark->indicator_widget, &indicator_alloc, baseline);
- gtk_widget_get_clip (mark->indicator_widget, out_clip);
+ gtk_widget_size_allocate (mark->indicator_widget, &indicator_alloc, baseline, out_clip);
if (mark->label_widget)
{
@@ -473,8 +471,7 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
label_alloc.x = indicator_alloc.x + indicator_alloc.width;
}
- gtk_widget_size_allocate_with_baseline (mark->label_widget, &label_alloc, baseline);
- gtk_widget_get_clip (mark->label_widget, &label_clip);
+ gtk_widget_size_allocate (mark->label_widget, &label_alloc, baseline, &label_clip);
gdk_rectangle_union (out_clip, &label_clip, out_clip);
}
}
@@ -531,8 +528,7 @@ gtk_scale_allocate_marks (GtkGizmo *gizmo,
mark_alloc.y -= mark_size / 2;
}
- gtk_widget_size_allocate_with_baseline (mark->widget, &mark_alloc, baseline);
- gtk_widget_get_clip (mark->widget, &mark_clip);
+ gtk_widget_size_allocate (mark->widget, &mark_alloc, baseline, &mark_clip);
gdk_rectangle_union (out_clip, &mark_clip, out_clip);
}
@@ -540,16 +536,17 @@ gtk_scale_allocate_marks (GtkGizmo *gizmo,
}
static void
-gtk_scale_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_scale_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkScale *scale = GTK_SCALE (widget);
GtkScalePrivate *priv = scale->priv;
- GtkAllocation clip = *allocation;
GtkAllocation marks_clip, range_rect, marks_rect;
GtkOrientation orientation;
- GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
gtk_range_get_range_rect (GTK_RANGE (scale), &range_rect);
@@ -567,9 +564,8 @@ gtk_scale_size_allocate (GtkWidget *widget,
marks_rect = range_rect;
marks_rect.y = 0;
marks_rect.height = marks_height;
- gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->top_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
if (priv->bottom_marks_widget)
@@ -581,9 +577,8 @@ gtk_scale_size_allocate (GtkWidget *widget,
marks_rect = range_rect;
marks_rect.y += range_rect.height;
marks_rect.height = marks_height;
- gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->bottom_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
}
else
@@ -599,9 +594,8 @@ gtk_scale_size_allocate (GtkWidget *widget,
marks_rect = range_rect;
marks_rect.x -= marks_width;
marks_rect.width = marks_width;
- gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->top_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
if (priv->bottom_marks_widget)
@@ -613,9 +607,8 @@ gtk_scale_size_allocate (GtkWidget *widget,
marks_rect = range_rect;
marks_rect.x += range_rect.width;
marks_rect.width = marks_width;
- gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->bottom_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
}
@@ -624,10 +617,8 @@ gtk_scale_size_allocate (GtkWidget *widget,
GtkAllocation value_clip;
gtk_scale_allocate_value (scale, &value_clip);
- gdk_rectangle_union (&clip, &value_clip, &clip);
+ gdk_rectangle_union (out_clip, &value_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
#define add_slider_binding(binding_set, keyval, mask, scroll) \
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index 7d77f68..34d0d4c 100644
--- a/gtk/gtkscrollbar.c
+++ b/gtk/gtkscrollbar.c
@@ -120,15 +120,15 @@ gtk_scrollbar_measure (GtkWidget *widget,
}
static void
-gtk_scrollbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_scrollbar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkScrollbar *self = GTK_SCROLLBAR (widget);
GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
- gtk_widget_size_allocate (priv->box, allocation);
-
- gtk_widget_set_clip (widget, allocation);
+ gtk_widget_size_allocate (priv->box, allocation, -1, out_clip);
}
static void
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 14efd37..5310eac 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -311,8 +311,10 @@ static void gtk_scrolled_window_finalize (GObject *objec
static void gtk_scrolled_window_destroy (GtkWidget *widget);
static void gtk_scrolled_window_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gboolean gtk_scrolled_window_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
static gboolean gtk_scrolled_window_focus (GtkWidget *widget,
@@ -1347,8 +1349,10 @@ captured_event_cb (GtkWidget *widget,
}
static void
-gtk_scrolled_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_scrolled_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
@@ -1583,24 +1587,24 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
gtk_widget_set_child_visible (priv->hscrollbar, priv->hscrollbar_visible);
if (priv->hscrollbar_visible)
{
+ GtkAllocation clip;
gtk_scrolled_window_allocate_scrollbar (scrolled_window,
priv->hscrollbar,
&child_allocation);
- gtk_widget_size_allocate (priv->hscrollbar, &child_allocation);
+ gtk_widget_size_allocate (priv->hscrollbar, &child_allocation, -1, &clip);
}
gtk_widget_set_child_visible (priv->vscrollbar, priv->vscrollbar_visible);
if (priv->vscrollbar_visible)
{
+ GtkAllocation clip;
gtk_scrolled_window_allocate_scrollbar (scrolled_window,
priv->vscrollbar,
&child_allocation);
- gtk_widget_size_allocate (priv->vscrollbar, &child_allocation);
+ gtk_widget_size_allocate (priv->vscrollbar, &child_allocation, -1, &clip);
}
gtk_scrolled_window_check_attach_pan_gesture (scrolled_window);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
@@ -2975,6 +2979,7 @@ gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (swindow);
GtkWidget *widget = GTK_WIDGET (swindow), *child;
GtkAllocation child_allocation;
+ GtkAllocation child_clip;
int sb_width;
int sb_height;
@@ -3016,7 +3021,7 @@ gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
child_allocation.height = MAX (1, child_allocation.height - sb_height);
}
- gtk_widget_size_allocate (child, &child_allocation);
+ gtk_widget_size_allocate (child, &child_allocation, -1, &child_clip);
}
static void
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index 5306b8e..ebb2f50 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -124,20 +124,11 @@ gtk_separator_init (GtkSeparator *separator)
}
static void
-gtk_separator_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
-static void
gtk_separator_class_init (GtkSeparatorClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
- widget_class->size_allocate = gtk_separator_size_allocate;
-
object_class->set_property = gtk_separator_set_property;
object_class->get_property = gtk_separator_get_property;
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index 4893ab8..3cd9f2c 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -68,8 +68,6 @@ static void gtk_separator_tool_item_get_property (GObject
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_separator_tool_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
static void gtk_separator_tool_item_add (GtkContainer *container,
GtkWidget *child);
@@ -91,8 +89,6 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
object_class->set_property = gtk_separator_tool_item_set_property;
object_class->get_property = gtk_separator_tool_item_get_property;
- widget_class->size_allocate = gtk_separator_tool_item_size_allocate;
-
toolitem_class->create_menu_proxy = gtk_separator_tool_item_create_menu_proxy;
container_class->add = gtk_separator_tool_item_add;
@@ -178,13 +174,6 @@ gtk_separator_tool_item_get_property (GObject *object,
}
}
-static void
-gtk_separator_tool_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
/**
* gtk_separator_tool_item_new:
*
diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c
index 6815c0d..6ae5366 100644
--- a/gtk/gtkshortcutsshortcut.c
+++ b/gtk/gtkshortcutsshortcut.c
@@ -516,12 +516,14 @@ gtk_shortcuts_shortcut_snapshot (GtkWidget *widget,
}
static void
-gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation, baseline,
out_clip);
- gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box), allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box), allocation, -1, out_clip);
}
static void
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index d1eaef2..2593cd8 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -253,8 +253,10 @@ static void gtk_spin_button_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_spin_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_spin_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gint gtk_spin_button_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static void gtk_spin_button_grab_notify (GtkWidget *widget,
@@ -1055,17 +1057,14 @@ gtk_spin_button_measure (GtkWidget *widget,
}
static void
-gtk_spin_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_spin_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (GTK_SPIN_BUTTON (widget));
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate_with_baseline (priv->box, allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (priv->box, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
}
static gint
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index 12c98aa..3b4fc7d 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -104,13 +104,6 @@ gtk_spinner_measure (GtkWidget *widget,
}
static void
-gtk_spinner_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
-static void
gtk_spinner_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
@@ -195,7 +188,6 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
gobject_class->set_property = gtk_spinner_set_property;
widget_class = GTK_WIDGET_CLASS(klass);
- widget_class->size_allocate = gtk_spinner_size_allocate;
widget_class->snapshot = gtk_spinner_snapshot;
widget_class->measure = gtk_spinner_measure;
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index b1d515a..b77bde2 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -168,8 +168,10 @@ static void gtk_stack_forall (GtkContainer *contain
static void gtk_stack_compute_expand (GtkWidget *widget,
gboolean *hexpand,
gboolean *vexpand);
-static void gtk_stack_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_stack_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_stack_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_stack_measure (GtkWidget *widget,
@@ -2027,12 +2029,13 @@ gtk_stack_snapshot (GtkWidget *widget,
}
static void
-gtk_stack_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_stack_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- GtkAllocation clip = *allocation;
GdkRectangle child_clip;
GtkAllocation child_allocation;
@@ -2052,10 +2055,8 @@ gtk_stack_size_allocate (GtkWidget *widget,
&min, &nat, NULL, NULL);
child_allocation.height = MAX (min, allocation->height);
- gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation);
- gtk_widget_get_clip (priv->last_visible_child->widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
-
+ gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (!gdk_rectangle_equal (&priv->last_visible_surface_allocation,
&child_allocation))
@@ -2100,12 +2101,9 @@ gtk_stack_size_allocate (GtkWidget *widget,
child_allocation.x = (allocation->height - child_allocation.height);
}
- gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation);
- gtk_widget_get_clip (priv->visible_child->widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
#define LERP(a, b, t) ((a) + (((b) - (a)) * (1.0 - (t))))
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index bddd46f..8c3ce37 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -323,12 +323,13 @@ gtk_switch_measure (GtkWidget *widget,
}
static void
-gtk_switch_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_switch_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkSwitch *self = GTK_SWITCH (widget);
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
GtkAllocation child_alloc;
GtkAllocation slider_alloc;
@@ -339,9 +340,9 @@ gtk_switch_size_allocate (GtkWidget *widget,
slider_alloc.width = allocation->width / 2;
slider_alloc.height = allocation->height;
- gtk_widget_size_allocate (priv->slider, &slider_alloc);
+ gtk_widget_size_allocate (priv->slider, &slider_alloc, -1, &child_clip);
gtk_widget_get_clip (priv->slider, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
/* Center ON label in left half */
@@ -351,9 +352,8 @@ gtk_switch_size_allocate (GtkWidget *widget,
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
child_alloc.y = (allocation->height - min) / 2;
child_alloc.height = min;
- gtk_widget_size_allocate (priv->on_label, &child_alloc);
- gtk_widget_get_clip (priv->on_label, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->on_label, &child_alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
/* Center OFF label in right half */
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
@@ -362,11 +362,8 @@ gtk_switch_size_allocate (GtkWidget *widget,
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
child_alloc.y = (allocation->height - min) / 2;
child_alloc.height = min;
- gtk_widget_size_allocate (priv->off_label, &child_alloc);
- gtk_widget_get_clip (priv->off_label, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->off_label, &child_alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
static void
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index edd39ac..6a52445 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -386,8 +386,10 @@ static void gtk_text_view_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_text_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_text_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_text_view_realize (GtkWidget *widget);
static void gtk_text_view_unrealize (GtkWidget *widget);
static void gtk_text_view_map (GtkWidget *widget);
@@ -4066,10 +4068,11 @@ gtk_text_view_update_child_allocation (GtkTextView *text_view,
GtkTextViewChild *vc)
{
GtkAllocation allocation;
+ GtkAllocation clip;
gtk_text_view_compute_child_allocation (text_view, vc, &allocation);
- gtk_widget_size_allocate (vc->widget, &allocation);
+ gtk_widget_size_allocate (vc->widget, &allocation, -1, &clip);
#if 0
g_print ("allocation for %p allocated to %d,%d yoffset = %d\n",
@@ -4151,6 +4154,7 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
else
{
GtkAllocation allocation;
+ GtkAllocation clip;
GtkRequisition child_req;
allocation.x = child->x;
@@ -4170,7 +4174,7 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
allocation.width = child_req.width;
allocation.height = child_req.height;
- gtk_widget_size_allocate (child->widget, &allocation);
+ gtk_widget_size_allocate (child->widget, &allocation, -1, &clip);
}
tmp_list = tmp_list->next;
@@ -4178,8 +4182,10 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
}
static void
-gtk_text_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_text_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkTextView *text_view;
GtkTextViewPrivate *priv;
@@ -4294,8 +4300,6 @@ gtk_text_view_size_allocate (GtkWidget *widget,
* chance to run. So we do the work here.
*/
gtk_text_view_flush_first_validate (text_view);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
@@ -8677,6 +8681,7 @@ adjust_allocation (GtkWidget *widget,
int dy)
{
GtkAllocation allocation;
+ GtkAllocation clip;
if (!gtk_widget_is_drawable (widget))
return;
@@ -8684,7 +8689,7 @@ adjust_allocation (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
allocation.x += dx;
allocation.y += dy;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
}
static void
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index f8fa09d..1244cfb 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -194,7 +194,9 @@ static void gtk_toolbar_get_property (GObject *object,
static void gtk_toolbar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_toolbar_style_updated (GtkWidget *widget);
static gboolean gtk_toolbar_focus (GtkWidget *widget,
GtkDirectionType dir);
@@ -1263,8 +1265,10 @@ rebuild_menu (GtkToolbar *toolbar)
}
static void
-gtk_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_toolbar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
GtkToolbarPrivate *priv = toolbar->priv;
@@ -1571,8 +1575,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
if (need_arrow)
{
- gtk_widget_size_allocate (GTK_WIDGET (priv->arrow_button),
- &arrow_allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (priv->arrow_button), &arrow_allocation, -1, out_clip);
gtk_widget_show (GTK_WIDGET (priv->arrow_button));
}
else
@@ -1585,8 +1588,6 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
g_free (allocations);
g_free (new_states);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
@@ -3117,9 +3118,10 @@ static void
toolbar_content_size_allocate (ToolbarContent *content,
GtkAllocation *allocation)
{
+ GtkAllocation clip;
+
content->allocation = *allocation;
- gtk_widget_size_allocate (GTK_WIDGET (content->item),
- allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (content->item), allocation, -1, &clip);
}
static void
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index e9375f2..962e7e7 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -879,8 +879,10 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget,
}
static void
-gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
GtkToolItemGroupPrivate* priv = group->priv;
@@ -903,7 +905,8 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
/* chain up */
- GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->size_allocate (widget, allocation,
+ baseline, out_clip);
child_allocation.x = 0;
child_allocation.y = 0;
@@ -928,7 +931,7 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
child_allocation.x = allocation->width - child_allocation.width;
}
- gtk_widget_size_allocate (priv->header, &child_allocation);
+ gtk_widget_size_allocate (priv->header, &child_allocation, -1, out_clip);
if (GTK_ORIENTATION_VERTICAL == orientation)
child_allocation.y += child_allocation.height;
@@ -1055,7 +1058,7 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
child_allocation.height = item_size.height;
- gtk_widget_size_allocate (GTK_WIDGET (child->item), &child_allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (child->item), &child_allocation, -1, out_clip);
gtk_widget_set_child_visible (GTK_WIDGET (child->item), TRUE);
}
@@ -1076,12 +1079,12 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
}
static void
-gtk_tool_item_group_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tool_item_group_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- gtk_tool_item_group_real_size_allocate (widget, allocation);
-
- gtk_widget_queue_draw (widget);
+ gtk_tool_item_group_real_size_allocate (widget, allocation, baseline, out_clip);
}
static void
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 90e0699..5c8754d 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -472,8 +472,10 @@ gtk_tool_palette_measure (GtkWidget *widget,
static void
-gtk_tool_palette_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tool_palette_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
GtkAdjustment *adjustment = NULL;
@@ -496,7 +498,8 @@ gtk_tool_palette_size_allocate (GtkWidget *widget,
direction = gtk_widget_get_direction (widget);
- GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->size_allocate (widget, allocation,
+ baseline, out_clip);
if (GTK_ORIENTATION_VERTICAL == palette->priv->orientation)
{
@@ -640,7 +643,7 @@ gtk_tool_palette_size_allocate (GtkWidget *widget,
else
child_allocation.x = x;
- gtk_widget_size_allocate (GTK_WIDGET (group->widget), &child_allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (group->widget), &child_allocation, -1, out_clip);
gtk_widget_show (GTK_WIDGET (group->widget));
if (GTK_ORIENTATION_VERTICAL == palette->priv->orientation)
@@ -702,10 +705,11 @@ gtk_tool_palette_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkAllocation allocation;
+ GtkAllocation clip;
GtkWidget *widget = GTK_WIDGET (data);
gtk_widget_get_allocation (widget, &allocation);
- gtk_tool_palette_size_allocate (widget, &allocation);
+ gtk_tool_palette_size_allocate (widget, &allocation, -1, &clip);
}
static void
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index b48d706..1c1ede9 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -592,8 +592,10 @@ static void gtk_tree_view_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_tree_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_tree_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_tree_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_tree_view_key_press (GtkWidget *widget,
@@ -2553,6 +2555,7 @@ gtk_tree_view_size_allocate_drag_column (GtkWidget *widget)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GtkAllocation drag_allocation;
+ GtkAllocation clip;
GtkWidget *button;
if (tree_view->priv->drag_column == NULL)
@@ -2564,12 +2567,14 @@ gtk_tree_view_size_allocate_drag_column (GtkWidget *widget)
drag_allocation.y = 0;
drag_allocation.width = gdk_window_get_width (tree_view->priv->drag_window);
drag_allocation.height = gdk_window_get_height (tree_view->priv->drag_window);
- gtk_widget_size_allocate (button, &drag_allocation);
+ gtk_widget_size_allocate (button, &drag_allocation, -1, &clip);
}
static void
-gtk_tree_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tree_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *tmp_list;
@@ -2743,10 +2748,8 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
child_rect.y = MAX (min_y, MIN (max_y, child_rect.y));
gtk_tree_path_free (path);
- gtk_widget_size_allocate (child->widget, &child_rect);
+ gtk_widget_size_allocate (child->widget, &child_rect, -1, out_clip);
}
-
- gtk_widget_set_clip (widget, allocation);
}
/* Grabs the focus and unsets the GTK_TREE_VIEW_DRAW_KEYFOCUS flag */
@@ -9642,6 +9645,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
GdkDevice *device)
{
GtkAllocation allocation;
+ GtkAllocation clip;
GtkAllocation button_allocation;
GtkWidget *button;
GtkStyleContext *context;
@@ -9679,7 +9683,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
tree_view->priv->drag_column_x = button_allocation.x;
allocation = button_allocation;
allocation.x = 0;
- gtk_widget_size_allocate (button, &allocation);
+ gtk_widget_size_allocate (button, &allocation, -1, &clip);
tree_view->priv->drag_column = column;
gdk_window_show (tree_view->priv->drag_window);
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 8e20cd1..d989e4d 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -2072,6 +2072,7 @@ _gtk_tree_view_column_allocate (GtkTreeViewColumn *tree_column,
gboolean rtl;
GtkAllocation allocation = { 0, 0, 0, 0 };
GtkAllocation widget_allocation;
+ GtkAllocation clip;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
@@ -2093,7 +2094,7 @@ _gtk_tree_view_column_allocate (GtkTreeViewColumn *tree_column,
allocation.width = width;
allocation.height = _gtk_tree_view_get_header_height (GTK_TREE_VIEW (priv->tree_view));
- gtk_widget_size_allocate (priv->button, &allocation);
+ gtk_widget_size_allocate (priv->button, &allocation, -1, &clip);
}
if (priv->window)
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index e633844..54ff2b1 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -98,8 +98,10 @@ static void gtk_viewport_get_property (GObject *object,
static void gtk_viewport_destroy (GtkWidget *widget);
static void gtk_viewport_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_viewport_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_viewport_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
static void viewport_set_adjustment (GtkViewport *viewport,
@@ -503,12 +505,13 @@ gtk_viewport_snapshot (GtkWidget *widget,
}
static void
-gtk_viewport_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_viewport_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkViewport *viewport = GTK_VIEWPORT (widget);
GtkViewportPrivate *priv = viewport->priv;
- GtkAllocation clip = *allocation;
GtkAdjustment *hadjustment = priv->hadjustment;
GtkAdjustment *vadjustment = priv->vadjustment;
GtkWidget *child;
@@ -522,21 +525,19 @@ gtk_viewport_size_allocate (GtkWidget *widget,
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
- GtkAllocation child_allocation;
+ GtkAllocation child_allocation, child_clip;
child_allocation.x = allocation->x - gtk_adjustment_get_value (hadjustment);
child_allocation.y = allocation->y - gtk_adjustment_get_value (vadjustment);
child_allocation.width = gtk_adjustment_get_upper (hadjustment);
child_allocation.height = gtk_adjustment_get_upper (vadjustment);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &clip);
+ /* Explicitly ignore the child clip here. */
+ gtk_widget_size_allocate (child, &child_allocation, -1, &child_clip);
}
g_object_thaw_notify (G_OBJECT (hadjustment));
g_object_thaw_notify (G_OBJECT (vadjustment));
-
- gtk_widget_set_clip (widget, &clip);
}
static void
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index dcf3871..dee81a7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -619,8 +619,10 @@ static void gtk_widget_real_map (GtkWidget *widget);
static void gtk_widget_real_unmap (GtkWidget *widget);
static void gtk_widget_real_realize (GtkWidget *widget);
static void gtk_widget_real_unrealize (GtkWidget *widget);
-static void gtk_widget_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_widget_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_widget_real_direction_changed(GtkWidget *widget,
GtkTextDirection previous_direction);
@@ -1646,6 +1648,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
* @widget: the object which received the signal.
* @allocation: (type Gtk.Allocation): the region which has been
* allocated to the widget.
+ * @baseline: the baseline
+ * @out_clip: (type Gtk.Allocation): Return address for the widget's clip
*/
widget_signals[SIZE_ALLOCATE] =
g_signal_new (I_("size-allocate"),
@@ -1654,8 +1658,10 @@ gtk_widget_class_init (GtkWidgetClass *klass)
G_STRUCT_OFFSET (GtkWidgetClass, size_allocate),
NULL, NULL,
NULL,
- G_TYPE_NONE, 1,
- GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
+ G_TYPE_NONE, 3,
+ GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_INT,
+ GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* GtkWidget::state-flags-changed:
@@ -5293,7 +5299,6 @@ gtk_widget_queue_draw_region (GtkWidget *widget,
{
GtkWidget *parent;
cairo_region_t *region2;
- GtkAllocation alloc;
int x, y;
GtkCssStyle *parent_style;
GtkBorder border, padding;
@@ -5324,7 +5329,6 @@ gtk_widget_queue_draw_region (GtkWidget *widget,
g_assert (parent != NULL);
/* @region's coordinates are originally relative to @widget's origin */
- gtk_widget_get_allocation (widget, &alloc);
if (widget != parent)
gtk_widget_translate_coordinates (_gtk_widget_get_parent (widget),
parent,
@@ -5358,28 +5362,27 @@ invalidate:
/**
- * gtk_widget_size_allocate_with_baseline:
+ * gtk_widget_size_allocate:
* @widget: a #GtkWidget
* @allocation: position and size to be allocated to @widget
* @baseline: The baseline of the child, or -1
+ * @out_clip: (out): Return location for @widget's clip region. The returned clip
+ * will be in the coordinate system of @widget's parent, just like @allocation.
*
- * This function is only used by #GtkContainer subclasses, to assign a size,
+ * This function is only used by #GtkWidget subclasses, to assign a size,
* position and (optionally) baseline to their child widgets.
*
- * In this function, the allocation and baseline may be adjusted. It
- * will be forced to a 1x1 minimum size, and the
- * adjust_size_allocation virtual and adjust_baseline_allocation
- * methods on the child will be used to adjust the allocation and
- * baseline. Standard adjustments include removing the widget's
- * margins, and applying the widget’s #GtkWidget:halign and
- * #GtkWidget:valign properties.
+ * In this function, the allocation and baseline may be adjusted. The given
+ * allocation will be forced to be bigger than the widget's minimum size,
+ * as well as at least 1×1 in size.
*
* Since: 3.10
**/
void
-gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
- GtkAllocation *allocation,
- gint baseline)
+gtk_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GdkRectangle real_allocation;
@@ -5393,14 +5396,21 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
gint min_width, min_height;
GtkCssStyle *style;
GtkBorder margin, border, padding;
+ GtkAllocation new_clip;
g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (!priv->visible && !_gtk_widget_is_toplevel (widget))
- return;
+ g_return_if_fail (baseline >= -1);
+ g_return_if_fail (out_clip != NULL);
+ g_return_if_fail (allocation != NULL);
gtk_widget_push_verify_invariants (widget);
+ if (!priv->visible && !_gtk_widget_is_toplevel (widget))
+ {
+ memset (out_clip, 0, sizeof (GdkRectangle));
+ goto out;
+ }
+
#ifdef G_ENABLE_DEBUG
if (GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), RESIZE))
{
@@ -5424,10 +5434,10 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
depth = 0;
parent = widget;
while (parent)
- {
- depth++;
- parent = _gtk_widget_get_parent (parent);
- }
+ {
+ depth++;
+ parent = _gtk_widget_get_parent (parent);
+ }
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
g_message ("gtk_widget_size_allocate: %*s%s %d %d %d %d, baseline %d",
@@ -5542,11 +5552,27 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
/* Set the widget allocation to real_allocation now, pass the smaller allocation to the vfunc */
priv->allocation = real_allocation;
- priv->clip = real_allocation;
priv->allocated_baseline = baseline;
if (!alloc_needed && !size_changed && !baseline_changed)
- goto out;
+ {
+ gtk_widget_set_clip (widget, &priv->reported_clip);
+ *out_clip = priv->clip;
+
+ /* Still have to move the window... */
+ if (_gtk_widget_get_realized (widget) &&
+ _gtk_widget_get_has_window (widget))
+ {
+ GtkAllocation window_alloc;
+
+ gtk_widget_get_window_allocation (widget, &window_alloc);
+ gdk_window_move_resize (priv->window,
+ window_alloc.x, window_alloc.y,
+ window_alloc.width, window_alloc.height);
+ }
+
+ goto check_clip;
+ }
/* Since gtk_widget_measure does it for us, we can be sure here that
* the given alloaction is large enough for the css margin/bordder/padding */
@@ -5556,11 +5582,18 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
margin.right + border.right + padding.right;
real_allocation.height -= margin.top + border.top + padding.top +
margin.bottom + border.bottom + padding.bottom;
+ new_clip = real_allocation;
if (g_signal_has_handler_pending (widget, widget_signals[SIZE_ALLOCATE], 0, FALSE))
- g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
+ g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0,
+ &real_allocation,
+ baseline,
+ &new_clip);
else
- GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget, &real_allocation);
+ GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget,
+ &real_allocation,
+ baseline,
+ &new_clip);
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
#ifdef G_ENABLE_DEBUG
@@ -5570,10 +5603,16 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
gtk_widget_get_name (widget), widget);
}
#endif
+
+ priv->reported_clip = new_clip;
+ gtk_widget_set_clip (widget, &priv->reported_clip);
+ *out_clip = priv->clip;
+
gtk_widget_ensure_resize (widget);
priv->alloc_needed = FALSE;
priv->alloc_needed_on_child = FALSE;
+check_clip:
size_changed |= (old_clip.width != priv->clip.width ||
old_clip.height != priv->clip.height);
position_changed |= (old_clip.x != priv->clip.x ||
@@ -5611,31 +5650,6 @@ out:
gtk_widget_pop_verify_invariants (widget);
}
-
-/**
- * gtk_widget_size_allocate:
- * @widget: a #GtkWidget
- * @allocation: position and size to be allocated to @widget
- *
- * This function is only used by #GtkContainer subclasses, to assign a size
- * and position to their child widgets.
- *
- * In this function, the allocation may be adjusted. It will be forced
- * to a 1x1 minimum size, and the adjust_size_allocation virtual
- * method on the child will be used to adjust the allocation. Standard
- * adjustments include removing the widget’s margins, and applying the
- * widget’s #GtkWidget:halign and #GtkWidget:valign properties.
- *
- * For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline()
- * instead.
- **/
-void
-gtk_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_size_allocate_with_baseline (widget, allocation, -1);
-}
-
/**
* gtk_widget_common_ancestor:
* @widget_a: a #GtkWidget
@@ -5768,17 +5782,22 @@ gtk_widget_translate_coordinates (GtkWidget *src_widget,
}
static void
-gtk_widget_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_widget_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkWidgetPrivate *priv = widget->priv;
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (_gtk_widget_get_realized (widget) &&
_gtk_widget_get_has_window (widget))
{
- gdk_window_move_resize (priv->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
+ GtkAllocation window_alloc;
+
+ gtk_widget_get_window_allocation (widget, &window_alloc);
+ gdk_window_move_resize (priv->window,
+ window_alloc.x, window_alloc.y,
+ window_alloc.width, window_alloc.height);
}
}
@@ -13127,70 +13146,63 @@ gtk_widget_set_clip (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GtkBorder shadow;
- GtkAllocation allocation;
- GtkBorder margin, border, padding;
+ GtkBorder margin;
GtkCssStyle *style;
GdkRectangle new_clip;
+ GtkAllocation allocation;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (_gtk_widget_get_visible (widget) || _gtk_widget_is_toplevel (widget));
g_return_if_fail (clip != NULL);
+ style = gtk_css_node_get_style (priv->cssnode);
+ get_box_margin (style, &margin);
+ _gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
+
+ /* The given clip is in @widget's coordinates, but we need it to be in the parent's coordinates,
+ * just like priv->allocation is. So first we transform the clip, then union it with
+ * the allocation (minus css margins) and then we add the box shadow size. */
+ new_clip = *clip;
+ new_clip.x += priv->allocation.x + margin.left;
+ new_clip.y += priv->allocation.y + margin.top;
+
+ allocation = priv->allocation;
+ allocation.x += margin.left;
+ allocation.y += margin.top;
+ allocation.width -= margin.left + margin.right;
+ allocation.height -= margin.top + margin.bottom;
+
+ gdk_rectangle_union (&allocation, &new_clip, &priv->clip);
+ priv->clip.x -= shadow.left;
+ priv->clip.y -= shadow.top;
+ priv->clip.width += shadow.left + shadow.right;
+ priv->clip.height += shadow.top + shadow.bottom;
+
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (GEOMETRY))
{
gint depth;
GtkWidget *parent;
const gchar *name;
+ const char *cssname;
depth = 0;
parent = widget;
while (parent)
- {
- depth++;
- parent = _gtk_widget_get_parent (parent);
- }
+ {
+ depth++;
+ parent = _gtk_widget_get_parent (parent);
+ }
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
- g_message ("gtk_widget_set_clip: %*s%s %d %d %d %d",
- 2 * depth, " ", name,
- clip->x, clip->y,
- clip->width, clip->height);
+ cssname = gtk_css_node_get_name (priv->cssnode);
+ g_message ("gtk_widget_set_clip: %s %s %d %d %d %d",
+ name,
+ cssname,
+ priv->clip.x, priv->clip.y,
+ priv->clip.width, priv->clip.height);
}
#endif /* G_ENABLE_DEBUG */
-
-
- /* The given clip is relative to the widget's origin, but we union
- * it with priv->allocation, which is the orgin minus CSS padding, border and margin.
- * Additionally, the box shadow is drawn around the widget's border box */
-
- style = gtk_css_node_get_style (priv->cssnode);
- allocation = priv->allocation;
- get_box_margin (style, &margin);
- get_box_margin (style, &border);
- get_box_margin (style, &padding);
- _gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
-
- /* Get border box from allocation */
- allocation.x += margin.left;
- allocation.y += margin.top;
- allocation.width -= margin.left + margin.right;
- allocation.height -= margin.top + margin.bottom;
-
- /* Add box shadow size to border box */
- allocation.x -= shadow.left;
- allocation.y -= shadow.top;
- allocation.width += shadow.left + shadow.right;
- allocation.height += shadow.top + shadow.bottom;
-
- /* Transform clip into coordinate space of priv->allocation */
- new_clip = *clip;
- new_clip.x += priv->allocation.x + border.left + padding.left;
- new_clip.y += priv->allocation.y + border.top + padding.top;
- new_clip.width -= margin.left + margin.right;
- new_clip.height -= margin.top + margin.bottom;
-
- gdk_rectangle_union (&allocation, &new_clip, &priv->clip);
}
/**
@@ -13202,7 +13214,7 @@ gtk_widget_set_clip (GtkWidget *widget,
* Retrieves the widget’s allocated size.
*
* This function returns the last values passed to
- * gtk_widget_size_allocate_with_baseline(). The value differs from
+ * gtk_widget_size_allocate(). The value differs from
* the size returned in gtk_widget_get_allocation() in that functions
* like gtk_widget_set_halign() can adjust the allocation, but not
* the value returned by this function.
@@ -13887,10 +13899,11 @@ gtk_widget_ensure_allocate (GtkWidget *widget)
if (priv->alloc_needed)
{
GtkAllocation allocation;
+ GtkAllocation clip;
int baseline;
gtk_widget_get_allocated_size (widget, &allocation, &baseline);
- gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline);
+ gtk_widget_size_allocate (widget, &allocation, baseline, &clip);
}
else if (priv->alloc_needed_on_child)
{
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 536a19c..c677aa5 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -302,8 +302,10 @@ struct _GtkWidgetClass
void (* unmap) (GtkWidget *widget);
void (* realize) (GtkWidget *widget);
void (* unrealize) (GtkWidget *widget);
- void (* size_allocate) (GtkWidget *widget,
- GtkAllocation *allocation);
+ void (* size_allocate) (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
void (* state_flags_changed) (GtkWidget *widget,
GtkStateFlags previous_state_flags);
void (* parent_set) (GtkWidget *widget,
@@ -542,12 +544,10 @@ GDK_AVAILABLE_IN_3_8
GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
-void gtk_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-GDK_AVAILABLE_IN_3_10
-void gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
- GtkAllocation *allocation,
- gint baseline);
+void gtk_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
GDK_AVAILABLE_IN_ALL
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 30b045a..86b020f 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -94,8 +94,6 @@ struct _GtkWidgetPrivate
guint halign : 4;
guint valign : 4;
- guint clip_set : 1;
-
guint8 alpha;
guint8 user_alpha;
@@ -139,6 +137,7 @@ struct _GtkWidgetPrivate
gint allocated_size_baseline;
GtkAllocation allocation;
GtkAllocation clip;
+ GtkAllocation reported_clip;
gint allocated_baseline;
/* The widget's requested sizes */
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index e804609..32ba2e6 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -406,8 +406,10 @@ static void gtk_window_map (GtkWidget *widget);
static void gtk_window_unmap (GtkWidget *widget);
static void gtk_window_realize (GtkWidget *widget);
static void gtk_window_unrealize (GtkWidget *widget);
-static void gtk_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gboolean gtk_window_map_event (GtkWidget *widget,
GdkEventAny *event);
static gint gtk_window_configure_event (GtkWidget *widget,
@@ -6703,6 +6705,7 @@ gtk_window_realize (GtkWidget *widget)
allocation.height == 1)
{
GdkRectangle request;
+ GdkRectangle clip;
gtk_window_compute_configure_request (window, &request, NULL, NULL);
@@ -6710,7 +6713,7 @@ gtk_window_realize (GtkWidget *widget)
allocation.y = 0;
allocation.width = request.width;
allocation.height = request.height;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
gtk_widget_queue_resize (widget);
@@ -6926,12 +6929,13 @@ popover_size_allocate (GtkWidget *widget,
GtkWindow *window)
{
cairo_rectangle_int_t rect;
+ GtkAllocation clip;
if (GTK_IS_POPOVER (popover->widget))
gtk_popover_update_position (GTK_POPOVER (popover->widget));
popover_get_rect (popover, window, &rect);
- gtk_widget_size_allocate (widget, &rect);
+ gtk_widget_size_allocate (widget, &rect, -1, &clip);
}
/* _gtk_window_set_allocation:
@@ -6998,6 +7002,7 @@ _gtk_window_set_allocation (GtkWindow *window,
!priv->fullscreen)
{
GtkAllocation title_allocation;
+ GtkAllocation title_clip;
title_allocation.x = window_border.left;
title_allocation.y = window_border.top;
@@ -7012,7 +7017,7 @@ _gtk_window_set_allocation (GtkWindow *window,
title_allocation.height = priv->title_height;
- gtk_widget_size_allocate (priv->title_box, &title_allocation);
+ gtk_widget_size_allocate (priv->title_box, &title_allocation, -1, &title_clip);
}
if (priv->decorated &&
@@ -7045,8 +7050,10 @@ _gtk_window_set_allocation (GtkWindow *window,
}
static void
-gtk_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWidget *child;
@@ -7056,9 +7063,7 @@ gtk_window_size_allocate (GtkWidget *widget,
child = gtk_bin_get_child (GTK_BIN (window));
if (child && gtk_widget_get_visible (child))
- gtk_widget_size_allocate (child, &child_allocation);
-
- gtk_widget_set_clip (widget, allocation);
+ gtk_widget_size_allocate (child, &child_allocation, -1, out_clip);
}
static gint
@@ -8686,6 +8691,7 @@ gtk_window_move_resize (GtkWindow *window)
if (priv->configure_notify_received)
{
GtkAllocation allocation;
+ GtkAllocation clip;
int min;
/* If we have received a configure event since
@@ -8703,7 +8709,6 @@ gtk_window_move_resize (GtkWindow *window)
allocation.x = 0;
allocation.y = 0;
- /*allocation.width = current_width;*/
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, -1,
&min, NULL, NULL, NULL);
@@ -8712,7 +8717,7 @@ gtk_window_move_resize (GtkWindow *window)
&min, NULL, NULL, NULL);
allocation.height = MAX (min, current_height);
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
/* If the configure request changed, it means that
* we either:
@@ -8787,7 +8792,8 @@ gtk_window_move_resize (GtkWindow *window)
if (priv->type == GTK_WINDOW_POPUP)
{
- GtkAllocation allocation;
+ GtkAllocation allocation;
+ GtkAllocation clip;
/* Directly size allocate for override redirect (popup) windows. */
allocation.x = 0;
@@ -8795,7 +8801,7 @@ gtk_window_move_resize (GtkWindow *window)
allocation.width = new_request.width;
allocation.height = new_request.height;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
}
else
{
@@ -8823,7 +8829,7 @@ gtk_window_move_resize (GtkWindow *window)
}
else
{
- GtkAllocation allocation;
+ GtkAllocation allocation, clip;
/* Handle any position changes.
*/
@@ -8841,7 +8847,7 @@ gtk_window_move_resize (GtkWindow *window)
allocation.width = current_width;
allocation.height = current_height;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
}
/* We have now processed a move/resize since the last position
diff --git a/gtk/inspector/gtkstackcombo.c b/gtk/inspector/gtkstackcombo.c
index c0d5798..7bbaa1b 100644
--- a/gtk/inspector/gtkstackcombo.c
+++ b/gtk/inspector/gtkstackcombo.c
@@ -249,16 +249,13 @@ gtk_stack_combo_snapshot (GtkWidget *widget,
}
static void
-gtk_stack_combo_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_stack_combo_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkStackCombo *self = GTK_STACK_COMBO (widget);
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (GTK_WIDGET (self->combo), allocation);
- gtk_widget_get_clip (GTK_WIDGET (self->combo), &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (GTK_WIDGET (self->combo), allocation, baseline, out_clip);
}
static void
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index a26f57b..2c36418 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -135,7 +135,11 @@ state_flags_changed (GtkWidget *w, GtkStateFlags old_flags, GtkInspectorMiscInfo
}
static void
-allocation_changed (GtkWidget *w, GdkRectangle *allocation, GtkInspectorMiscInfo *sl)
+allocation_changed (GtkWidget *w,
+ GdkRectangle *allocation,
+ int baseline,
+ GdkRectangle *out_clip,
+ GtkInspectorMiscInfo *sl)
{
GtkAllocation alloc;
GtkAllocation clip;
@@ -467,7 +471,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
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), NULL, sl);
+ allocation_changed (GTK_WIDGET (sl->priv->object), NULL, -1, NULL, sl);
}
else
{
diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c
index 780f652..97e3074 100644
--- a/tests/testwidgetfocus.c
+++ b/tests/testwidgetfocus.c
@@ -84,7 +84,10 @@ GType gtk_focus_widget_get_type (void) G_GNUC_CONST;
G_DEFINE_TYPE(GtkFocusWidget, gtk_focus_widget, GTK_TYPE_WIDGET)
static void
-gtk_focus_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+gtk_focus_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFocusWidget *self = GTK_FOCUS_WIDGET (widget);
int child_width = (allocation->width) / 2;
@@ -96,19 +99,19 @@ gtk_focus_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
child_alloc.width = child_width;
child_alloc.height = child_height;
- gtk_widget_size_allocate (self->child1, &child_alloc);
+ gtk_widget_size_allocate (self->child1, &child_alloc, -1, out_clip);
child_alloc.x += child_width;
- gtk_widget_size_allocate (self->child2, &child_alloc);
+ gtk_widget_size_allocate (self->child2, &child_alloc, -1, out_clip);
child_alloc.y += child_height;
- gtk_widget_size_allocate (self->child4, &child_alloc);
+ gtk_widget_size_allocate (self->child4, &child_alloc, -1, out_clip);
child_alloc.x -= child_width;
- gtk_widget_size_allocate (self->child3, &child_alloc);
+ gtk_widget_size_allocate (self->child3, &child_alloc, -1, out_clip);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]