Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ebef7b6289 | |||
| 4f02b973ba | |||
| bfa67371ec | |||
| 523ab41db3 | |||
| 308b25b3b2 | |||
| 855b2ddc76 | |||
| d96ea469b0 | |||
| d6720d1608 | |||
| c8d12878cb | |||
| 621621b5ba | |||
| 9bb2ba239a | |||
| 5730d1d3ef | |||
| 96da9aae5e | |||
| abc59007fa | |||
| 419dee2982 | |||
| 2f002bbfec | |||
| e311d3e8af | |||
| f36e6f6945 | |||
| fad4e8fe6e | |||
| 4462057ebd | |||
| d59120e44f | |||
| b0bf689e3b | |||
| 3cf21c424c | |||
| eec20d2f19 | |||
| 8a1a4ddd3d | |||
| c0633b2d14 | |||
| 3704971b7d | |||
| 919c775d89 | |||
| 522fab000f | |||
| fff08c0c83 | |||
| 928b51c936 | |||
| 329e854a81 | |||
| 087ba3043a |
@@ -455,13 +455,16 @@ demo_application_window_constructed (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
demo_application_window_size_allocate (GtkWidget *widget,
|
demo_application_window_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
|
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,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
baseline);
|
baseline);
|
||||||
|
|
||||||
if (!window->maximized && !window->fullscreen)
|
if (!window->maximized && !window->fullscreen)
|
||||||
|
|||||||
@@ -128,9 +128,10 @@ gtk_fishbowl_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_fishbowl_size_allocate (GtkWidget *widget,
|
gtk_fishbowl_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
|
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
|
||||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||||
@@ -147,8 +148,8 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
|
gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
|
||||||
child_allocation.x = allocation->x + round (child->x * (allocation->width - child_requisition.width));
|
child_allocation.x = round (child->x * (width - child_requisition.width));
|
||||||
child_allocation.y = allocation->y + round (child->y * (allocation->height - child_requisition.height));
|
child_allocation.y = round (child->y * (height - child_requisition.height));
|
||||||
child_allocation.width = child_requisition.width;
|
child_allocation.width = child_requisition.width;
|
||||||
child_allocation.height = child_requisition.height;
|
child_allocation.height = child_requisition.height;
|
||||||
|
|
||||||
|
|||||||
@@ -84,15 +84,16 @@ drawing_area_ensure_surface (DrawingArea *area,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawing_area_size_allocate (GtkWidget *widget,
|
drawing_area_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
DrawingArea *area = (DrawingArea *) widget;
|
DrawingArea *area = (DrawingArea *) widget;
|
||||||
|
|
||||||
drawing_area_ensure_surface (area, allocation->width, allocation->height);
|
drawing_area_ensure_surface (area, width, height);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, allocation, baseline);
|
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, width, height, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -55,10 +55,11 @@ create_complex_popover (GtkWidget *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
entry_size_allocate_cb (GtkEntry *entry,
|
entry_size_allocate_cb (GtkEntry *entry,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline,
|
int height,
|
||||||
gpointer user_data)
|
int baseline,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkEntryIconPosition popover_pos;
|
GtkEntryIconPosition popover_pos;
|
||||||
GtkPopover *popover = user_data;
|
GtkPopover *popover = user_data;
|
||||||
|
|||||||
@@ -4414,6 +4414,7 @@ GtkTickCallback
|
|||||||
gtk_widget_add_tick_callback
|
gtk_widget_add_tick_callback
|
||||||
gtk_widget_remove_tick_callback
|
gtk_widget_remove_tick_callback
|
||||||
gtk_widget_size_allocate
|
gtk_widget_size_allocate
|
||||||
|
gtk_widget_size_allocate_transformed
|
||||||
gtk_widget_add_accelerator
|
gtk_widget_add_accelerator
|
||||||
gtk_widget_remove_accelerator
|
gtk_widget_remove_accelerator
|
||||||
gtk_widget_set_accel_path
|
gtk_widget_set_accel_path
|
||||||
@@ -4421,7 +4422,6 @@ gtk_widget_list_accel_closures
|
|||||||
gtk_widget_can_activate_accel
|
gtk_widget_can_activate_accel
|
||||||
gtk_widget_event
|
gtk_widget_event
|
||||||
gtk_widget_activate
|
gtk_widget_activate
|
||||||
gtk_widget_intersect
|
|
||||||
gtk_widget_is_focus
|
gtk_widget_is_focus
|
||||||
gtk_widget_grab_focus
|
gtk_widget_grab_focus
|
||||||
gtk_widget_grab_default
|
gtk_widget_grab_default
|
||||||
@@ -4587,7 +4587,6 @@ gtk_widget_get_vexpand
|
|||||||
gtk_widget_set_vexpand
|
gtk_widget_set_vexpand
|
||||||
gtk_widget_get_vexpand_set
|
gtk_widget_get_vexpand_set
|
||||||
gtk_widget_set_vexpand_set
|
gtk_widget_set_vexpand_set
|
||||||
gtk_widget_queue_compute_expand
|
|
||||||
gtk_widget_compute_expand
|
gtk_widget_compute_expand
|
||||||
|
|
||||||
<SUBSECTION Templates>
|
<SUBSECTION Templates>
|
||||||
|
|||||||
+5
-4
@@ -19,7 +19,8 @@ clear_surface (void)
|
|||||||
/* Create a new surface of the appropriate size to store our scribbles */
|
/* Create a new surface of the appropriate size to store our scribbles */
|
||||||
static void
|
static void
|
||||||
size_allocate_cb (GtkWidget *widget,
|
size_allocate_cb (GtkWidget *widget,
|
||||||
GtkAllocation *alloc,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline,
|
int baseline,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
@@ -32,9 +33,9 @@ size_allocate_cb (GtkWidget *widget,
|
|||||||
if (gtk_widget_get_surface (widget))
|
if (gtk_widget_get_surface (widget))
|
||||||
{
|
{
|
||||||
surface = gdk_surface_create_similar_surface (gtk_widget_get_surface (widget),
|
surface = gdk_surface_create_similar_surface (gtk_widget_get_surface (widget),
|
||||||
CAIRO_CONTENT_COLOR,
|
CAIRO_CONTENT_COLOR,
|
||||||
gtk_widget_get_width (widget),
|
width,
|
||||||
gtk_widget_get_height (widget));
|
height);
|
||||||
|
|
||||||
/* Initialize the surface to white */
|
/* Initialize the surface to white */
|
||||||
clear_surface ();
|
clear_surface ();
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GTK_TYPE_CONT
|
|||||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_paned_accessible_size_allocate_gtk (GtkWidget *widget,
|
gtk_paned_accessible_size_allocate_gtk (GtkWidget *widget)
|
||||||
GtkAllocation *allocation)
|
|
||||||
{
|
{
|
||||||
AtkObject *obj = gtk_widget_get_accessible (widget);
|
AtkObject *obj = gtk_widget_get_accessible (widget);
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,7 @@ notify_cb (GObject *obj,
|
|||||||
|
|
||||||
/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */
|
/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */
|
||||||
static void
|
static void
|
||||||
size_allocate_cb (GtkWidget *widget,
|
size_allocate_cb (GtkWidget *widget)
|
||||||
GtkAllocation *allocation)
|
|
||||||
{
|
{
|
||||||
AtkObject* accessible;
|
AtkObject* accessible;
|
||||||
AtkRectangle rect;
|
AtkRectangle rect;
|
||||||
@@ -68,10 +67,14 @@ size_allocate_cb (GtkWidget *widget,
|
|||||||
accessible = gtk_widget_get_accessible (widget);
|
accessible = gtk_widget_get_accessible (widget);
|
||||||
if (ATK_IS_COMPONENT (accessible))
|
if (ATK_IS_COMPONENT (accessible))
|
||||||
{
|
{
|
||||||
rect.x = allocation->x;
|
GtkAllocation alloc;
|
||||||
rect.y = allocation->y;
|
gtk_widget_get_allocation (widget, &alloc);
|
||||||
rect.width = allocation->width;
|
|
||||||
rect.height = allocation->height;
|
rect.x = alloc.x;
|
||||||
|
rect.y = alloc.y;
|
||||||
|
rect.width = alloc.width;
|
||||||
|
rect.height = alloc.height;
|
||||||
|
|
||||||
g_signal_emit_by_name (accessible, "bounds-changed", &rect);
|
g_signal_emit_by_name (accessible, "bounds-changed", &rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-4
@@ -160,14 +160,19 @@ static void gtk_accel_label_measure (GtkWidget *widget,
|
|||||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET)
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_accel_label_size_allocate (GtkWidget *widget,
|
gtk_accel_label_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkAccelLabel *al = GTK_ACCEL_LABEL (widget);
|
GtkAccelLabel *al = GTK_ACCEL_LABEL (widget);
|
||||||
GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (al);
|
GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (al);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->box, allocation, baseline);
|
gtk_widget_size_allocate (priv->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
},baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+10
-4
@@ -259,13 +259,19 @@ gtk_action_bar_set_child_property (GtkContainer *container,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_action_bar_size_allocate (GtkWidget *widget,
|
gtk_action_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
|
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->revealer, allocation, baseline);
|
gtk_widget_size_allocate (priv->revealer,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
},
|
||||||
|
baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -934,16 +934,21 @@ gtk_app_chooser_widget_snapshot (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
|
gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline)
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (widget);
|
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (widget);
|
||||||
GtkAppChooserWidgetPrivate *priv = gtk_app_chooser_widget_get_instance_private (self);
|
GtkAppChooserWidgetPrivate *priv = gtk_app_chooser_widget_get_instance_private (self);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation, baseline);
|
GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, width, height, baseline);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->overlay, allocation, baseline);
|
gtk_widget_size_allocate (priv->overlay,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
},baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -592,7 +592,8 @@ gtk_application_window_measure (GtkWidget *widget,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_application_window_real_size_allocate (GtkWidget *widget,
|
gtk_application_window_real_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline)
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
|
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
|
||||||
@@ -604,7 +605,7 @@ gtk_application_window_real_size_allocate (GtkWidget *widget,
|
|||||||
gint menubar_height;
|
gint menubar_height;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
_gtk_window_set_allocation (GTK_WINDOW (widget), allocation, &child_allocation);
|
_gtk_window_set_allocation (GTK_WINDOW (widget), width, height, &child_allocation);
|
||||||
menubar_allocation = child_allocation;
|
menubar_allocation = child_allocation;
|
||||||
|
|
||||||
gtk_widget_measure (window->priv->menubar, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (window->priv->menubar, GTK_ORIENTATION_VERTICAL,
|
||||||
@@ -622,7 +623,8 @@ gtk_application_window_real_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->size_allocate (widget,
|
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->size_allocate (widget,
|
||||||
allocation,
|
width,
|
||||||
|
height,
|
||||||
baseline);
|
baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+41
-42
@@ -97,9 +97,10 @@ static void gtk_button_box_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_button_box_size_allocate (GtkWidget *widget,
|
static void gtk_button_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_button_box_remove (GtkContainer *container,
|
static void gtk_button_box_remove (GtkContainer *container,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
static void gtk_button_box_set_child_property (GtkContainer *container,
|
static void gtk_button_box_set_child_property (GtkContainer *container,
|
||||||
@@ -742,9 +743,10 @@ gtk_button_box_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_button_box_size_allocate (GtkWidget *widget,
|
gtk_button_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkButtonBox *bbox = GTK_BUTTON_BOX (widget);
|
GtkButtonBox *bbox = GTK_BUTTON_BOX (widget);
|
||||||
GtkButtonBoxPrivate *priv = bbox->priv;
|
GtkButtonBoxPrivate *priv = bbox->priv;
|
||||||
@@ -757,8 +759,6 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
gint y = 0;
|
gint y = 0;
|
||||||
gint secondary_x = 0;
|
gint secondary_x = 0;
|
||||||
gint secondary_y = 0;
|
gint secondary_y = 0;
|
||||||
gint width = 0;
|
|
||||||
gint height = 0;
|
|
||||||
gint childspacing = 0;
|
gint childspacing = 0;
|
||||||
gint spacing;
|
gint spacing;
|
||||||
GtkOrientation orientation;
|
GtkOrientation orientation;
|
||||||
@@ -776,7 +776,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
|
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget,
|
GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget,
|
||||||
allocation,
|
width, height,
|
||||||
baseline);
|
baseline);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -799,10 +799,10 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
/* keep baseline as is */
|
/* keep baseline as is */
|
||||||
break;
|
break;
|
||||||
case GTK_BASELINE_POSITION_CENTER:
|
case GTK_BASELINE_POSITION_CENTER:
|
||||||
baseline = baseline + (allocation->height - baseline_height) / 2;
|
baseline = baseline + (height - baseline_height) / 2;
|
||||||
break;
|
break;
|
||||||
case GTK_BASELINE_POSITION_BOTTOM:
|
case GTK_BASELINE_POSITION_BOTTOM:
|
||||||
baseline = allocation->height - (baseline_height - baseline);
|
baseline = height - (baseline_height - baseline);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -836,9 +836,9 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
total_size = primary_size + secondary_size;
|
total_size = primary_size + secondary_size;
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
width = allocation->width;
|
width = width;
|
||||||
else
|
else
|
||||||
height = allocation->height;
|
height = height;
|
||||||
|
|
||||||
switch (priv->layout_style)
|
switch (priv->layout_style)
|
||||||
{
|
{
|
||||||
@@ -847,13 +847,13 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
childspacing = (width - total_size) / (nvis_children + 1);
|
childspacing = (width - total_size) / (nvis_children + 1);
|
||||||
x = allocation->x + childspacing;
|
x = childspacing;
|
||||||
secondary_x = x + primary_size + n_primaries * childspacing;
|
secondary_x = x + primary_size + n_primaries * childspacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
childspacing = (height - total_size) / (nvis_children + 1);
|
childspacing = (height - total_size) / (nvis_children + 1);
|
||||||
y = allocation->y + childspacing;
|
y = childspacing;
|
||||||
secondary_y = y + primary_size + n_primaries * childspacing;
|
secondary_y = y + primary_size + n_primaries * childspacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -866,21 +866,20 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
if (nvis_children >= 2)
|
if (nvis_children >= 2)
|
||||||
{
|
{
|
||||||
childspacing = (width - total_size) / (nvis_children - 1);
|
childspacing = (width - total_size) / (nvis_children - 1);
|
||||||
x = allocation->x;
|
x = 0;
|
||||||
secondary_x = x + primary_size + n_primaries * childspacing;
|
secondary_x = x + primary_size + n_primaries * childspacing;
|
||||||
}
|
}
|
||||||
else if (nvis_children == 1)
|
else if (nvis_children == 1)
|
||||||
{
|
{
|
||||||
/* one child, just center */
|
/* one child, just center */
|
||||||
childspacing = width;
|
childspacing = width;
|
||||||
x = secondary_x = allocation->x
|
x = secondary_x = (width - widths[0]) / 2;
|
||||||
+ (allocation->width - widths[0]) / 2;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* zero children, meh */
|
/* zero children, meh */
|
||||||
childspacing = width;
|
childspacing = width;
|
||||||
x = secondary_x = allocation->x + allocation->width / 2;
|
x = secondary_x = width / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -888,21 +887,21 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
if (nvis_children >= 2)
|
if (nvis_children >= 2)
|
||||||
{
|
{
|
||||||
childspacing = (height - total_size) / (nvis_children - 1);
|
childspacing = (height - total_size) / (nvis_children - 1);
|
||||||
y = allocation->y;
|
y = 0;
|
||||||
secondary_y = y + primary_size + n_primaries * childspacing;
|
secondary_y = y + primary_size + n_primaries * childspacing;
|
||||||
}
|
}
|
||||||
else if (nvis_children == 1)
|
else if (nvis_children == 1)
|
||||||
{
|
{
|
||||||
/* one child, just center */
|
/* one child, just center */
|
||||||
childspacing = height;
|
childspacing = height;
|
||||||
y = secondary_y = allocation->y
|
y = secondary_y = 0
|
||||||
+ (allocation->height - heights[0]) / 2;
|
+ (height - heights[0]) / 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* zero children, meh */
|
/* zero children, meh */
|
||||||
childspacing = height;
|
childspacing = height;
|
||||||
y = secondary_y = allocation->y + allocation->height / 2;
|
y = secondary_y = 0 + height / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,15 +912,15 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
childspacing = spacing;
|
childspacing = spacing;
|
||||||
x = allocation->x;
|
x = 0;
|
||||||
secondary_x = allocation->x + allocation->width
|
secondary_x = 0 + width
|
||||||
- secondary_size - spacing * (n_secondaries - 1);
|
- secondary_size - spacing * (n_secondaries - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
childspacing = spacing;
|
childspacing = spacing;
|
||||||
y = allocation->y;
|
y = 0;
|
||||||
secondary_y = allocation->y + allocation->height
|
secondary_y = 0 + height
|
||||||
- secondary_size - spacing * (n_secondaries - 1);
|
- secondary_size - spacing * (n_secondaries - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,16 +931,16 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
childspacing = spacing;
|
childspacing = spacing;
|
||||||
x = allocation->x + allocation->width
|
x = 0 + width
|
||||||
- primary_size - spacing * (n_primaries - 1);
|
- primary_size - spacing * (n_primaries - 1);
|
||||||
secondary_x = allocation->x;
|
secondary_x = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
childspacing = spacing;
|
childspacing = spacing;
|
||||||
y = allocation->y + allocation->height
|
y = 0 + height
|
||||||
- primary_size - spacing * (n_primaries - 1);
|
- primary_size - spacing * (n_primaries - 1);
|
||||||
secondary_y = allocation->y;
|
secondary_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -951,20 +950,20 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
childspacing = spacing;
|
childspacing = spacing;
|
||||||
x = allocation->x +
|
x = 0 +
|
||||||
(allocation->width
|
(width
|
||||||
- (primary_size + spacing * (n_primaries - 1))) / 2
|
- (primary_size + spacing * (n_primaries - 1))) / 2
|
||||||
+ (secondary_size + n_secondaries * spacing) / 2;
|
+ (secondary_size + n_secondaries * spacing) / 2;
|
||||||
secondary_x = allocation->x;
|
secondary_x = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
childspacing = spacing;
|
childspacing = spacing;
|
||||||
y = allocation->y +
|
y = 0 +
|
||||||
(allocation->height
|
(height
|
||||||
- (primary_size + spacing * (n_primaries - 1))) / 2
|
- (primary_size + spacing * (n_primaries - 1))) / 2
|
||||||
+ (secondary_size + n_secondaries * spacing) / 2;
|
+ (secondary_size + n_secondaries * spacing) / 2;
|
||||||
secondary_y = allocation->y;
|
secondary_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -994,11 +993,11 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
if (baselines[i] != -1)
|
if (baselines[i] != -1)
|
||||||
{
|
{
|
||||||
child_allocation.y = allocation->y + baseline - baselines[i];
|
child_allocation.y = 0 + baseline - baselines[i];
|
||||||
child_baseline = baselines[i];
|
child_baseline = baselines[i];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
child_allocation.y = allocation->y + (allocation->height - child_allocation.height) / 2;
|
child_allocation.y = 0 + (height - child_allocation.height) / 2;
|
||||||
|
|
||||||
if (gtk_button_box_get_child_secondary (bbox, child))
|
if (gtk_button_box_get_child_secondary (bbox, child))
|
||||||
{
|
{
|
||||||
@@ -1012,12 +1011,12 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||||
child_allocation.x = (allocation->x + allocation->width)
|
child_allocation.x = (0 + width)
|
||||||
- (child_allocation.x + child_allocation.width - allocation->x);
|
- (child_allocation.x + child_allocation.width - 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child_allocation.x = allocation->x + (allocation->width - child_allocation.width) / 2;
|
child_allocation.x = 0 + (width - child_allocation.width) / 2;
|
||||||
|
|
||||||
if (gtk_button_box_get_child_secondary (bbox, child))
|
if (gtk_button_box_get_child_secondary (bbox, child))
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-4
@@ -64,15 +64,20 @@ static void gtk_bin_measure (GtkWidget
|
|||||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_bin_size_allocate (GtkWidget *widget,
|
gtk_bin_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkBin *bin = GTK_BIN (widget);
|
GtkBin *bin = GTK_BIN (widget);
|
||||||
GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
|
GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
|
||||||
|
|
||||||
if (priv->child && gtk_widget_get_visible (priv->child))
|
if (priv->child && gtk_widget_get_visible (priv->child))
|
||||||
gtk_widget_size_allocate (priv->child, allocation, baseline);
|
gtk_widget_size_allocate (priv->child,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+16
-17
@@ -137,9 +137,10 @@ struct _GtkBoxChild
|
|||||||
guint pack : 1;
|
guint pack : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gtk_box_size_allocate (GtkWidget *widget,
|
static void gtk_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
|
|
||||||
static void gtk_box_set_property (GObject *object,
|
static void gtk_box_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@@ -360,9 +361,10 @@ get_spacing (GtkBox *box)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_box_size_allocate (GtkWidget *widget,
|
gtk_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (widget);
|
GtkBox *box = GTK_BOX (widget);
|
||||||
GtkBoxPrivate *priv = gtk_box_get_instance_private (box);
|
GtkBoxPrivate *priv = gtk_box_get_instance_private (box);
|
||||||
@@ -401,9 +403,9 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
spacing = get_spacing (box);
|
spacing = get_spacing (box);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
extra_space = allocation->width - (nvis_children - 1) * spacing;
|
extra_space = width - (nvis_children - 1) * spacing;
|
||||||
else
|
else
|
||||||
extra_space = allocation->height - (nvis_children - 1) * spacing;
|
extra_space = height - (nvis_children - 1) * spacing;
|
||||||
|
|
||||||
have_baseline = FALSE;
|
have_baseline = FALSE;
|
||||||
minimum_above = natural_above = 0;
|
minimum_above = natural_above = 0;
|
||||||
@@ -419,8 +421,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_measure (child->widget,
|
gtk_widget_measure (child->widget,
|
||||||
priv->orientation,
|
priv->orientation,
|
||||||
priv->orientation == GTK_ORIENTATION_HORIZONTAL ?
|
priv->orientation == GTK_ORIENTATION_HORIZONTAL ? height : width,
|
||||||
allocation->height : allocation->width,
|
|
||||||
&sizes[i].minimum_size, &sizes[i].natural_size,
|
&sizes[i].minimum_size, &sizes[i].natural_size,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
@@ -548,8 +549,6 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
* and any of the child widgets explicitly request one */
|
* and any of the child widgets explicitly request one */
|
||||||
if (baseline == -1 && have_baseline)
|
if (baseline == -1 && have_baseline)
|
||||||
{
|
{
|
||||||
gint height = allocation->height;
|
|
||||||
|
|
||||||
/* TODO: This is purely based on the minimum baseline, when things fit we should
|
/* TODO: This is purely based on the minimum baseline, when things fit we should
|
||||||
use the natural one? */
|
use the natural one? */
|
||||||
|
|
||||||
@@ -575,20 +574,20 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
child_allocation.y = 0;
|
child_allocation.y = 0;
|
||||||
child_allocation.height = allocation->height;
|
child_allocation.height = height;
|
||||||
if (packing == GTK_PACK_START)
|
if (packing == GTK_PACK_START)
|
||||||
x = 0;
|
x = 0;
|
||||||
else
|
else
|
||||||
x = allocation->width;
|
x = width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child_allocation.x = 0;
|
child_allocation.x = 0;
|
||||||
child_allocation.width = allocation->width;
|
child_allocation.width = width;
|
||||||
if (packing == GTK_PACK_START)
|
if (packing == GTK_PACK_START)
|
||||||
y = 0;
|
y = 0;
|
||||||
else
|
else
|
||||||
y = allocation->height;
|
y = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, children = priv->children;
|
for (i = 0, children = priv->children;
|
||||||
@@ -630,7 +629,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
child_allocation.x = allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
|
child_allocation.x = width - child_allocation.x - child_allocation.width;
|
||||||
|
|
||||||
}
|
}
|
||||||
else /* (priv->orientation == GTK_ORIENTATION_VERTICAL) */
|
else /* (priv->orientation == GTK_ORIENTATION_VERTICAL) */
|
||||||
|
|||||||
@@ -803,12 +803,6 @@ gtk_real_button_activate (GtkButton *button)
|
|||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (button);
|
GtkWidget *widget = GTK_WIDGET (button);
|
||||||
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
||||||
GdkDevice *device;
|
|
||||||
|
|
||||||
device = gtk_get_current_event_device ();
|
|
||||||
|
|
||||||
if (device && gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
|
||||||
device = gdk_device_get_associated_device (device);
|
|
||||||
|
|
||||||
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
|
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
|
||||||
{
|
{
|
||||||
|
|||||||
+11
-9
@@ -267,9 +267,10 @@ static void gtk_calendar_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_calendar_size_allocate (GtkWidget *widget,
|
static void gtk_calendar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_calendar_snapshot (GtkWidget *widget,
|
static void gtk_calendar_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_calendar_button_press (GtkGestureMultiPress *gesture,
|
static void gtk_calendar_button_press (GtkGestureMultiPress *gesture,
|
||||||
@@ -1846,9 +1847,10 @@ gtk_calendar_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_calendar_size_allocate (GtkWidget *widget,
|
gtk_calendar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
||||||
GtkCalendarPrivate *priv = calendar->priv;
|
GtkCalendarPrivate *priv = calendar->priv;
|
||||||
@@ -1858,16 +1860,16 @@ gtk_calendar_size_allocate (GtkWidget *widget,
|
|||||||
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
|
||||||
{
|
{
|
||||||
priv->day_width = (priv->min_day_width
|
priv->day_width = (priv->min_day_width
|
||||||
* ((allocation->width - (inner_border * 2)
|
* ((width - (inner_border * 2)
|
||||||
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2))
|
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2))
|
||||||
/ (7 * priv->min_day_width + priv->max_week_char_width * 2));
|
/ (7 * priv->min_day_width + priv->max_week_char_width * 2));
|
||||||
priv->week_width = ((allocation->width - (inner_border * 2)
|
priv->week_width = ((width - (inner_border * 2)
|
||||||
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2 )
|
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2 )
|
||||||
- priv->day_width * 7 + CALENDAR_MARGIN + calendar_xsep);
|
- priv->day_width * 7 + CALENDAR_MARGIN + calendar_xsep);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
priv->day_width = (allocation->width
|
priv->day_width = (width
|
||||||
- (inner_border * 2)
|
- (inner_border * 2)
|
||||||
- (CALENDAR_MARGIN * 2)
|
- (CALENDAR_MARGIN * 2)
|
||||||
- (DAY_XSEP * 6))/7;
|
- (DAY_XSEP * 6))/7;
|
||||||
|
|||||||
+11
-12
@@ -65,9 +65,10 @@ static void gtk_cell_view_set_property (GObject *obj
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_cell_view_finalize (GObject *object);
|
static void gtk_cell_view_finalize (GObject *object);
|
||||||
static void gtk_cell_view_dispose (GObject *object);
|
static void gtk_cell_view_dispose (GObject *object);
|
||||||
static void gtk_cell_view_size_allocate (GtkWidget *widget,
|
static void gtk_cell_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_cell_view_snapshot (GtkWidget *widget,
|
static void gtk_cell_view_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_cell_view_set_value (GtkCellView *cell_view,
|
static void gtk_cell_view_set_value (GtkCellView *cell_view,
|
||||||
@@ -470,20 +471,18 @@ gtk_cell_view_dispose (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_cell_view_size_allocate (GtkWidget *widget,
|
gtk_cell_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkCellView *cellview;
|
GtkCellView *cellview;
|
||||||
GtkCellViewPrivate *priv;
|
GtkCellViewPrivate *priv;
|
||||||
gint alloc_width, alloc_height, width, height;
|
gint alloc_width, alloc_height;
|
||||||
|
|
||||||
cellview = GTK_CELL_VIEW (widget);
|
cellview = GTK_CELL_VIEW (widget);
|
||||||
priv = cellview->priv;
|
priv = cellview->priv;
|
||||||
|
|
||||||
width = allocation->width;
|
|
||||||
height = allocation->height;
|
|
||||||
|
|
||||||
gtk_cell_area_context_get_allocation (priv->context, &alloc_width, &alloc_height);
|
gtk_cell_area_context_get_allocation (priv->context, &alloc_width, &alloc_height);
|
||||||
|
|
||||||
/* The first cell view in context is responsible for allocating the context at
|
/* The first cell view in context is responsible for allocating the context at
|
||||||
@@ -495,9 +494,9 @@ gtk_cell_view_size_allocate (GtkWidget *widget,
|
|||||||
*/
|
*/
|
||||||
if (priv->fit_model)
|
if (priv->fit_model)
|
||||||
gtk_cell_area_context_allocate (priv->context, width, height);
|
gtk_cell_area_context_allocate (priv->context, width, height);
|
||||||
else if (alloc_width != allocation->width && priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
else if (alloc_width != width && priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
gtk_cell_area_context_allocate (priv->context, width, -1);
|
gtk_cell_area_context_allocate (priv->context, width, -1);
|
||||||
else if (alloc_height != allocation->height && priv->orientation == GTK_ORIENTATION_VERTICAL)
|
else if (alloc_height != height && priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
gtk_cell_area_context_allocate (priv->context, -1, height);
|
gtk_cell_area_context_allocate (priv->context, -1, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-17
@@ -386,9 +386,10 @@ gtk_center_box_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_center_box_size_allocate (GtkWidget *widget,
|
gtk_center_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkCenterBox *self = GTK_CENTER_BOX (widget);
|
GtkCenterBox *self = GTK_CENTER_BOX (widget);
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
@@ -402,13 +403,13 @@ gtk_center_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
size = allocation->width;
|
size = width;
|
||||||
for_size = allocation->height;
|
for_size = height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = allocation->height;
|
size = height;
|
||||||
for_size = allocation->width;
|
for_size = width;
|
||||||
baseline = -1;
|
baseline = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,10 +486,10 @@ gtk_center_box_size_allocate (GtkWidget *widget,
|
|||||||
baseline = min_above;
|
baseline = min_above;
|
||||||
break;
|
break;
|
||||||
case GTK_BASELINE_POSITION_CENTER:
|
case GTK_BASELINE_POSITION_CENTER:
|
||||||
baseline = min_above + (allocation->height - (min_above + min_below)) / 2;
|
baseline = min_above + (height - (min_above + min_below)) / 2;
|
||||||
break;
|
break;
|
||||||
case GTK_BASELINE_POSITION_BOTTOM:
|
case GTK_BASELINE_POSITION_BOTTOM:
|
||||||
baseline = allocation->height - min_below;
|
baseline = height - min_below;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,7 +510,7 @@ gtk_center_box_size_allocate (GtkWidget *widget,
|
|||||||
child_pos[1] = size - child_size[1] - child_size[2];
|
child_pos[1] = size - child_size[1] - child_size[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
child_allocation = *allocation;
|
child_allocation = (GtkAllocation) { 0, 0, width, height };
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
@@ -518,20 +519,20 @@ gtk_center_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
child_allocation.x = allocation->x + child_pos[i];
|
child_allocation.x = child_pos[i];
|
||||||
child_allocation.y = allocation->y;
|
child_allocation.y = 0;
|
||||||
child_allocation.width = child_size[i];
|
child_allocation.width = child_size[i];
|
||||||
child_allocation.height = allocation->height;
|
child_allocation.height = height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child_allocation.x = allocation->x;
|
child_allocation.x = 0;
|
||||||
child_allocation.y = allocation->y + child_pos[i];
|
child_allocation.y = child_pos[i];
|
||||||
child_allocation.width = allocation->width;
|
child_allocation.width = width;
|
||||||
child_allocation.height = child_size[i];
|
child_allocation.height = child_size[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (child[i], &child_allocation, allocation->y + baseline);
|
gtk_widget_size_allocate (child[i], &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+48
-50
@@ -75,11 +75,6 @@
|
|||||||
* in this case.
|
* in this case.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static void gtk_check_button_size_allocate (GtkWidget *widget,
|
|
||||||
const GtkAllocation *allocation,
|
|
||||||
int baseline);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWidget *indicator_widget;
|
GtkWidget *indicator_widget;
|
||||||
|
|
||||||
@@ -213,6 +208,54 @@ gtk_check_button_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_check_button_size_allocate (GtkWidget *widget,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int baseline)
|
||||||
|
{
|
||||||
|
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
|
||||||
|
GtkAllocation child_alloc = { 0 };
|
||||||
|
GtkWidget *child;
|
||||||
|
gboolean is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
if (priv->draw_indicator)
|
||||||
|
{
|
||||||
|
child_alloc.y = 0;
|
||||||
|
child_alloc.height = height;
|
||||||
|
|
||||||
|
gtk_widget_measure (priv->indicator_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
||||||
|
&child_alloc.width, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
if (is_rtl)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
child_alloc.x = width - child_alloc.width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = child_alloc.width;
|
||||||
|
child_alloc.x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_size_allocate (priv->indicator_widget, &child_alloc, baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
|
if (child)
|
||||||
|
{
|
||||||
|
child_alloc.x = x;
|
||||||
|
child_alloc.y = 0;
|
||||||
|
child_alloc.width = width - child_alloc.width; /* Indicator width */
|
||||||
|
child_alloc.height = height;
|
||||||
|
|
||||||
|
gtk_widget_size_allocate (child, &child_alloc, baseline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_check_button_set_property (GObject *object,
|
gtk_check_button_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@@ -421,51 +464,6 @@ gtk_check_button_new_with_mnemonic (const gchar *label)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_check_button_size_allocate (GtkWidget *widget,
|
|
||||||
const GtkAllocation *allocation,
|
|
||||||
int baseline)
|
|
||||||
{
|
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
|
|
||||||
GtkAllocation child_alloc = { 0 };
|
|
||||||
GtkWidget *child;
|
|
||||||
gboolean is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
|
||||||
int x = 0;
|
|
||||||
|
|
||||||
if (priv->draw_indicator)
|
|
||||||
{
|
|
||||||
child_alloc.y = allocation->y;
|
|
||||||
child_alloc.height = allocation->height;
|
|
||||||
|
|
||||||
gtk_widget_measure (priv->indicator_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
||||||
&child_alloc.width, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
if (is_rtl)
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
child_alloc.x = allocation->x + allocation->width - child_alloc.width;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = child_alloc.width;
|
|
||||||
child_alloc.x = allocation->x;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->indicator_widget, &child_alloc, baseline);
|
|
||||||
}
|
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
||||||
if (child)
|
|
||||||
{
|
|
||||||
child_alloc.x = allocation->x + x;
|
|
||||||
child_alloc.y = allocation->y;
|
|
||||||
child_alloc.width = allocation->width - child_alloc.width; /* Indicator width */
|
|
||||||
child_alloc.height = allocation->height;
|
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_alloc, baseline);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkCssNode *
|
GtkCssNode *
|
||||||
gtk_check_button_get_indicator_node (GtkCheckButton *check_button)
|
gtk_check_button_get_indicator_node (GtkCheckButton *check_button)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,9 +104,10 @@ G_DEFINE_TYPE_WITH_CODE (GtkCheckMenuItem, gtk_check_menu_item, GTK_TYPE_MENU_IT
|
|||||||
G_ADD_PRIVATE (GtkCheckMenuItem))
|
G_ADD_PRIVATE (GtkCheckMenuItem))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_check_menu_item_size_allocate (GtkWidget *widget,
|
gtk_check_menu_item_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkAllocation indicator_alloc;
|
GtkAllocation indicator_alloc;
|
||||||
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
||||||
@@ -114,7 +115,8 @@ gtk_check_menu_item_size_allocate (GtkWidget *widget,
|
|||||||
gint toggle_size;
|
gint toggle_size;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
|
GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
|
||||||
allocation,
|
width,
|
||||||
|
height,
|
||||||
baseline);
|
baseline);
|
||||||
|
|
||||||
gtk_widget_measure (priv->indicator_widget,
|
gtk_widget_measure (priv->indicator_widget,
|
||||||
@@ -132,10 +134,10 @@ gtk_check_menu_item_size_allocate (GtkWidget *widget,
|
|||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||||
indicator_alloc.x = (toggle_size - indicator_alloc.width) / 2;
|
indicator_alloc.x = (toggle_size - indicator_alloc.width) / 2;
|
||||||
else
|
else
|
||||||
indicator_alloc.x = allocation->width - toggle_size +
|
indicator_alloc.x = width - toggle_size +
|
||||||
(toggle_size - indicator_alloc.width) / 2;
|
(toggle_size - indicator_alloc.width) / 2;
|
||||||
|
|
||||||
indicator_alloc.y = (allocation->height - indicator_alloc.height) / 2;
|
indicator_alloc.y = (height - indicator_alloc.height) / 2;
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->indicator_widget,
|
gtk_widget_size_allocate (priv->indicator_widget,
|
||||||
&indicator_alloc,
|
&indicator_alloc,
|
||||||
|
|||||||
+10
-4
@@ -163,14 +163,20 @@ gtk_color_button_snapshot (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_color_button_size_allocate (GtkWidget *widget,
|
gtk_color_button_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkColorButton *button = GTK_COLOR_BUTTON (widget);
|
GtkColorButton *button = GTK_COLOR_BUTTON (widget);
|
||||||
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->button, allocation, baseline);
|
gtk_widget_size_allocate (priv->button,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
},
|
||||||
|
baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+4
-3
@@ -169,9 +169,10 @@ create_texture (GtkColorPlane *plane)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plane_size_allocate (GtkWidget *widget,
|
plane_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
|
GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
|
||||||
|
|
||||||
|
|||||||
@@ -357,14 +357,19 @@ tap_action (GtkGestureMultiPress *gesture,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
swatch_size_allocate (GtkWidget *widget,
|
swatch_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||||
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
|
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->overlay_widget, allocation, -1);
|
gtk_widget_size_allocate (priv->overlay_widget,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -568,7 +573,6 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
|
|||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
|
|
||||||
priv = gtk_color_swatch_get_instance_private (swatch);
|
|
||||||
priv->use_alpha = TRUE;
|
priv->use_alpha = TRUE;
|
||||||
priv->selectable = TRUE;
|
priv->selectable = TRUE;
|
||||||
priv->has_menu = TRUE;
|
priv->has_menu = TRUE;
|
||||||
|
|||||||
+10
-5
@@ -361,14 +361,19 @@ gtk_combo_box_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_combo_box_size_allocate (GtkWidget *widget,
|
gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||||
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
|
GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->box, allocation, baseline);
|
gtk_widget_size_allocate (priv->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
|
|
||||||
if (gtk_widget_get_visible (priv->popup_widget))
|
if (gtk_widget_get_visible (priv->popup_widget))
|
||||||
{
|
{
|
||||||
@@ -386,7 +391,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
|||||||
NULL, &menu_width, NULL, NULL);
|
NULL, &menu_width, NULL, NULL);
|
||||||
|
|
||||||
gtk_widget_set_size_request (priv->popup_widget,
|
gtk_widget_set_size_request (priv->popup_widget,
|
||||||
MAX (allocation->width, menu_width), -1);
|
MAX (width, menu_width), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reposition the menu after giving it a new width */
|
/* reposition the menu after giving it a new width */
|
||||||
|
|||||||
+20
-18
@@ -410,9 +410,10 @@ static void gtk_entry_destroy (GtkWidget *widget);
|
|||||||
static void gtk_entry_realize (GtkWidget *widget);
|
static void gtk_entry_realize (GtkWidget *widget);
|
||||||
static void gtk_entry_unrealize (GtkWidget *widget);
|
static void gtk_entry_unrealize (GtkWidget *widget);
|
||||||
static void gtk_entry_unmap (GtkWidget *widget);
|
static void gtk_entry_unmap (GtkWidget *widget);
|
||||||
static void gtk_entry_size_allocate (GtkWidget *widget,
|
static void gtk_entry_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_entry_snapshot (GtkWidget *widget,
|
static void gtk_entry_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_entry_focus_in (GtkWidget *widget);
|
static void gtk_entry_focus_in (GtkWidget *widget);
|
||||||
@@ -3088,7 +3089,7 @@ gtk_entry_unmap (GtkWidget *widget)
|
|||||||
GTK_WIDGET_CLASS (gtk_entry_parent_class)->unmap (widget);
|
GTK_WIDGET_CLASS (gtk_entry_parent_class)->unmap (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_entry_get_text_allocation (GtkEntry *entry,
|
gtk_entry_get_text_allocation (GtkEntry *entry,
|
||||||
GdkRectangle *allocation)
|
GdkRectangle *allocation)
|
||||||
{
|
{
|
||||||
@@ -3253,9 +3254,10 @@ gtk_entry_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_entry_size_allocate (GtkWidget *widget,
|
gtk_entry_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||||
@@ -3263,13 +3265,13 @@ gtk_entry_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
priv->text_baseline = baseline;
|
priv->text_baseline = baseline;
|
||||||
priv->text_x = 0;
|
priv->text_x = 0;
|
||||||
priv->text_width = allocation->width;
|
priv->text_width = width;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
EntryIconInfo *icon_info = priv->icons[i];
|
EntryIconInfo *icon_info = priv->icons[i];
|
||||||
GtkAllocation icon_alloc;
|
GtkAllocation icon_alloc;
|
||||||
int width;
|
int icon_width;
|
||||||
|
|
||||||
if (!icon_info)
|
if (!icon_info)
|
||||||
continue;
|
continue;
|
||||||
@@ -3277,23 +3279,23 @@ gtk_entry_size_allocate (GtkWidget *widget,
|
|||||||
gtk_widget_measure (icon_info->widget,
|
gtk_widget_measure (icon_info->widget,
|
||||||
GTK_ORIENTATION_HORIZONTAL,
|
GTK_ORIENTATION_HORIZONTAL,
|
||||||
-1,
|
-1,
|
||||||
NULL, &width,
|
NULL, &icon_width,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && i == GTK_ENTRY_ICON_PRIMARY) ||
|
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && i == GTK_ENTRY_ICON_PRIMARY) ||
|
||||||
(gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && i == GTK_ENTRY_ICON_SECONDARY))
|
(gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && i == GTK_ENTRY_ICON_SECONDARY))
|
||||||
{
|
{
|
||||||
icon_alloc.x = allocation->x + priv->text_x + priv->text_width - width;
|
icon_alloc.x = priv->text_x + priv->text_width - icon_width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
icon_alloc.x = allocation->x + priv->text_x;
|
icon_alloc.x = priv->text_x;
|
||||||
priv->text_x += width;
|
priv->text_x += icon_width;
|
||||||
}
|
}
|
||||||
icon_alloc.y = 0;
|
icon_alloc.y = 0;
|
||||||
icon_alloc.width = width;
|
icon_alloc.width = icon_width;
|
||||||
icon_alloc.height = allocation->height;
|
icon_alloc.height = height;
|
||||||
priv->text_width -= width;
|
priv->text_width -= icon_width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (icon_info->widget, &icon_alloc, baseline);
|
gtk_widget_size_allocate (icon_info->widget, &icon_alloc, baseline);
|
||||||
}
|
}
|
||||||
@@ -3309,8 +3311,8 @@ gtk_entry_size_allocate (GtkWidget *widget,
|
|||||||
&min, &nat,
|
&min, &nat,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
progress_alloc.x = 0;
|
progress_alloc.x = 0;
|
||||||
progress_alloc.y = allocation->height - nat;
|
progress_alloc.y = height - nat;
|
||||||
progress_alloc.width = allocation->width;
|
progress_alloc.width = width;
|
||||||
progress_alloc.height = nat;
|
progress_alloc.height = nat;
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->progress_widget, &progress_alloc, -1);
|
gtk_widget_size_allocate (priv->progress_widget, &progress_alloc, -1);
|
||||||
|
|||||||
+13
-7
@@ -173,9 +173,10 @@ static void gtk_expander_get_property (GObject *object,
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void gtk_expander_destroy (GtkWidget *widget);
|
static void gtk_expander_destroy (GtkWidget *widget);
|
||||||
static void gtk_expander_size_allocate (GtkWidget *widget,
|
static void gtk_expander_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static gboolean gtk_expander_focus (GtkWidget *widget,
|
static gboolean gtk_expander_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
static gboolean gtk_expander_drag_motion (GtkWidget *widget,
|
static gboolean gtk_expander_drag_motion (GtkWidget *widget,
|
||||||
@@ -493,13 +494,18 @@ gtk_expander_destroy (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_expander_size_allocate (GtkWidget *widget,
|
gtk_expander_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkExpanderPrivate *priv = gtk_expander_get_instance_private (GTK_EXPANDER (widget));
|
GtkExpanderPrivate *priv = gtk_expander_get_instance_private (GTK_EXPANDER (widget));
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->box, allocation, baseline);
|
gtk_widget_size_allocate (priv->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -360,14 +360,19 @@ gtk_file_chooser_button_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_file_chooser_button_size_allocate (GtkWidget *widget,
|
gtk_file_chooser_button_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
|
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
|
||||||
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
|
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->child, allocation, baseline);
|
gtk_widget_size_allocate (priv->child,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -230,8 +230,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_map (GtkWidget *widget);
|
||||||
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
|
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
|
||||||
static void gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
|
static void gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static void file_chooser_widget_file_activated (GtkFileChooser *chooser,
|
static void file_chooser_widget_file_activated (GtkFileChooser *chooser,
|
||||||
GtkFileChooserDialog *dialog);
|
GtkFileChooserDialog *dialog);
|
||||||
@@ -617,12 +618,14 @@ gtk_file_chooser_dialog_unmap (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
|
gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget,
|
GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget,
|
||||||
allocation,
|
width,
|
||||||
|
height,
|
||||||
baseline);
|
baseline);
|
||||||
if (gtk_widget_is_drawable (widget))
|
if (gtk_widget_is_drawable (widget))
|
||||||
save_dialog_geometry (GTK_FILE_CHOOSER_DIALOG (widget));
|
save_dialog_geometry (GTK_FILE_CHOOSER_DIALOG (widget));
|
||||||
|
|||||||
@@ -7963,18 +7963,19 @@ gtk_file_chooser_widget_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
|
gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
|
GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
|
||||||
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
|
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget,
|
gtk_widget_size_allocate (priv->box,
|
||||||
allocation,
|
&(GtkAllocation) {
|
||||||
baseline);
|
0, 0,
|
||||||
|
width, height
|
||||||
gtk_widget_size_allocate (priv->box, allocation, -1);
|
},-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+8
-6
@@ -103,9 +103,10 @@ static void gtk_fixed_measure (GtkWidget *widget,
|
|||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
|
|
||||||
|
|
||||||
static void gtk_fixed_size_allocate (GtkWidget *widget,
|
static void gtk_fixed_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_fixed_add (GtkContainer *container,
|
static void gtk_fixed_add (GtkContainer *container,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
static void gtk_fixed_remove (GtkContainer *container,
|
static void gtk_fixed_remove (GtkContainer *container,
|
||||||
@@ -371,9 +372,10 @@ gtk_fixed_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_fixed_size_allocate (GtkWidget *widget,
|
gtk_fixed_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkFixedChild *child_info;
|
GtkFixedChild *child_info;
|
||||||
|
|||||||
+9
-44
@@ -413,40 +413,6 @@ gtk_flow_box_child_get_request_mode (GtkWidget *widget)
|
|||||||
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_flow_box_child_measure (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
int for_size,
|
|
||||||
int *minimum,
|
|
||||||
int *natural,
|
|
||||||
int *minimum_baseline,
|
|
||||||
int *natural_baseline)
|
|
||||||
{
|
|
||||||
GtkWidget *child;
|
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
||||||
if (!child || ! gtk_widget_get_visible (child))
|
|
||||||
{
|
|
||||||
*minimum = *natural = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_measure (child, orientation, for_size,
|
|
||||||
minimum, natural, minimum_baseline, natural_baseline);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_flow_box_child_size_allocate (GtkWidget *widget,
|
|
||||||
const GtkAllocation *allocation,
|
|
||||||
int baseline)
|
|
||||||
{
|
|
||||||
GtkWidget *child;
|
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
||||||
if (child && gtk_widget_get_visible (child))
|
|
||||||
gtk_widget_size_allocate (child, allocation, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GObject implementation {{{2 */
|
/* GObject implementation {{{2 */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -456,8 +422,6 @@ gtk_flow_box_child_class_init (GtkFlowBoxChildClass *class)
|
|||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||||
|
|
||||||
widget_class->get_request_mode = gtk_flow_box_child_get_request_mode;
|
widget_class->get_request_mode = gtk_flow_box_child_get_request_mode;
|
||||||
widget_class->measure = gtk_flow_box_child_measure;
|
|
||||||
widget_class->size_allocate = gtk_flow_box_child_size_allocate;
|
|
||||||
widget_class->focus = gtk_flow_box_child_focus;
|
widget_class->focus = gtk_flow_box_child_focus;
|
||||||
|
|
||||||
class->activate = gtk_flow_box_child_activate;
|
class->activate = gtk_flow_box_child_activate;
|
||||||
@@ -1387,9 +1351,10 @@ get_offset_pixels (GtkAlign align,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_flow_box_size_allocate (GtkWidget *widget,
|
gtk_flow_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkFlowBox *box = GTK_FLOW_BOX (widget);
|
GtkFlowBox *box = GTK_FLOW_BOX (widget);
|
||||||
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
|
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
|
||||||
@@ -1413,14 +1378,14 @@ gtk_flow_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
avail_size = allocation->width;
|
avail_size = width;
|
||||||
avail_other_size = allocation->height;
|
avail_other_size = height;
|
||||||
item_spacing = priv->column_spacing; line_spacing = priv->row_spacing;
|
item_spacing = priv->column_spacing; line_spacing = priv->row_spacing;
|
||||||
}
|
}
|
||||||
else /* GTK_ORIENTATION_VERTICAL */
|
else /* GTK_ORIENTATION_VERTICAL */
|
||||||
{
|
{
|
||||||
avail_size = allocation->height;
|
avail_size = height;
|
||||||
avail_other_size = allocation->width;
|
avail_other_size = width;
|
||||||
item_spacing = priv->row_spacing;
|
item_spacing = priv->row_spacing;
|
||||||
line_spacing = priv->column_spacing;
|
line_spacing = priv->column_spacing;
|
||||||
}
|
}
|
||||||
@@ -1720,7 +1685,7 @@ gtk_flow_box_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||||
child_allocation.x = allocation->width - child_allocation.x - child_allocation.width;
|
child_allocation.x = width - child_allocation.x - child_allocation.width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation, -1);
|
gtk_widget_size_allocate (child, &child_allocation, -1);
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -487,14 +487,20 @@ gtk_font_button_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_font_button_size_allocate (GtkWidget *widget,
|
gtk_font_button_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline)
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkFontButton *button = GTK_FONT_BUTTON (widget);
|
GtkFontButton *button = GTK_FONT_BUTTON (widget);
|
||||||
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
|
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->button, allocation, baseline);
|
gtk_widget_size_allocate (priv->button,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
},
|
||||||
|
baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -647,16 +647,20 @@ gtk_font_chooser_widget_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
|
gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
|
|
||||||
{
|
{
|
||||||
GtkFontChooserWidget *self = GTK_FONT_CHOOSER_WIDGET (widget);
|
GtkFontChooserWidget *self = GTK_FONT_CHOOSER_WIDGET (widget);
|
||||||
GtkFontChooserWidgetPrivate *priv = gtk_font_chooser_widget_get_instance_private (self);
|
GtkFontChooserWidgetPrivate *priv = gtk_font_chooser_widget_get_instance_private (self);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation, -1);
|
gtk_widget_size_allocate (priv->stack,
|
||||||
|
&(GtkAllocation) {
|
||||||
gtk_widget_size_allocate (priv->stack, allocation, -1);
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+14
-12
@@ -115,9 +115,10 @@ static void gtk_frame_get_property (GObject *object,
|
|||||||
guint param_id,
|
guint param_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_frame_size_allocate (GtkWidget *widget,
|
static void gtk_frame_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_frame_remove (GtkContainer *container,
|
static void gtk_frame_remove (GtkContainer *container,
|
||||||
GtkWidget *child);
|
GtkWidget *child);
|
||||||
static void gtk_frame_forall (GtkContainer *container,
|
static void gtk_frame_forall (GtkContainer *container,
|
||||||
@@ -564,9 +565,10 @@ gtk_frame_get_shadow_type (GtkFrame *frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_frame_size_allocate (GtkWidget *widget,
|
gtk_frame_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkFrame *frame = GTK_FRAME (widget);
|
GtkFrame *frame = GTK_FRAME (widget);
|
||||||
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
|
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
|
||||||
@@ -579,7 +581,7 @@ gtk_frame_size_allocate (GtkWidget *widget,
|
|||||||
gtk_widget_get_visible (priv->label_widget))
|
gtk_widget_get_visible (priv->label_widget))
|
||||||
{
|
{
|
||||||
GtkAllocation label_allocation;
|
GtkAllocation label_allocation;
|
||||||
int nat_width, width, height;
|
int nat_width, label_width, label_height;
|
||||||
float xalign;
|
float xalign;
|
||||||
|
|
||||||
if (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
if (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||||
@@ -589,14 +591,14 @@ gtk_frame_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
||||||
NULL, &nat_width, NULL, NULL);
|
NULL, &nat_width, NULL, NULL);
|
||||||
width = MIN (new_allocation.width, nat_width);
|
label_width = MIN (new_allocation.width, nat_width);
|
||||||
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_VERTICAL, width,
|
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_VERTICAL, width,
|
||||||
&height, NULL, NULL, NULL);
|
&label_height, NULL, NULL, NULL);
|
||||||
|
|
||||||
label_allocation.x = new_allocation.x + (new_allocation.width - width) * xalign;
|
label_allocation.x = new_allocation.x + (new_allocation.width - width) * xalign;
|
||||||
label_allocation.y = new_allocation.y - height;
|
label_allocation.y = new_allocation.y - label_height;
|
||||||
label_allocation.height = height;
|
label_allocation.height = label_height;
|
||||||
label_allocation.width = width;
|
label_allocation.width = label_width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->label_widget, &label_allocation, -1);
|
gtk_widget_size_allocate (priv->label_widget, &label_allocation, -1);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -23,16 +23,15 @@ gtk_gizmo_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_gizmo_size_allocate (GtkWidget *widget,
|
gtk_gizmo_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkGizmo *self = GTK_GIZMO (widget);
|
GtkGizmo *self = GTK_GIZMO (widget);
|
||||||
|
|
||||||
if (self->allocate_func)
|
if (self->allocate_func)
|
||||||
self->allocate_func (self,
|
self->allocate_func (self, width, height, baseline);
|
||||||
allocation,
|
|
||||||
baseline);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ typedef void (* GtkGizmoMeasureFunc) (GtkGizmo *gizmo,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
typedef void (* GtkGizmoAllocateFunc) (GtkGizmo *gizmo,
|
typedef void (* GtkGizmoAllocateFunc) (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
typedef gboolean (* GtkGizmoSnapshotFunc) (GtkGizmo *gizmo,
|
typedef gboolean (* GtkGizmoSnapshotFunc) (GtkGizmo *gizmo,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -630,14 +630,15 @@ gtk_gl_area_unrealize (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_gl_area_size_allocate (GtkWidget *widget,
|
gtk_gl_area_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkGLArea *area = GTK_GL_AREA (widget);
|
GtkGLArea *area = GTK_GL_AREA (widget);
|
||||||
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation, baseline);
|
GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, width, height, baseline);
|
||||||
|
|
||||||
if (gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
priv->needs_resize = TRUE;
|
priv->needs_resize = TRUE;
|
||||||
|
|||||||
+12
-11
@@ -1519,8 +1519,9 @@ allocate_child (GtkGridRequest *request,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_grid_request_allocate_children (GtkGridRequest *request,
|
gtk_grid_request_allocate_children (GtkGridRequest *request,
|
||||||
const GtkAllocation *allocation)
|
int grid_width,
|
||||||
|
int grid_height)
|
||||||
{
|
{
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
@@ -1545,19 +1546,19 @@ gtk_grid_request_allocate_children (GtkGridRequest *request,
|
|||||||
child_allocation.height = height;
|
child_allocation.height = height;
|
||||||
|
|
||||||
if (_gtk_widget_get_direction (GTK_WIDGET (request->grid)) == GTK_TEXT_DIR_RTL)
|
if (_gtk_widget_get_direction (GTK_WIDGET (request->grid)) == GTK_TEXT_DIR_RTL)
|
||||||
child_allocation.x = allocation->x + allocation->width
|
child_allocation.x = grid_width - child_allocation.x - child_allocation.width;
|
||||||
- (child_allocation.x - allocation->x) - child_allocation.width;
|
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation, baseline);
|
gtk_widget_size_allocate (child, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GET_SIZE(allocation, orientation) (orientation == GTK_ORIENTATION_HORIZONTAL ? allocation->width : allocation->height)
|
#define GET_SIZE(width, height, orientation) (orientation == GTK_ORIENTATION_HORIZONTAL ? width : height)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_grid_size_allocate (GtkWidget *widget,
|
gtk_grid_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkGrid *grid = GTK_GRID (widget);
|
GtkGrid *grid = GTK_GRID (widget);
|
||||||
GtkGridRequest request;
|
GtkGridRequest request;
|
||||||
@@ -1583,15 +1584,15 @@ gtk_grid_size_allocate (GtkWidget *widget,
|
|||||||
orientation = GTK_ORIENTATION_VERTICAL;
|
orientation = GTK_ORIENTATION_VERTICAL;
|
||||||
|
|
||||||
gtk_grid_request_run (&request, 1 - orientation, FALSE);
|
gtk_grid_request_run (&request, 1 - orientation, FALSE);
|
||||||
gtk_grid_request_allocate (&request, 1 - orientation, GET_SIZE (allocation, 1 - orientation));
|
gtk_grid_request_allocate (&request, 1 - orientation, GET_SIZE (width, height, 1 - orientation));
|
||||||
gtk_grid_request_run (&request, orientation, TRUE);
|
gtk_grid_request_run (&request, orientation, TRUE);
|
||||||
|
|
||||||
gtk_grid_request_allocate (&request, orientation, GET_SIZE (allocation, orientation));
|
gtk_grid_request_allocate (&request, orientation, GET_SIZE (width, height, orientation));
|
||||||
|
|
||||||
gtk_grid_request_position (&request, 0);
|
gtk_grid_request_position (&request, 0);
|
||||||
gtk_grid_request_position (&request, 1);
|
gtk_grid_request_position (&request, 1);
|
||||||
|
|
||||||
gtk_grid_request_allocate_children (&request, allocation);
|
gtk_grid_request_allocate_children (&request, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+25
-24
@@ -894,9 +894,10 @@ gtk_header_bar_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_header_bar_size_allocate (GtkWidget *widget,
|
gtk_header_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int widget_width,
|
||||||
int baseline)
|
int widget_height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
|
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
|
||||||
GtkWidget *title_widget;
|
GtkWidget *title_widget;
|
||||||
@@ -925,8 +926,8 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
|
|||||||
nvis_children = count_visible_children (bar);
|
nvis_children = count_visible_children (bar);
|
||||||
sizes = g_newa (GtkRequestedSize, nvis_children);
|
sizes = g_newa (GtkRequestedSize, nvis_children);
|
||||||
|
|
||||||
width = allocation->width - nvis_children * priv->spacing;
|
width = widget_width - nvis_children * priv->spacing;
|
||||||
height = allocation->height;
|
height = widget_height;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (l = priv->children; l; l = l->next)
|
for (l = priv->children; l; l = l->next)
|
||||||
@@ -1025,7 +1026,7 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
gint side_free_space;
|
gint side_free_space;
|
||||||
|
|
||||||
side_free_space = allocation->width / 2 - title_natural_size / 2 - side[packing];
|
side_free_space = widget_width / 2 - title_natural_size / 2 - side[packing];
|
||||||
|
|
||||||
if (side_free_space > 0 && nexpand_children[packing] > 0)
|
if (side_free_space > 0 && nexpand_children[packing] > 0)
|
||||||
{
|
{
|
||||||
@@ -1043,12 +1044,12 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
|
|||||||
/* allocate the children on both sides of the title */
|
/* allocate the children on both sides of the title */
|
||||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; packing++)
|
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; packing++)
|
||||||
{
|
{
|
||||||
child_allocation.y = allocation->y;
|
child_allocation.y = 0;
|
||||||
child_allocation.height = height;
|
child_allocation.height = height;
|
||||||
if (packing == GTK_PACK_START)
|
if (packing == GTK_PACK_START)
|
||||||
x = allocation->x + start_width;
|
x = start_width;
|
||||||
else
|
else
|
||||||
x = allocation->x + allocation->width - end_width;
|
x = widget_width - end_width;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (l = priv->children; l != NULL; l = l->next)
|
for (l = priv->children; l != NULL; l = l->next)
|
||||||
@@ -1094,7 +1095,7 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
|
child_allocation.x = widget_width - child_allocation.x - child_allocation.width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (child->widget, &child_allocation, baseline);
|
gtk_widget_size_allocate (child->widget, &child_allocation, baseline);
|
||||||
|
|
||||||
@@ -1106,12 +1107,12 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
|
|||||||
/* We don't enforce css borders on the center widget, to make
|
/* We don't enforce css borders on the center widget, to make
|
||||||
* title/subtitle combinations fit without growing the header
|
* title/subtitle combinations fit without growing the header
|
||||||
*/
|
*/
|
||||||
child_allocation.y = allocation->y;
|
child_allocation.y = 0;
|
||||||
child_allocation.height = allocation->height;
|
child_allocation.height = widget_height;
|
||||||
|
|
||||||
child_size = MIN (allocation->width - side[0] - side[1], title_natural_size);
|
child_size = MIN (widget_width - side[0] - side[1], title_natural_size);
|
||||||
|
|
||||||
child_allocation.x = allocation->x + (allocation->width - child_size) / 2;
|
child_allocation.x = (widget_width - child_size) / 2;
|
||||||
child_allocation.width = child_size;
|
child_allocation.width = child_size;
|
||||||
|
|
||||||
/* if the title widget is expanded, then grow it by all the available
|
/* if the title widget is expanded, then grow it by all the available
|
||||||
@@ -1123,29 +1124,29 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
|
|||||||
child_allocation.x -= width / 2;
|
child_allocation.x -= width / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allocation->x + side[0] > child_allocation.x)
|
if (side[0] > child_allocation.x)
|
||||||
child_allocation.x = allocation->x + side[0];
|
child_allocation.x = side[0];
|
||||||
else if (allocation->x + allocation->width - side[1] < child_allocation.x + child_allocation.width)
|
else if (widget_width - side[1] < child_allocation.x + child_allocation.width)
|
||||||
child_allocation.x = allocation->x + allocation->width - side[1] - child_allocation.width;
|
child_allocation.x = widget_width - side[1] - child_allocation.width;
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
|
child_allocation.x = widget_width - (child_allocation.x) - child_allocation.width;
|
||||||
|
|
||||||
if (title_widget != NULL)
|
if (title_widget != NULL)
|
||||||
{
|
{
|
||||||
gtk_widget_size_allocate (title_widget, &child_allocation, baseline);
|
gtk_widget_size_allocate (title_widget, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
child_allocation.y = allocation->y;
|
child_allocation.y = 0;
|
||||||
child_allocation.height = height;
|
child_allocation.height = height;
|
||||||
|
|
||||||
if (priv->titlebar_start_box)
|
if (priv->titlebar_start_box)
|
||||||
{
|
{
|
||||||
gboolean left = (direction == GTK_TEXT_DIR_LTR);
|
gboolean left = (direction == GTK_TEXT_DIR_LTR);
|
||||||
if (left)
|
if (left)
|
||||||
child_allocation.x = allocation->x;
|
child_allocation.x = 0;
|
||||||
else
|
else
|
||||||
child_allocation.x = allocation->x + allocation->width - start_width + priv->spacing;
|
child_allocation.x = widget_width - start_width + priv->spacing;
|
||||||
child_allocation.width = start_width - priv->spacing;
|
child_allocation.width = start_width - priv->spacing;
|
||||||
gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation, baseline);
|
gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
@@ -1154,9 +1155,9 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
gboolean left = (direction != GTK_TEXT_DIR_LTR);
|
gboolean left = (direction != GTK_TEXT_DIR_LTR);
|
||||||
if (left)
|
if (left)
|
||||||
child_allocation.x = allocation->x;
|
child_allocation.x = 0;
|
||||||
else
|
else
|
||||||
child_allocation.x = allocation->x + allocation->width - end_width + priv->spacing;
|
child_allocation.x = widget_width - end_width + priv->spacing;
|
||||||
child_allocation.width = end_width - priv->spacing;
|
child_allocation.width = end_width - priv->spacing;
|
||||||
gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation, baseline);
|
gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-6
@@ -153,9 +153,10 @@ static void gtk_icon_view_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_icon_view_size_allocate (GtkWidget *widget,
|
static void gtk_icon_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_icon_view_snapshot (GtkWidget *widget,
|
static void gtk_icon_view_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_icon_view_motion (GtkEventController *controller,
|
static void gtk_icon_view_motion (GtkEventController *controller,
|
||||||
@@ -1616,9 +1617,10 @@ gtk_icon_view_allocate_children (GtkIconView *icon_view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_icon_view_size_allocate (GtkWidget *widget,
|
gtk_icon_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
||||||
|
|
||||||
|
|||||||
+9
-8
@@ -404,9 +404,10 @@ static void gtk_label_get_property (GObject *object,
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_label_finalize (GObject *object);
|
static void gtk_label_finalize (GObject *object);
|
||||||
static void gtk_label_destroy (GtkWidget *widget);
|
static void gtk_label_destroy (GtkWidget *widget);
|
||||||
static void gtk_label_size_allocate (GtkWidget *widget,
|
static void gtk_label_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_label_state_flags_changed (GtkWidget *widget,
|
static void gtk_label_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateFlags prev_state);
|
GtkStateFlags prev_state);
|
||||||
static void gtk_label_style_updated (GtkWidget *widget);
|
static void gtk_label_style_updated (GtkWidget *widget);
|
||||||
@@ -3649,9 +3650,10 @@ get_layout_location (GtkLabel *label,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_label_size_allocate (GtkWidget *widget,
|
gtk_label_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkLabel *label = GTK_LABEL (widget);
|
GtkLabel *label = GTK_LABEL (widget);
|
||||||
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
||||||
@@ -3659,8 +3661,7 @@ gtk_label_size_allocate (GtkWidget *widget,
|
|||||||
if (priv->layout)
|
if (priv->layout)
|
||||||
{
|
{
|
||||||
if (priv->ellipsize || priv->wrap)
|
if (priv->ellipsize || priv->wrap)
|
||||||
pango_layout_set_width (priv->layout,
|
pango_layout_set_width (priv->layout, width * PANGO_SCALE);
|
||||||
allocation->width * PANGO_SCALE);
|
|
||||||
else
|
else
|
||||||
pango_layout_set_width (priv->layout, -1);
|
pango_layout_set_width (priv->layout, -1);
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-6
@@ -115,9 +115,10 @@ static void gtk_layout_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_layout_size_allocate (GtkWidget *widget,
|
static void gtk_layout_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_layout_add (GtkContainer *container,
|
static void gtk_layout_add (GtkContainer *container,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
static void gtk_layout_remove (GtkContainer *container,
|
static void gtk_layout_remove (GtkContainer *container,
|
||||||
@@ -707,9 +708,10 @@ gtk_layout_measure (GtkWidget *widget,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_layout_size_allocate (GtkWidget *widget,
|
gtk_layout_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkLayout *layout = GTK_LAYOUT (widget);
|
GtkLayout *layout = GTK_LAYOUT (widget);
|
||||||
GtkLayoutPrivate *priv = gtk_layout_get_instance_private (layout);
|
GtkLayoutPrivate *priv = gtk_layout_get_instance_private (layout);
|
||||||
|
|||||||
+32
-24
@@ -427,9 +427,10 @@ gtk_level_bar_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
|
gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
|
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
|
||||||
GtkAllocation block_area;
|
GtkAllocation block_area;
|
||||||
@@ -441,14 +442,14 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
|
|||||||
|
|
||||||
/* allocate the empty (unfilled) part */
|
/* allocate the empty (unfilled) part */
|
||||||
gtk_widget_size_allocate (priv->block_widget[inverted ? 0 : 1],
|
gtk_widget_size_allocate (priv->block_widget[inverted ? 0 : 1],
|
||||||
allocation,
|
&(GtkAllocation) {0, 0, width, height},
|
||||||
baseline);
|
baseline);
|
||||||
|
|
||||||
if (priv->cur_value == 0)
|
if (priv->cur_value == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* now allocate the filled part */
|
/* now allocate the filled part */
|
||||||
block_area = *allocation;
|
block_area = (GtkAllocation) {0, 0, width, height};
|
||||||
fill_percentage = (priv->cur_value - priv->min_value) /
|
fill_percentage = (priv->cur_value - priv->min_value) /
|
||||||
(priv->max_value - priv->min_value);
|
(priv->max_value - priv->min_value);
|
||||||
|
|
||||||
@@ -463,7 +464,7 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
|
|||||||
block_area.width = MAX (block_area.width, block_min);
|
block_area.width = MAX (block_area.width, block_min);
|
||||||
|
|
||||||
if (inverted)
|
if (inverted)
|
||||||
block_area.x += allocation->width - block_area.width;
|
block_area.x += width - block_area.width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -471,7 +472,7 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
|
|||||||
block_area.height = MAX (block_area.height, block_min);
|
block_area.height = MAX (block_area.height, block_min);
|
||||||
|
|
||||||
if (inverted)
|
if (inverted)
|
||||||
block_area.y += allocation->height - block_area.height;
|
block_area.y += height - block_area.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->block_widget[inverted ? 1 : 0],
|
gtk_widget_size_allocate (priv->block_widget[inverted ? 1 : 0],
|
||||||
@@ -481,8 +482,9 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
|
gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
|
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
|
||||||
GtkAllocation block_area;
|
GtkAllocation block_area;
|
||||||
@@ -497,17 +499,17 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
|
|||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
block_width = MAX (block_width, (gint) floor (allocation->width / num_blocks));
|
block_width = MAX (block_width, (gint) floor (width / num_blocks));
|
||||||
block_height = allocation->height;
|
block_height = height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
block_width = allocation->width;
|
block_width = width;
|
||||||
block_height = MAX (block_height, (gint) floor (allocation->height / num_blocks));
|
block_height = MAX (block_height, (gint) floor (height / num_blocks));
|
||||||
}
|
}
|
||||||
|
|
||||||
block_area.x = allocation->x;
|
block_area.x = 0;
|
||||||
block_area.y = allocation->y;
|
block_area.y = 0;
|
||||||
block_area.width = block_width;
|
block_area.width = block_width;
|
||||||
block_area.height = block_height;
|
block_area.height = block_height;
|
||||||
|
|
||||||
@@ -525,28 +527,34 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
|
gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (gizmo);
|
GtkWidget *widget = GTK_WIDGET (gizmo);
|
||||||
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (widget));
|
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (widget));
|
||||||
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
|
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
|
if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
|
||||||
gtk_level_bar_allocate_trough_continuous (self, allocation, baseline);
|
gtk_level_bar_allocate_trough_continuous (self, width, height, baseline);
|
||||||
else
|
else
|
||||||
gtk_level_bar_allocate_trough_discrete (self, allocation, baseline);
|
gtk_level_bar_allocate_trough_discrete (self, width, height, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_level_bar_size_allocate (GtkWidget *widget,
|
gtk_level_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget));
|
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget));
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->trough_widget, allocation, baseline);
|
gtk_widget_size_allocate (priv->trough_widget,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+15
-13
@@ -227,7 +227,8 @@ static void gtk_list_box_compute_expand (GtkWidget
|
|||||||
static GType gtk_list_box_child_type (GtkContainer *container);
|
static GType gtk_list_box_child_type (GtkContainer *container);
|
||||||
static GtkSizeRequestMode gtk_list_box_get_request_mode (GtkWidget *widget);
|
static GtkSizeRequestMode gtk_list_box_get_request_mode (GtkWidget *widget);
|
||||||
static void gtk_list_box_size_allocate (GtkWidget *widget,
|
static void gtk_list_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static void gtk_list_box_drag_leave (GtkWidget *widget,
|
static void gtk_list_box_drag_leave (GtkWidget *widget,
|
||||||
GdkDrop *drop);
|
GdkDrop *drop);
|
||||||
@@ -2504,9 +2505,10 @@ gtk_list_box_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_box_size_allocate (GtkWidget *widget,
|
gtk_list_box_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkListBoxPrivate *priv = BOX_PRIV (widget);
|
GtkListBoxPrivate *priv = BOX_PRIV (widget);
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
@@ -2516,22 +2518,22 @@ gtk_list_box_size_allocate (GtkWidget *widget,
|
|||||||
int child_min;
|
int child_min;
|
||||||
|
|
||||||
|
|
||||||
child_allocation.x = allocation->x;
|
child_allocation.x = 0;
|
||||||
child_allocation.y = allocation->y;
|
child_allocation.y = 0;
|
||||||
child_allocation.width = allocation->width;
|
child_allocation.width = width;
|
||||||
child_allocation.height = 0;
|
child_allocation.height = 0;
|
||||||
|
|
||||||
header_allocation.x = allocation->x;
|
header_allocation.x = 0;
|
||||||
header_allocation.y = allocation->y;
|
header_allocation.y = 0;
|
||||||
header_allocation.width = allocation->width;
|
header_allocation.width = width;
|
||||||
header_allocation.height = 0;
|
header_allocation.height = 0;
|
||||||
|
|
||||||
if (priv->placeholder && gtk_widget_get_child_visible (priv->placeholder))
|
if (priv->placeholder && gtk_widget_get_child_visible (priv->placeholder))
|
||||||
{
|
{
|
||||||
gtk_widget_measure (priv->placeholder, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (priv->placeholder, GTK_ORIENTATION_VERTICAL,
|
||||||
allocation->width,
|
width,
|
||||||
&child_min, NULL, NULL, NULL);
|
&child_min, NULL, NULL, NULL);
|
||||||
header_allocation.height = allocation->height;
|
header_allocation.height = height;
|
||||||
header_allocation.y = child_allocation.y;
|
header_allocation.y = child_allocation.y;
|
||||||
gtk_widget_size_allocate (priv->placeholder, &header_allocation, -1);
|
gtk_widget_size_allocate (priv->placeholder, &header_allocation, -1);
|
||||||
child_allocation.y += child_min;
|
child_allocation.y += child_min;
|
||||||
@@ -2552,7 +2554,7 @@ gtk_list_box_size_allocate (GtkWidget *widget,
|
|||||||
if (ROW_PRIV (row)->header != NULL)
|
if (ROW_PRIV (row)->header != NULL)
|
||||||
{
|
{
|
||||||
gtk_widget_measure (ROW_PRIV (row)->header, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (ROW_PRIV (row)->header, GTK_ORIENTATION_VERTICAL,
|
||||||
allocation->width,
|
width,
|
||||||
&child_min, NULL, NULL, NULL);
|
&child_min, NULL, NULL, NULL);
|
||||||
header_allocation.height = child_min;
|
header_allocation.height = child_min;
|
||||||
header_allocation.y = child_allocation.y;
|
header_allocation.y = child_allocation.y;
|
||||||
|
|||||||
@@ -185,13 +185,18 @@ gtk_media_controls_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_media_controls_size_allocate (GtkWidget *widget,
|
gtk_media_controls_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkMediaControls *controls = GTK_MEDIA_CONTROLS (widget);
|
GtkMediaControls *controls = GTK_MEDIA_CONTROLS (widget);
|
||||||
|
|
||||||
gtk_widget_size_allocate (controls->box, allocation, baseline);
|
gtk_widget_size_allocate (controls->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+14
-13
@@ -219,9 +219,10 @@ static void gtk_menu_get_child_property(GtkContainer *container,
|
|||||||
static void gtk_menu_destroy (GtkWidget *widget);
|
static void gtk_menu_destroy (GtkWidget *widget);
|
||||||
static void gtk_menu_realize (GtkWidget *widget);
|
static void gtk_menu_realize (GtkWidget *widget);
|
||||||
static void gtk_menu_unrealize (GtkWidget *widget);
|
static void gtk_menu_unrealize (GtkWidget *widget);
|
||||||
static void gtk_menu_size_allocate (GtkWidget *widget,
|
static void gtk_menu_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int widget_width,
|
||||||
int baseline);
|
int widget_height,
|
||||||
|
int baseline);
|
||||||
static void gtk_menu_show (GtkWidget *widget);
|
static void gtk_menu_show (GtkWidget *widget);
|
||||||
static void gtk_menu_snapshot (GtkWidget *widget,
|
static void gtk_menu_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
@@ -2490,9 +2491,10 @@ calculate_line_heights (GtkMenu *menu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_menu_size_allocate (GtkWidget *widget,
|
gtk_menu_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int widget_width,
|
||||||
int baseline)
|
int widget_height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkMenu *menu;
|
GtkMenu *menu;
|
||||||
GtkMenuPrivate *priv;
|
GtkMenuPrivate *priv;
|
||||||
@@ -2506,7 +2508,6 @@ gtk_menu_size_allocate (GtkWidget *widget,
|
|||||||
int base_width;
|
int base_width;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_MENU (widget));
|
g_return_if_fail (GTK_IS_MENU (widget));
|
||||||
g_return_if_fail (allocation != NULL);
|
|
||||||
|
|
||||||
menu = GTK_MENU (widget);
|
menu = GTK_MENU (widget);
|
||||||
menu_shell = GTK_MENU_SHELL (widget);
|
menu_shell = GTK_MENU_SHELL (widget);
|
||||||
@@ -2514,7 +2515,7 @@ gtk_menu_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
g_free (priv->heights);
|
g_free (priv->heights);
|
||||||
priv->heights_length = calculate_line_heights (menu,
|
priv->heights_length = calculate_line_heights (menu,
|
||||||
allocation->width,
|
widget_width,
|
||||||
&priv->heights,
|
&priv->heights,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@@ -2525,7 +2526,7 @@ gtk_menu_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
|
|
||||||
/* Show scroll arrows if necessary */
|
/* Show scroll arrows if necessary */
|
||||||
if (priv->requested_height > allocation->height)
|
if (priv->requested_height > widget_height)
|
||||||
{
|
{
|
||||||
gtk_widget_set_child_visible (priv->top_arrow_widget, TRUE);
|
gtk_widget_set_child_visible (priv->top_arrow_widget, TRUE);
|
||||||
gtk_widget_set_child_visible (priv->bottom_arrow_widget, TRUE);
|
gtk_widget_set_child_visible (priv->bottom_arrow_widget, TRUE);
|
||||||
@@ -2536,10 +2537,10 @@ gtk_menu_size_allocate (GtkWidget *widget,
|
|||||||
gtk_widget_set_child_visible (priv->bottom_arrow_widget, FALSE);
|
gtk_widget_set_child_visible (priv->bottom_arrow_widget, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
x = allocation->x;
|
x = 0;
|
||||||
y = allocation->y;
|
y = 0;
|
||||||
width = allocation->width;
|
width = widget_width;
|
||||||
height = allocation->height;
|
height = widget_height;
|
||||||
|
|
||||||
if (menu_shell->priv->active)
|
if (menu_shell->priv->active)
|
||||||
gtk_menu_scroll_to (menu, priv->scroll_offset);
|
gtk_menu_scroll_to (menu, priv->scroll_offset);
|
||||||
|
|||||||
+9
-7
@@ -87,9 +87,10 @@ static void gtk_menu_bar_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_menu_bar_size_allocate (GtkWidget *widget,
|
static void gtk_menu_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
|
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
|
||||||
GtkWidget *old_toplevel);
|
GtkWidget *old_toplevel);
|
||||||
static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
|
static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
|
||||||
@@ -338,9 +339,10 @@ gtk_menu_bar_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_menu_bar_size_allocate (GtkWidget *widget,
|
gtk_menu_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkMenuBar *menu_bar = GTK_MENU_BAR (widget);
|
GtkMenuBar *menu_bar = GTK_MENU_BAR (widget);
|
||||||
GtkMenuBarPrivate *priv = menu_bar->priv;
|
GtkMenuBarPrivate *priv = menu_bar->priv;
|
||||||
@@ -357,7 +359,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
|
|||||||
if (!menu_shell->priv->children)
|
if (!menu_shell->priv->children)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
remaining_space = *allocation;
|
remaining_space = (GtkAllocation) {0, 0, width, height};
|
||||||
requested_sizes = g_array_new (FALSE, FALSE, sizeof (GtkRequestedSize));
|
requested_sizes = g_array_new (FALSE, FALSE, sizeof (GtkRequestedSize));
|
||||||
|
|
||||||
if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
|
if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
|
||||||
|
|||||||
+5
-5
@@ -251,9 +251,10 @@ gtk_menu_item_actionable_interface_init (GtkActionableInterface *iface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_menu_item_size_allocate (GtkWidget *widget,
|
gtk_menu_item_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
|
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
|
||||||
GtkMenuItemPrivate *priv = menu_item->priv;
|
GtkMenuItemPrivate *priv = menu_item->priv;
|
||||||
@@ -264,7 +265,6 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
|||||||
GtkWidget *parent;
|
GtkWidget *parent;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
||||||
g_return_if_fail (allocation != NULL);
|
|
||||||
|
|
||||||
direction = gtk_widget_get_direction (widget);
|
direction = gtk_widget_get_direction (widget);
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
|||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
child_allocation = *allocation;
|
child_allocation = (GtkAllocation) {0, 0, width, height};
|
||||||
|
|
||||||
if (child_pack_dir == GTK_PACK_DIRECTION_LTR ||
|
if (child_pack_dir == GTK_PACK_DIRECTION_LTR ||
|
||||||
child_pack_dir == GTK_PACK_DIRECTION_RTL)
|
child_pack_dir == GTK_PACK_DIRECTION_RTL)
|
||||||
|
|||||||
+13
-11
@@ -778,14 +778,16 @@ gtk_model_button_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_model_button_size_allocate (GtkWidget *widget,
|
gtk_model_button_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
if (GTK_MODEL_BUTTON (widget)->iconic)
|
if (GTK_MODEL_BUTTON (widget)->iconic)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget,
|
GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget,
|
||||||
allocation,
|
width,
|
||||||
|
height,
|
||||||
baseline);
|
baseline);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -813,10 +815,10 @@ gtk_model_button_size_allocate (GtkWidget *widget,
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
if (indicator_is_left (widget))
|
if (indicator_is_left (widget))
|
||||||
child_allocation.x = allocation->x;
|
child_allocation.x = 0;
|
||||||
else
|
else
|
||||||
child_allocation.x = allocation->x + allocation->width - check_nat_width;
|
child_allocation.x = width - check_nat_width;
|
||||||
child_allocation.y = allocation->y + (allocation->height - check_nat_height) / 2;
|
child_allocation.y = (height - check_nat_height) / 2;
|
||||||
child_allocation.width = check_nat_width;
|
child_allocation.width = check_nat_width;
|
||||||
child_allocation.height = check_nat_height;
|
child_allocation.height = check_nat_height;
|
||||||
|
|
||||||
@@ -839,10 +841,10 @@ gtk_model_button_size_allocate (GtkWidget *widget,
|
|||||||
border.right += check_nat_width;
|
border.right += check_nat_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
child_allocation.x = allocation->x + border.left;
|
child_allocation.x = border.left;
|
||||||
child_allocation.y = allocation->y + border.top;
|
child_allocation.y = border.top;
|
||||||
child_allocation.width = allocation->width - border.left - border.right;
|
child_allocation.width = width - border.left - border.right;
|
||||||
child_allocation.height = allocation->height - border.top - border.bottom;
|
child_allocation.height = height - border.top - border.bottom;
|
||||||
|
|
||||||
if (baseline != -1)
|
if (baseline != -1)
|
||||||
baseline -= border.top;
|
baseline -= border.top;
|
||||||
|
|||||||
+45
-34
@@ -367,7 +367,8 @@ static void gtk_notebook_measure (GtkWidget *widget,
|
|||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_notebook_size_allocate (GtkWidget *widget,
|
static void gtk_notebook_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static gboolean gtk_notebook_popup_menu (GtkWidget *widget);
|
static gboolean gtk_notebook_popup_menu (GtkWidget *widget);
|
||||||
static void gtk_notebook_motion (GtkEventController *controller,
|
static void gtk_notebook_motion (GtkEventController *controller,
|
||||||
@@ -447,8 +448,9 @@ static void gtk_notebook_measure_tabs (GtkGizmo *gizmo,
|
|||||||
gint *natural,
|
gint *natural,
|
||||||
gint *minimum_baseline,
|
gint *minimum_baseline,
|
||||||
gint *natural_baseline);
|
gint *natural_baseline);
|
||||||
static void gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
|
static void gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static gboolean gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
|
static gboolean gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
@@ -472,7 +474,8 @@ static void gtk_notebook_child_reordered (GtkNotebook *notebook,
|
|||||||
|
|
||||||
/*** GtkNotebook Size Allocate Functions ***/
|
/*** GtkNotebook Size Allocate Functions ***/
|
||||||
static void gtk_notebook_pages_allocate (GtkNotebook *notebook,
|
static void gtk_notebook_pages_allocate (GtkNotebook *notebook,
|
||||||
const GtkAllocation *allocation);
|
int width,
|
||||||
|
int height);
|
||||||
static void gtk_notebook_calc_tabs (GtkNotebook *notebook,
|
static void gtk_notebook_calc_tabs (GtkNotebook *notebook,
|
||||||
GList *start,
|
GList *start,
|
||||||
GList **end,
|
GList **end,
|
||||||
@@ -2024,25 +2027,31 @@ gtk_notebook_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
|
gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
GtkWidget *widget = gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK (gtk_widget_get_parent (widget));
|
GtkNotebook *notebook = GTK_NOTEBOOK (gtk_widget_get_parent (widget));
|
||||||
|
|
||||||
gtk_notebook_pages_allocate (notebook, allocation);
|
gtk_notebook_pages_allocate (notebook, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_size_allocate (GtkWidget *widget,
|
gtk_notebook_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||||
GtkNotebookPrivate *priv = notebook->priv;
|
GtkNotebookPrivate *priv = notebook->priv;
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->box, allocation, -1);
|
gtk_widget_size_allocate (priv->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -3872,9 +3881,10 @@ measure_tab (GtkGizmo *gizmo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
allocate_tab (GtkGizmo *gizmo,
|
allocate_tab (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkNotebook *notebook = g_object_get_data (G_OBJECT (gizmo), "notebook");
|
GtkNotebook *notebook = g_object_get_data (G_OBJECT (gizmo), "notebook");
|
||||||
GtkNotebookPrivate *priv = notebook->priv;
|
GtkNotebookPrivate *priv = notebook->priv;
|
||||||
@@ -3894,30 +3904,29 @@ allocate_tab (GtkGizmo *gizmo,
|
|||||||
|
|
||||||
g_assert (page != NULL);
|
g_assert (page != NULL);
|
||||||
|
|
||||||
|
child_allocation = (GtkAllocation) {0, 0, width, height};
|
||||||
child_allocation = *allocation;
|
|
||||||
|
|
||||||
if (!page->fill)
|
if (!page->fill)
|
||||||
{
|
{
|
||||||
if (priv->tab_pos == GTK_POS_TOP || priv->tab_pos == GTK_POS_BOTTOM)
|
if (priv->tab_pos == GTK_POS_TOP || priv->tab_pos == GTK_POS_BOTTOM)
|
||||||
{
|
{
|
||||||
gtk_widget_measure (page->tab_label, GTK_ORIENTATION_HORIZONTAL, allocation->height,
|
gtk_widget_measure (page->tab_label, GTK_ORIENTATION_HORIZONTAL, height,
|
||||||
NULL, &child_allocation.width, NULL, NULL);
|
NULL, &child_allocation.width, NULL, NULL);
|
||||||
if (child_allocation.width > allocation->width)
|
if (child_allocation.width > width)
|
||||||
child_allocation.width = allocation->width;
|
child_allocation.width = width;
|
||||||
else
|
else
|
||||||
child_allocation.x += (allocation->width - child_allocation.width) / 2;
|
child_allocation.x += (width - child_allocation.width) / 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_measure (page->tab_label, GTK_ORIENTATION_VERTICAL, allocation->width,
|
gtk_widget_measure (page->tab_label, GTK_ORIENTATION_VERTICAL, width,
|
||||||
NULL, &child_allocation.height, NULL, NULL);
|
NULL, &child_allocation.height, NULL, NULL);
|
||||||
|
|
||||||
if (child_allocation.height > allocation->height)
|
if (child_allocation.height > height)
|
||||||
child_allocation.height = allocation->height;
|
child_allocation.height = height;
|
||||||
else
|
else
|
||||||
child_allocation.y += (allocation->height - child_allocation.height) / 2;
|
child_allocation.y += (height - child_allocation.height) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4562,11 +4571,12 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_tab_space (GtkNotebook *notebook,
|
gtk_notebook_tab_space (GtkNotebook *notebook,
|
||||||
const GtkAllocation *allocation,
|
int notebook_width,
|
||||||
gboolean *show_arrows,
|
int notebook_height,
|
||||||
GtkAllocation *tabs_allocation,
|
gboolean *show_arrows,
|
||||||
gint *tab_space)
|
GtkAllocation *tabs_allocation,
|
||||||
|
gint *tab_space)
|
||||||
{
|
{
|
||||||
GtkNotebookPrivate *priv = notebook->priv;
|
GtkNotebookPrivate *priv = notebook->priv;
|
||||||
GList *children;
|
GList *children;
|
||||||
@@ -4574,7 +4584,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
|
|||||||
|
|
||||||
children = priv->children;
|
children = priv->children;
|
||||||
|
|
||||||
*tabs_allocation = *allocation;
|
*tabs_allocation = (GtkAllocation) {0, 0, notebook_width, notebook_height};
|
||||||
|
|
||||||
switch (tab_pos)
|
switch (tab_pos)
|
||||||
{
|
{
|
||||||
@@ -5176,8 +5186,9 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_pages_allocate (GtkNotebook *notebook,
|
gtk_notebook_pages_allocate (GtkNotebook *notebook,
|
||||||
const GtkAllocation *allocation)
|
int width,
|
||||||
|
int height)
|
||||||
{
|
{
|
||||||
GtkNotebookPrivate *priv = notebook->priv;
|
GtkNotebookPrivate *priv = notebook->priv;
|
||||||
GList *children = NULL;
|
GList *children = NULL;
|
||||||
@@ -5193,7 +5204,7 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
|
|||||||
tab_space = remaining_space = 0;
|
tab_space = remaining_space = 0;
|
||||||
expanded_tabs = 1;
|
expanded_tabs = 1;
|
||||||
|
|
||||||
gtk_notebook_tab_space (notebook, allocation,
|
gtk_notebook_tab_space (notebook, width, height,
|
||||||
&showarrow, &tabs_allocation, &tab_space);
|
&showarrow, &tabs_allocation, &tab_space);
|
||||||
|
|
||||||
gtk_notebook_calculate_shown_tabs (notebook, showarrow,
|
gtk_notebook_calculate_shown_tabs (notebook, showarrow,
|
||||||
|
|||||||
+9
-4
@@ -300,9 +300,10 @@ gtk_overlay_child_allocate (GtkOverlay *overlay,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_overlay_size_allocate (GtkWidget *widget,
|
gtk_overlay_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkOverlay *overlay = GTK_OVERLAY (widget);
|
GtkOverlay *overlay = GTK_OVERLAY (widget);
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
@@ -310,7 +311,11 @@ gtk_overlay_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
|
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
|
||||||
if (main_widget && gtk_widget_get_visible (main_widget))
|
if (main_widget && gtk_widget_get_visible (main_widget))
|
||||||
gtk_widget_size_allocate (main_widget, allocation, -1);
|
gtk_widget_size_allocate (main_widget,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
|
|
||||||
for (child = gtk_widget_get_first_child (widget);
|
for (child = gtk_widget_get_first_child (widget);
|
||||||
child != NULL;
|
child != NULL;
|
||||||
|
|||||||
+28
-27
@@ -216,7 +216,8 @@ static void gtk_paned_measure (GtkWidget *widget,
|
|||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_paned_size_allocate (GtkWidget *widget,
|
static void gtk_paned_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static void gtk_paned_unrealize (GtkWidget *widget);
|
static void gtk_paned_unrealize (GtkWidget *widget);
|
||||||
static void gtk_paned_snapshot (GtkWidget *widget,
|
static void gtk_paned_snapshot (GtkWidget *widget,
|
||||||
@@ -1183,13 +1184,9 @@ gtk_paned_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flip_child (const GtkAllocation *allocation,
|
flip_child (int width,
|
||||||
GtkAllocation *child_pos)
|
GtkAllocation *child_pos)
|
||||||
{
|
{
|
||||||
int width;
|
|
||||||
|
|
||||||
width = allocation->width;
|
|
||||||
|
|
||||||
child_pos->x = width - child_pos->x - child_pos->width;
|
child_pos->x = width - child_pos->x - child_pos->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1210,9 +1207,10 @@ gtk_paned_set_child_visible (GtkPaned *paned,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_paned_size_allocate (GtkWidget *widget,
|
gtk_paned_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkPaned *paned = GTK_PANED (widget);
|
GtkPaned *paned = GTK_PANED (widget);
|
||||||
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
||||||
@@ -1236,14 +1234,14 @@ gtk_paned_size_allocate (GtkWidget *widget,
|
|||||||
gint child1_width, child2_width;
|
gint child1_width, child2_width;
|
||||||
|
|
||||||
gtk_widget_measure (priv->child1, GTK_ORIENTATION_HORIZONTAL,
|
gtk_widget_measure (priv->child1, GTK_ORIENTATION_HORIZONTAL,
|
||||||
allocation->height,
|
height,
|
||||||
&child1_width, NULL, NULL, NULL);
|
&child1_width, NULL, NULL, NULL);
|
||||||
gtk_widget_measure (priv->child2, GTK_ORIENTATION_HORIZONTAL,
|
gtk_widget_measure (priv->child2, GTK_ORIENTATION_HORIZONTAL,
|
||||||
allocation->height,
|
height,
|
||||||
&child2_width, NULL, NULL, NULL);
|
&child2_width, NULL, NULL, NULL);
|
||||||
|
|
||||||
gtk_paned_calc_position (paned,
|
gtk_paned_calc_position (paned,
|
||||||
MAX (1, allocation->width - handle_size),
|
MAX (1, width - handle_size),
|
||||||
child1_width,
|
child1_width,
|
||||||
child2_width);
|
child2_width);
|
||||||
|
|
||||||
@@ -1251,22 +1249,22 @@ gtk_paned_size_allocate (GtkWidget *widget,
|
|||||||
priv->child1_size,
|
priv->child1_size,
|
||||||
0,
|
0,
|
||||||
handle_size,
|
handle_size,
|
||||||
allocation->height
|
height
|
||||||
};
|
};
|
||||||
|
|
||||||
child1_allocation.height = child2_allocation.height = allocation->height;
|
child1_allocation.height = child2_allocation.height = height;
|
||||||
child1_allocation.width = MAX (1, priv->child1_size);
|
child1_allocation.width = MAX (1, priv->child1_size);
|
||||||
child1_allocation.x = 0;
|
child1_allocation.x = 0;
|
||||||
child1_allocation.y = child2_allocation.y = 0;
|
child1_allocation.y = child2_allocation.y = 0;
|
||||||
|
|
||||||
child2_allocation.x = child1_allocation.x + priv->child1_size + handle_size;
|
child2_allocation.x = child1_allocation.x + priv->child1_size + handle_size;
|
||||||
child2_allocation.width = MAX (1, allocation->width - priv->child1_size - handle_size);
|
child2_allocation.width = MAX (1, width - priv->child1_size - handle_size);
|
||||||
|
|
||||||
if (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL)
|
||||||
{
|
{
|
||||||
flip_child (allocation, &(child2_allocation));
|
flip_child (width, &(child2_allocation));
|
||||||
flip_child (allocation, &(child1_allocation));
|
flip_child (width, &(child1_allocation));
|
||||||
flip_child (allocation, &(handle_allocation));
|
flip_child (width, &(handle_allocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child1_width > child1_allocation.width)
|
if (child1_width > child1_allocation.width)
|
||||||
@@ -1288,31 +1286,31 @@ gtk_paned_size_allocate (GtkWidget *widget,
|
|||||||
gint child1_height, child2_height;
|
gint child1_height, child2_height;
|
||||||
|
|
||||||
gtk_widget_measure (priv->child1, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (priv->child1, GTK_ORIENTATION_VERTICAL,
|
||||||
allocation->width,
|
width,
|
||||||
&child1_height, NULL, NULL, NULL);
|
&child1_height, NULL, NULL, NULL);
|
||||||
gtk_widget_measure (priv->child2, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (priv->child2, GTK_ORIENTATION_VERTICAL,
|
||||||
allocation->width,
|
width,
|
||||||
&child2_height, NULL, NULL, NULL);
|
&child2_height, NULL, NULL, NULL);
|
||||||
|
|
||||||
gtk_paned_calc_position (paned,
|
gtk_paned_calc_position (paned,
|
||||||
MAX (1, allocation->height - handle_size),
|
MAX (1, height - handle_size),
|
||||||
child1_height,
|
child1_height,
|
||||||
child2_height);
|
child2_height);
|
||||||
|
|
||||||
handle_allocation = (GdkRectangle){
|
handle_allocation = (GdkRectangle){
|
||||||
0,
|
0,
|
||||||
priv->child1_size,
|
priv->child1_size,
|
||||||
allocation->width,
|
width,
|
||||||
handle_size,
|
handle_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
child1_allocation.width = child2_allocation.width = allocation->width;
|
child1_allocation.width = child2_allocation.width = width;
|
||||||
child1_allocation.height = MAX (1, priv->child1_size);
|
child1_allocation.height = MAX (1, priv->child1_size);
|
||||||
child1_allocation.x = child2_allocation.x = 0;
|
child1_allocation.x = child2_allocation.x = 0;
|
||||||
child1_allocation.y = 0;
|
child1_allocation.y = 0;
|
||||||
|
|
||||||
child2_allocation.y = child1_allocation.y + priv->child1_size + handle_size;
|
child2_allocation.y = child1_allocation.y + priv->child1_size + handle_size;
|
||||||
child2_allocation.height = MAX (1, allocation->height - child2_allocation.y);
|
child2_allocation.height = MAX (1, height - child2_allocation.y);
|
||||||
|
|
||||||
if (child1_height > child1_allocation.height)
|
if (child1_height > child1_allocation.height)
|
||||||
{
|
{
|
||||||
@@ -1335,14 +1333,17 @@ gtk_paned_size_allocate (GtkWidget *widget,
|
|||||||
gtk_paned_set_child_visible (paned, CHILD1, TRUE);
|
gtk_paned_set_child_visible (paned, CHILD1, TRUE);
|
||||||
gtk_paned_set_child_visible (paned, CHILD2, FALSE);
|
gtk_paned_set_child_visible (paned, CHILD2, FALSE);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->child1, allocation, -1);
|
gtk_widget_size_allocate (priv->child1,
|
||||||
|
&(GtkAllocation) {0, 0, width, height}, -1);
|
||||||
}
|
}
|
||||||
else if (priv->child2 && gtk_widget_get_visible (priv->child2))
|
else if (priv->child2 && gtk_widget_get_visible (priv->child2))
|
||||||
{
|
{
|
||||||
gtk_paned_set_child_visible (paned, CHILD1, FALSE);
|
gtk_paned_set_child_visible (paned, CHILD1, FALSE);
|
||||||
gtk_paned_set_child_visible (paned, CHILD2, TRUE);
|
gtk_paned_set_child_visible (paned, CHILD2, TRUE);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->child2, allocation, -1);
|
gtk_widget_size_allocate (priv->child2,
|
||||||
|
&(GtkAllocation) {0, 0, width, height}, -1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+15
-13
@@ -132,7 +132,8 @@ static void gtk_path_bar_measure (GtkWidget *widget,
|
|||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_path_bar_size_allocate (GtkWidget *widget,
|
static void gtk_path_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static void gtk_path_bar_add (GtkContainer *container,
|
static void gtk_path_bar_add (GtkContainer *container,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
@@ -485,9 +486,10 @@ gtk_path_bar_update_slider_buttons (GtkPathBar *path_bar)
|
|||||||
/* This is a tad complicated
|
/* This is a tad complicated
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gtk_path_bar_size_allocate (GtkWidget *widget,
|
gtk_path_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int widget_width,
|
||||||
int baseline)
|
int widget_height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkPathBar *path_bar = GTK_PATH_BAR (widget);
|
GtkPathBar *path_bar = GTK_PATH_BAR (widget);
|
||||||
GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (path_bar);
|
GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (path_bar);
|
||||||
@@ -507,7 +509,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
direction = gtk_widget_get_direction (widget);
|
direction = gtk_widget_get_direction (widget);
|
||||||
allocation_width = allocation->width;
|
allocation_width = widget_width;
|
||||||
|
|
||||||
/* First, we check to see if we need the scrollbars. */
|
/* First, we check to see if we need the scrollbars. */
|
||||||
if (priv->fake_root)
|
if (priv->fake_root)
|
||||||
@@ -593,21 +595,21 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now, we allocate space to the buttons */
|
/* Now, we allocate space to the buttons */
|
||||||
child_allocation.y = allocation->y;
|
child_allocation.y = 0;
|
||||||
child_allocation.height = allocation->height;
|
child_allocation.height = widget_height;
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
{
|
{
|
||||||
child_allocation.x = allocation->x + allocation->width;
|
child_allocation.x = widget_width;
|
||||||
if (need_sliders || priv->fake_root)
|
if (need_sliders || priv->fake_root)
|
||||||
{
|
{
|
||||||
child_allocation.x -= priv->slider_width;
|
child_allocation.x -= priv->slider_width;
|
||||||
up_slider_offset = allocation->width - priv->slider_width;
|
up_slider_offset = widget_width - priv->slider_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child_allocation.x = allocation->x;
|
child_allocation.x = 0;
|
||||||
if (need_sliders || priv->fake_root)
|
if (need_sliders || priv->fake_root)
|
||||||
{
|
{
|
||||||
up_slider_offset = 0;
|
up_slider_offset = 0;
|
||||||
@@ -659,7 +661,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
{
|
{
|
||||||
down_slider_offset = child_allocation.x - allocation->x - priv->slider_width;
|
down_slider_offset = child_allocation.x - priv->slider_width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -683,7 +685,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
|
|||||||
if (need_sliders || priv->fake_root)
|
if (need_sliders || priv->fake_root)
|
||||||
{
|
{
|
||||||
child_allocation.width = priv->slider_width;
|
child_allocation.width = priv->slider_width;
|
||||||
child_allocation.x = up_slider_offset + allocation->x;
|
child_allocation.x = up_slider_offset;
|
||||||
gtk_widget_size_allocate (priv->up_slider_button,
|
gtk_widget_size_allocate (priv->up_slider_button,
|
||||||
&child_allocation,
|
&child_allocation,
|
||||||
-1);
|
-1);
|
||||||
@@ -702,7 +704,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
|
|||||||
if (need_sliders)
|
if (need_sliders)
|
||||||
{
|
{
|
||||||
child_allocation.width = priv->slider_width;
|
child_allocation.width = priv->slider_width;
|
||||||
child_allocation.x = down_slider_offset + allocation->x;
|
child_allocation.x = down_slider_offset;
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->down_slider_button,
|
gtk_widget_size_allocate (priv->down_slider_button,
|
||||||
&child_allocation,
|
&child_allocation,
|
||||||
|
|||||||
+23
-18
@@ -246,15 +246,20 @@ measure_contents (GtkGizmo *gizmo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
allocate_contents (GtkGizmo *gizmo,
|
allocate_contents (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkPopover *popover = GTK_POPOVER (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
GtkPopover *popover = GTK_POPOVER (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
gtk_widget_size_allocate (child, allocation, -1);
|
gtk_widget_size_allocate (child,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -326,19 +331,17 @@ gesture_released (GtkGestureMultiPress *gesture,
|
|||||||
GtkPopover *popover)
|
GtkPopover *popover)
|
||||||
{
|
{
|
||||||
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
||||||
GtkAllocation child_alloc;
|
graphene_rect_t child_bounds;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
if (!priv->button_pressed)
|
if (!priv->button_pressed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (popover));
|
child = gtk_bin_get_child (GTK_BIN (popover));
|
||||||
gtk_widget_get_allocation (child, &child_alloc);
|
gtk_widget_compute_bounds (child, GTK_WIDGET (popover), &child_bounds);
|
||||||
|
|
||||||
if (x < child_alloc.x ||
|
if (!graphene_rect_contains_point (&child_bounds,
|
||||||
x > child_alloc.x + child_alloc.width ||
|
&(graphene_point_t){x, y}))
|
||||||
y < child_alloc.y ||
|
|
||||||
y > child_alloc.y + child_alloc.height)
|
|
||||||
gtk_popover_popdown (popover);
|
gtk_popover_popdown (popover);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1389,13 +1392,14 @@ gtk_popover_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_popover_size_allocate (GtkWidget *widget,
|
gtk_popover_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkPopover *popover = GTK_POPOVER (widget);
|
GtkPopover *popover = GTK_POPOVER (widget);
|
||||||
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
||||||
GtkAllocation child_alloc = *allocation;
|
GtkAllocation child_alloc = (GtkAllocation) {0, 0, width, height};
|
||||||
|
|
||||||
/* Note that we in measure() we add TAIL_HEIGHT in both directions, regardless
|
/* Note that we in measure() we add TAIL_HEIGHT in both directions, regardless
|
||||||
* of the popovers position. This is to ensure that we get enough space
|
* of the popovers position. This is to ensure that we get enough space
|
||||||
@@ -1781,10 +1785,11 @@ _gtk_popover_parent_unmap (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_popover_parent_size_allocate (GtkWidget *widget,
|
gtk_popover_parent_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline,
|
int height,
|
||||||
GtkPopover *popover)
|
int baseline,
|
||||||
|
GtkPopover *popover)
|
||||||
{
|
{
|
||||||
gtk_popover_update_position (popover);
|
gtk_popover_update_position (popover);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,13 +94,6 @@ void gtk_propagate_event_internal (GtkWidget *widget,
|
|||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
GtkWidget *topmost);
|
GtkWidget *topmost);
|
||||||
|
|
||||||
gboolean gtk_widget_translate_coordinatesf (GtkWidget *src_widget,
|
|
||||||
GtkWidget *dest_widget,
|
|
||||||
double src_x,
|
|
||||||
double src_y,
|
|
||||||
double *dest_x,
|
|
||||||
double *dest_y);
|
|
||||||
|
|
||||||
GtkWidget * _gtk_toplevel_pick (GtkWindow *toplevel,
|
GtkWidget * _gtk_toplevel_pick (GtkWindow *toplevel,
|
||||||
gdouble x,
|
gdouble x,
|
||||||
gdouble y,
|
gdouble y,
|
||||||
|
|||||||
+43
-40
@@ -142,9 +142,10 @@ static void gtk_progress_bar_get_property (GObject *object,
|
|||||||
guint prop_id,
|
guint prop_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_progress_bar_size_allocate (GtkWidget *widget,
|
static void gtk_progress_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
|
|
||||||
static void gtk_progress_bar_act_mode_enter (GtkProgressBar *progress);
|
static void gtk_progress_bar_act_mode_enter (GtkProgressBar *progress);
|
||||||
static void gtk_progress_bar_act_mode_leave (GtkProgressBar *progress);
|
static void gtk_progress_bar_act_mode_leave (GtkProgressBar *progress);
|
||||||
@@ -370,15 +371,16 @@ update_node_classes (GtkProgressBar *pbar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
allocate_trough (GtkGizmo *gizmo,
|
allocate_trough (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
|
|
||||||
{
|
{
|
||||||
GtkProgressBar *pbar = GTK_PROGRESS_BAR (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
GtkProgressBar *pbar = GTK_PROGRESS_BAR (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
|
||||||
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
|
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (pbar);
|
||||||
GtkAllocation alloc;
|
GtkAllocation alloc;
|
||||||
gint width, height;
|
int progress_width, progress_height;
|
||||||
gboolean inverted;
|
gboolean inverted;
|
||||||
|
|
||||||
inverted = priv->inverted;
|
inverted = priv->inverted;
|
||||||
@@ -389,58 +391,58 @@ allocate_trough (GtkGizmo *gizmo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_VERTICAL, -1,
|
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_VERTICAL, -1,
|
||||||
&height, NULL,
|
&progress_height, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
gtk_widget_measure (priv->progress_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
||||||
&width, NULL,
|
&progress_width, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
if (priv->activity_mode)
|
if (priv->activity_mode)
|
||||||
{
|
{
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
alloc.width = width + (allocation->width - width) / priv->activity_blocks;
|
alloc.width = progress_width + (width - progress_width) / priv->activity_blocks;
|
||||||
alloc.x = allocation->x + priv->activity_pos * (allocation->width - alloc.width);
|
alloc.x = priv->activity_pos * (width - alloc.width);
|
||||||
alloc.y = allocation->y + (allocation->height - height) / 2;
|
alloc.y = (height - progress_height) / 2;
|
||||||
alloc.height = height;
|
alloc.height = progress_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
alloc.height = height + (allocation->height - height) / priv->activity_blocks;
|
alloc.height = progress_height + (height - progress_height) / priv->activity_blocks;
|
||||||
alloc.y = allocation->y + priv->activity_pos * (allocation->height - alloc.height);
|
alloc.y = priv->activity_pos * (height - alloc.height);
|
||||||
alloc.x = allocation->x + (allocation->width - width) / 2;
|
alloc.x = (width - progress_width) / 2;
|
||||||
alloc.width = width;
|
alloc.width = progress_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
alloc.width = width + (allocation->width - width) * priv->fraction;
|
alloc.width = progress_width + (width - progress_width) * priv->fraction;
|
||||||
alloc.height = height;
|
alloc.height = progress_height;
|
||||||
alloc.y = allocation->y + (allocation->height - height) / 2;
|
alloc.y = (height - progress_height) / 2;
|
||||||
|
|
||||||
if (!inverted)
|
if (!inverted)
|
||||||
alloc.x = allocation->x;
|
alloc.x = 0;
|
||||||
else
|
else
|
||||||
alloc.x = allocation->x + allocation->width - alloc.width;
|
alloc.x = width - alloc.width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alloc.width = width;
|
alloc.width = progress_width;
|
||||||
alloc.height = height + (allocation->height - height) * priv->fraction;
|
alloc.height = progress_height + (height - progress_height) * priv->fraction;
|
||||||
alloc.x = allocation->x + (allocation->width - width) / 2;
|
alloc.x = (width - progress_width) / 2;
|
||||||
|
|
||||||
if (!inverted)
|
if (!inverted)
|
||||||
alloc.y = allocation->y;
|
alloc.y = 0;
|
||||||
else
|
else
|
||||||
alloc.y = allocation->y + allocation->height - alloc.height;
|
alloc.y = height - alloc.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->progress_widget, &alloc,-1);
|
gtk_widget_size_allocate (priv->progress_widget, &alloc, -1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,9 +618,10 @@ get_current_text (GtkProgressBar *pbar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_progress_bar_size_allocate (GtkWidget *widget,
|
gtk_progress_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (GTK_PROGRESS_BAR (widget));
|
GtkProgressBarPrivate *priv = gtk_progress_bar_get_instance_private (GTK_PROGRESS_BAR (widget));
|
||||||
gint bar_width, bar_height;
|
gint bar_width, bar_height;
|
||||||
@@ -630,18 +633,18 @@ gtk_progress_bar_size_allocate (GtkWidget *widget,
|
|||||||
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_VERTICAL, -1,
|
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_VERTICAL, -1,
|
||||||
&bar_height, NULL,
|
&bar_height, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
bar_width = allocation->width;
|
bar_width = width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
gtk_widget_measure (priv->trough_widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
||||||
&bar_width, NULL,
|
&bar_width, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
bar_height = allocation->height;
|
bar_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc.x = allocation->x + allocation->width - bar_width;
|
alloc.x = width - bar_width;
|
||||||
alloc.y = allocation->y + allocation->height - bar_height;
|
alloc.y = height - bar_height;
|
||||||
alloc.width = bar_width;
|
alloc.width = bar_width;
|
||||||
alloc.height = bar_height;
|
alloc.height = bar_height;
|
||||||
|
|
||||||
@@ -657,19 +660,19 @@ gtk_progress_bar_size_allocate (GtkWidget *widget,
|
|||||||
&text_height, NULL,
|
&text_height, NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
text_width = CLAMP (text_nat, text_min, allocation->width);
|
text_width = CLAMP (text_nat, text_min, width);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
alloc.x = allocation->x + (allocation->width - text_width) / 2;
|
alloc.x = (width - text_width) / 2;
|
||||||
alloc.y = allocation->y;
|
alloc.y = 0;
|
||||||
alloc.width = text_width;
|
alloc.width = text_width;
|
||||||
alloc.height = text_height;
|
alloc.height = text_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alloc.x = allocation->x + allocation->width - text_width;
|
alloc.x = width - text_width;
|
||||||
alloc.y = allocation->y + (allocation->height - text_height) / 2;
|
alloc.y = (height - text_height) / 2;
|
||||||
alloc.width = text_width;
|
alloc.width = text_width;
|
||||||
alloc.height = text_height;
|
alloc.height = text_height;
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-38
@@ -156,9 +156,10 @@ static void gtk_range_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_range_size_allocate (GtkWidget *widget,
|
static void gtk_range_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_range_unmap (GtkWidget *widget);
|
static void gtk_range_unmap (GtkWidget *widget);
|
||||||
|
|
||||||
static void gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
static void gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
||||||
@@ -230,7 +231,8 @@ static void gtk_range_measure_trough (GtkGizmo *gizmo,
|
|||||||
gint *minimum_baseline,
|
gint *minimum_baseline,
|
||||||
gint *natural_baseline);
|
gint *natural_baseline);
|
||||||
static void gtk_range_allocate_trough (GtkGizmo *gizmo,
|
static void gtk_range_allocate_trough (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static gboolean gtk_range_render_trough (GtkGizmo *gizmo,
|
static gboolean gtk_range_render_trough (GtkGizmo *gizmo,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
@@ -1388,9 +1390,10 @@ gtk_range_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_range_allocate_trough (GtkGizmo *gizmo,
|
gtk_range_allocate_trough (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = gtk_widget_get_parent (GTK_WIDGET (gizmo));
|
GtkWidget *widget = gtk_widget_get_parent (GTK_WIDGET (gizmo));
|
||||||
GtkRange *range = GTK_RANGE (widget);
|
GtkRange *range = GTK_RANGE (widget);
|
||||||
@@ -1423,7 +1426,7 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
|
|||||||
double level, fill;
|
double level, fill;
|
||||||
GtkAllocation fill_alloc;
|
GtkAllocation fill_alloc;
|
||||||
|
|
||||||
fill_alloc = *allocation;
|
fill_alloc = (GtkAllocation) {0, 0, width, height};
|
||||||
|
|
||||||
level = CLAMP (priv->fill_level, lower, upper - page_size);
|
level = CLAMP (priv->fill_level, lower, upper - page_size);
|
||||||
|
|
||||||
@@ -1434,14 +1437,14 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
|
|||||||
fill_alloc.width *= fill;
|
fill_alloc.width *= fill;
|
||||||
|
|
||||||
if (should_invert (range))
|
if (should_invert (range))
|
||||||
fill_alloc.x += allocation->width - fill_alloc.width;
|
fill_alloc.x += width - fill_alloc.width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fill_alloc.height *= fill;
|
fill_alloc.height *= fill;
|
||||||
|
|
||||||
if (should_invert (range))
|
if (should_invert (range))
|
||||||
fill_alloc.y += allocation->height - fill_alloc.height;
|
fill_alloc.y += height - fill_alloc.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->fill_widget, &fill_alloc, -1);
|
gtk_widget_size_allocate (priv->fill_widget, &fill_alloc, -1);
|
||||||
@@ -1459,27 +1462,27 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
|
|||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
highlight_alloc.y = allocation->y;
|
highlight_alloc.y = 0;
|
||||||
highlight_alloc.height = allocation->height;
|
highlight_alloc.height = height;
|
||||||
|
|
||||||
if (!should_invert (range))
|
if (!should_invert (range))
|
||||||
highlight_alloc.x = allocation->x;
|
highlight_alloc.x = 0;
|
||||||
else
|
else
|
||||||
highlight_alloc.x = allocation->x + (allocation->width * (1 - value));
|
highlight_alloc.x = (width * (1 - value));
|
||||||
|
|
||||||
highlight_alloc.width = MAX (min, allocation->width * value);
|
highlight_alloc.width = MAX (min, width * value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
highlight_alloc.x = allocation->x;
|
highlight_alloc.x = 0;
|
||||||
highlight_alloc.width = allocation->width;
|
highlight_alloc.width = width;
|
||||||
|
|
||||||
if (!should_invert (range))
|
if (!should_invert (range))
|
||||||
highlight_alloc.y = allocation->y;
|
highlight_alloc.y = 0;
|
||||||
else
|
else
|
||||||
highlight_alloc.y = allocation->y + (allocation->height * (1 - value));
|
highlight_alloc.y = (height * (1 - value));
|
||||||
|
|
||||||
highlight_alloc.height = MAX (min, allocation->height* value);
|
highlight_alloc.height = MAX (min, height * value);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc, -1);
|
gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc, -1);
|
||||||
@@ -1491,16 +1494,17 @@ gtk_range_allocate_trough (GtkGizmo *gizmo,
|
|||||||
* give space to border over dimensions in one direction.
|
* give space to border over dimensions in one direction.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
clamp_dimensions (const GtkAllocation *allocation,
|
clamp_dimensions (int range_width,
|
||||||
int *width,
|
int range_height,
|
||||||
int *height,
|
int *width,
|
||||||
GtkBorder *border,
|
int *height,
|
||||||
gboolean border_expands_horizontally)
|
GtkBorder *border,
|
||||||
|
gboolean border_expands_horizontally)
|
||||||
{
|
{
|
||||||
gint extra, shortage;
|
gint extra, shortage;
|
||||||
|
|
||||||
/* Width */
|
/* Width */
|
||||||
extra = allocation->width - border->left - border->right - *width;
|
extra = range_width - border->left - border->right - *width;
|
||||||
if (extra > 0)
|
if (extra > 0)
|
||||||
{
|
{
|
||||||
if (border_expands_horizontally)
|
if (border_expands_horizontally)
|
||||||
@@ -1515,10 +1519,10 @@ clamp_dimensions (const GtkAllocation *allocation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* See if we can fit rect, if not kill the border */
|
/* See if we can fit rect, if not kill the border */
|
||||||
shortage = *width - allocation->width;
|
shortage = *width - range_width;
|
||||||
if (shortage > 0)
|
if (shortage > 0)
|
||||||
{
|
{
|
||||||
*width = allocation->width;
|
*width = range_width;
|
||||||
/* lose the border */
|
/* lose the border */
|
||||||
border->left = 0;
|
border->left = 0;
|
||||||
border->right = 0;
|
border->right = 0;
|
||||||
@@ -1526,7 +1530,7 @@ clamp_dimensions (const GtkAllocation *allocation,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* See if we can fit rect with borders */
|
/* See if we can fit rect with borders */
|
||||||
shortage = *width + border->left + border->right - allocation->width;
|
shortage = *width + border->left + border->right - range_width;
|
||||||
if (shortage > 0)
|
if (shortage > 0)
|
||||||
{
|
{
|
||||||
/* Shrink borders */
|
/* Shrink borders */
|
||||||
@@ -1536,7 +1540,7 @@ clamp_dimensions (const GtkAllocation *allocation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Height */
|
/* Height */
|
||||||
extra = allocation->height - border->top - border->bottom - *height;
|
extra = range_height - border->top - border->bottom - *height;
|
||||||
if (extra > 0)
|
if (extra > 0)
|
||||||
{
|
{
|
||||||
if (border_expands_horizontally)
|
if (border_expands_horizontally)
|
||||||
@@ -1552,10 +1556,10 @@ clamp_dimensions (const GtkAllocation *allocation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* See if we can fit rect, if not kill the border */
|
/* See if we can fit rect, if not kill the border */
|
||||||
shortage = *height - allocation->height;
|
shortage = *height - range_height;
|
||||||
if (shortage > 0)
|
if (shortage > 0)
|
||||||
{
|
{
|
||||||
*height = allocation->height;
|
*height = range_height;
|
||||||
/* lose the border */
|
/* lose the border */
|
||||||
border->top = 0;
|
border->top = 0;
|
||||||
border->bottom = 0;
|
border->bottom = 0;
|
||||||
@@ -1563,7 +1567,7 @@ clamp_dimensions (const GtkAllocation *allocation,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* See if we can fit rect with borders */
|
/* See if we can fit rect with borders */
|
||||||
shortage = *height + border->top + border->bottom - allocation->height;
|
shortage = *height + border->top + border->bottom - range_height;
|
||||||
if (shortage > 0)
|
if (shortage > 0)
|
||||||
{
|
{
|
||||||
/* Shrink borders */
|
/* Shrink borders */
|
||||||
@@ -1574,9 +1578,10 @@ clamp_dimensions (const GtkAllocation *allocation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_range_size_allocate (GtkWidget *widget,
|
gtk_range_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkRange *range = GTK_RANGE (widget);
|
GtkRange *range = GTK_RANGE (widget);
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
@@ -1597,9 +1602,9 @@ gtk_range_size_allocate (GtkWidget *widget,
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
clamp_dimensions (allocation, &box_min_width, &box_min_height, &border, TRUE);
|
clamp_dimensions (width, height, &box_min_width, &box_min_height, &border, TRUE);
|
||||||
else
|
else
|
||||||
clamp_dimensions (allocation, &box_min_width, &box_min_height, &border, FALSE);
|
clamp_dimensions (width, height, &box_min_width, &box_min_height, &border, FALSE);
|
||||||
|
|
||||||
box_alloc.x = border.left;
|
box_alloc.x = border.left;
|
||||||
box_alloc.y = border.top;
|
box_alloc.y = border.top;
|
||||||
|
|||||||
+13
-13
@@ -97,9 +97,10 @@ static GParamSpec *props[LAST_PROP] = { NULL, };
|
|||||||
|
|
||||||
static void gtk_revealer_real_add (GtkContainer *widget,
|
static void gtk_revealer_real_add (GtkContainer *widget,
|
||||||
GtkWidget *child);
|
GtkWidget *child);
|
||||||
static void gtk_revealer_real_size_allocate (GtkWidget *widget,
|
static void gtk_revealer_real_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_revealer_measure (GtkWidget *widget,
|
static void gtk_revealer_measure (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
int for_size,
|
int for_size,
|
||||||
@@ -337,9 +338,10 @@ get_child_size_scale (GtkRevealer *revealer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_revealer_real_size_allocate (GtkWidget *widget,
|
gtk_revealer_real_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkRevealer *revealer = GTK_REVEALER (widget);
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
@@ -347,11 +349,9 @@ gtk_revealer_real_size_allocate (GtkWidget *widget,
|
|||||||
child = gtk_bin_get_child (GTK_BIN (revealer));
|
child = gtk_bin_get_child (GTK_BIN (revealer));
|
||||||
if (child != NULL && gtk_widget_get_visible (child))
|
if (child != NULL && gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation = {0, 0, width, height};
|
||||||
double hscale, vscale;
|
double hscale, vscale;
|
||||||
|
|
||||||
child_allocation = *allocation;
|
|
||||||
|
|
||||||
hscale = get_child_size_scale (revealer, GTK_ORIENTATION_HORIZONTAL);
|
hscale = get_child_size_scale (revealer, GTK_ORIENTATION_HORIZONTAL);
|
||||||
vscale = get_child_size_scale (revealer, GTK_ORIENTATION_VERTICAL);
|
vscale = get_child_size_scale (revealer, GTK_ORIENTATION_VERTICAL);
|
||||||
|
|
||||||
@@ -364,15 +364,15 @@ gtk_revealer_real_size_allocate (GtkWidget *widget,
|
|||||||
else if (hscale < 1.0)
|
else if (hscale < 1.0)
|
||||||
{
|
{
|
||||||
g_assert (vscale == 1.0);
|
g_assert (vscale == 1.0);
|
||||||
child_allocation.width = MIN (G_MAXINT, ceil (child_allocation.width / hscale));
|
child_allocation.width = MIN (G_MAXINT, ceil (width / hscale));
|
||||||
if (effective_transition (revealer) == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
if (effective_transition (revealer) == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
||||||
child_allocation.x = allocation->width - child_allocation.width;
|
child_allocation.x = width - child_allocation.width;
|
||||||
}
|
}
|
||||||
else if (vscale < 1.0)
|
else if (vscale < 1.0)
|
||||||
{
|
{
|
||||||
child_allocation.height = MIN (G_MAXINT, ceil (child_allocation.height / vscale));
|
child_allocation.height = MIN (G_MAXINT, ceil (height / vscale));
|
||||||
if (effective_transition (revealer) == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
|
if (effective_transition (revealer) == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
|
||||||
child_allocation.y = allocation->height - child_allocation.height;
|
child_allocation.y = height - child_allocation.height;
|
||||||
}
|
}
|
||||||
gtk_widget_size_allocate (child, &child_allocation, -1);
|
gtk_widget_size_allocate (child, &child_allocation, -1);
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-23
@@ -409,9 +409,10 @@ gtk_scale_allocate_value (GtkScale *scale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (gizmo);
|
GtkWidget *widget = GTK_WIDGET (gizmo);
|
||||||
GtkScale *scale = GTK_SCALE (gtk_widget_get_parent (gtk_widget_get_parent (widget)));
|
GtkScale *scale = GTK_SCALE (gtk_widget_get_parent (gtk_widget_get_parent (widget)));
|
||||||
@@ -432,21 +433,22 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
|||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
indicator_alloc.x = (allocation->width - indicator_width) / 2;
|
indicator_alloc.x = (width - indicator_width) / 2;
|
||||||
if (mark->position == GTK_POS_TOP)
|
if (mark->position == GTK_POS_TOP)
|
||||||
indicator_alloc.y = allocation->y + allocation->height - indicator_height;
|
indicator_alloc.y = height - indicator_height;
|
||||||
else
|
else
|
||||||
indicator_alloc.y = allocation->y;
|
indicator_alloc.y = 0;
|
||||||
|
|
||||||
indicator_alloc.width = indicator_width;
|
indicator_alloc.width = indicator_width;
|
||||||
indicator_alloc.height = indicator_height;
|
indicator_alloc.height = indicator_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mark->position == GTK_POS_TOP)
|
if (mark->position == GTK_POS_TOP)
|
||||||
indicator_alloc.x = allocation->x + allocation->width - indicator_width;
|
indicator_alloc.x = width - indicator_width;
|
||||||
else
|
else
|
||||||
indicator_alloc.x = allocation->x;
|
indicator_alloc.x = 0;
|
||||||
indicator_alloc.y = (allocation->height - indicator_height) / 2;
|
indicator_alloc.y = (height - indicator_height) / 2;
|
||||||
indicator_alloc.width = indicator_width;
|
indicator_alloc.width = indicator_width;
|
||||||
indicator_alloc.height = indicator_height;
|
indicator_alloc.height = indicator_height;
|
||||||
}
|
}
|
||||||
@@ -457,17 +459,17 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
|||||||
{
|
{
|
||||||
GtkAllocation label_alloc;
|
GtkAllocation label_alloc;
|
||||||
|
|
||||||
label_alloc = *allocation;
|
label_alloc = (GtkAllocation) {0, 0, width, height};
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
label_alloc.height = allocation->height - indicator_alloc.height;
|
label_alloc.height = height - indicator_alloc.height;
|
||||||
if (mark->position == GTK_POS_BOTTOM)
|
if (mark->position == GTK_POS_BOTTOM)
|
||||||
label_alloc.y = indicator_alloc.y + indicator_alloc.height;
|
label_alloc.y = indicator_alloc.y + indicator_alloc.height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label_alloc.width = allocation->width - indicator_alloc.width;
|
label_alloc.width = width - indicator_alloc.width;
|
||||||
if (mark->position == GTK_POS_BOTTOM)
|
if (mark->position == GTK_POS_BOTTOM)
|
||||||
label_alloc.x = indicator_alloc.x + indicator_alloc.width;
|
label_alloc.x = indicator_alloc.x + indicator_alloc.width;
|
||||||
}
|
}
|
||||||
@@ -477,9 +479,10 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (gizmo);
|
GtkWidget *widget = GTK_WIDGET (gizmo);
|
||||||
GtkScale *scale = GTK_SCALE (gtk_widget_get_parent (widget));
|
GtkScale *scale = GTK_SCALE (gtk_widget_get_parent (widget));
|
||||||
@@ -511,17 +514,17 @@ gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
|||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
mark_alloc.x = mark->stop_position;
|
mark_alloc.x = mark->stop_position;
|
||||||
mark_alloc.y = allocation->y;
|
mark_alloc.y = 0;
|
||||||
mark_alloc.width = mark_size;
|
mark_alloc.width = mark_size;
|
||||||
mark_alloc.height = allocation->height;
|
mark_alloc.height = height;
|
||||||
|
|
||||||
mark_alloc.x -= mark_size / 2;
|
mark_alloc.x -= mark_size / 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mark_alloc.x = allocation->x;
|
mark_alloc.x = 0;
|
||||||
mark_alloc.y = mark->stop_position;
|
mark_alloc.y = mark->stop_position;
|
||||||
mark_alloc.width = allocation->width;
|
mark_alloc.width = width;
|
||||||
mark_alloc.height = mark_size;
|
mark_alloc.height = mark_size;
|
||||||
|
|
||||||
mark_alloc.y -= mark_size / 2;
|
mark_alloc.y -= mark_size / 2;
|
||||||
@@ -534,16 +537,17 @@ gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scale_size_allocate (GtkWidget *widget,
|
gtk_scale_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkScale *scale = GTK_SCALE (widget);
|
GtkScale *scale = GTK_SCALE (widget);
|
||||||
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
||||||
GtkAllocation range_rect, marks_rect;
|
GtkAllocation range_rect, marks_rect;
|
||||||
GtkOrientation orientation;
|
GtkOrientation orientation;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation, baseline);
|
GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, width, height, baseline);
|
||||||
|
|
||||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||||
gtk_range_get_range_rect (GTK_RANGE (scale), &range_rect);
|
gtk_range_get_range_rect (GTK_RANGE (scale), &range_rect);
|
||||||
|
|||||||
+9
-4
@@ -120,14 +120,19 @@ gtk_scrollbar_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scrollbar_size_allocate (GtkWidget *widget,
|
gtk_scrollbar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkScrollbar *self = GTK_SCROLLBAR (widget);
|
GtkScrollbar *self = GTK_SCROLLBAR (widget);
|
||||||
GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
|
GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->box, allocation, -1);
|
gtk_widget_size_allocate (priv->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+31
-35
@@ -327,9 +327,10 @@ static void gtk_scrolled_window_get_property (GObject *objec
|
|||||||
static void gtk_scrolled_window_destroy (GtkWidget *widget);
|
static void gtk_scrolled_window_destroy (GtkWidget *widget);
|
||||||
static void gtk_scrolled_window_snapshot (GtkWidget *widget,
|
static void gtk_scrolled_window_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static gboolean gtk_scrolled_window_focus (GtkWidget *widget,
|
static gboolean gtk_scrolled_window_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
static void gtk_scrolled_window_add (GtkContainer *container,
|
static void gtk_scrolled_window_add (GtkContainer *container,
|
||||||
@@ -350,7 +351,8 @@ static void gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrol
|
|||||||
GtkWidget *scrollbar,
|
GtkWidget *scrollbar,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static void gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
|
static void gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
|
||||||
const GtkAllocation *content_allocation);
|
int width,
|
||||||
|
int height);
|
||||||
static void gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
|
static void gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void gtk_scrolled_window_adjustment_value_changed (GtkAdjustment *adjustment,
|
static void gtk_scrolled_window_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||||
@@ -1397,9 +1399,10 @@ gtk_scrolled_window_update_scrollbar_visibility_flags (GtkScrolledWindow *scroll
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
||||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||||
@@ -1457,41 +1460,38 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|||||||
* given the extra width of the scrollbar */
|
* given the extra width of the scrollbar */
|
||||||
if (vscroll_policy == GTK_SCROLL_MINIMUM)
|
if (vscroll_policy == GTK_SCROLL_MINIMUM)
|
||||||
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
|
||||||
MAX (allocation->width, child_scroll_width),
|
MAX (width, child_scroll_width),
|
||||||
&child_scroll_height, NULL, NULL, NULL);
|
&child_scroll_height, NULL, NULL, NULL);
|
||||||
else
|
else
|
||||||
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
|
||||||
MAX (allocation->width, child_scroll_width),
|
MAX (width, child_scroll_width),
|
||||||
NULL, &child_scroll_height, NULL, NULL);
|
NULL, &child_scroll_height, NULL, NULL);
|
||||||
|
|
||||||
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||||
{
|
{
|
||||||
/* Does the content height fit the allocation height ? */
|
/* Does the content height fit the allocation height ? */
|
||||||
priv->vscrollbar_visible = child_scroll_height > allocation->height;
|
priv->vscrollbar_visible = child_scroll_height > height;
|
||||||
|
|
||||||
/* Does the content width fit the allocation with minus a possible scrollbar ? */
|
/* Does the content width fit the allocation with minus a possible scrollbar ? */
|
||||||
priv->hscrollbar_visible =
|
priv->hscrollbar_visible = child_scroll_width > width -
|
||||||
child_scroll_width > allocation->width -
|
|
||||||
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
||||||
|
|
||||||
/* Now that we've guessed the hscrollbar, does the content height fit
|
/* Now that we've guessed the hscrollbar, does the content height fit
|
||||||
* the possible new allocation height ?
|
* the possible new allocation height ?
|
||||||
*/
|
*/
|
||||||
priv->vscrollbar_visible =
|
priv->vscrollbar_visible = child_scroll_height > height -
|
||||||
child_scroll_height > allocation->height -
|
|
||||||
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
||||||
|
|
||||||
/* Now that we've guessed the vscrollbar, does the content width fit
|
/* Now that we've guessed the vscrollbar, does the content width fit
|
||||||
* the possible new allocation width ?
|
* the possible new allocation width ?
|
||||||
*/
|
*/
|
||||||
priv->hscrollbar_visible =
|
priv->hscrollbar_visible = child_scroll_width > width -
|
||||||
child_scroll_width > allocation->width -
|
|
||||||
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
||||||
}
|
}
|
||||||
else /* priv->hscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
else /* priv->hscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
||||||
{
|
{
|
||||||
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
||||||
priv->vscrollbar_visible = child_scroll_height > allocation->height -
|
priv->vscrollbar_visible = child_scroll_height > height -
|
||||||
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1500,8 +1500,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|||||||
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
||||||
|
|
||||||
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||||
priv->hscrollbar_visible =
|
priv->hscrollbar_visible = child_scroll_width > width -
|
||||||
child_scroll_width > allocation->width -
|
|
||||||
(priv->vscrollbar_visible && !priv->use_indicators ? 0 : sb_width);
|
(priv->vscrollbar_visible && !priv->use_indicators ? 0 : sb_width);
|
||||||
else
|
else
|
||||||
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
||||||
@@ -1522,41 +1521,38 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|||||||
* given the extra height of the scrollbar */
|
* given the extra height of the scrollbar */
|
||||||
if (hscroll_policy == GTK_SCROLL_MINIMUM)
|
if (hscroll_policy == GTK_SCROLL_MINIMUM)
|
||||||
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
|
||||||
MAX (allocation->height, child_scroll_height),
|
MAX (height, child_scroll_height),
|
||||||
&child_scroll_width, NULL, NULL, NULL);
|
&child_scroll_width, NULL, NULL, NULL);
|
||||||
else
|
else
|
||||||
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
|
||||||
MAX (allocation->height, child_scroll_height),
|
MAX (height, child_scroll_height),
|
||||||
NULL, &child_scroll_width, NULL, NULL);
|
NULL, &child_scroll_width, NULL, NULL);
|
||||||
|
|
||||||
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||||
{
|
{
|
||||||
/* Does the content width fit the allocation width ? */
|
/* Does the content width fit the allocation width ? */
|
||||||
priv->hscrollbar_visible = child_scroll_width > allocation->width;
|
priv->hscrollbar_visible = child_scroll_width > width;
|
||||||
|
|
||||||
/* Does the content height fit the allocation with minus a possible scrollbar ? */
|
/* Does the content height fit the allocation with minus a possible scrollbar ? */
|
||||||
priv->vscrollbar_visible =
|
priv->vscrollbar_visible = child_scroll_height > height -
|
||||||
child_scroll_height > allocation->height -
|
|
||||||
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
||||||
|
|
||||||
/* Now that we've guessed the vscrollbar, does the content width fit
|
/* Now that we've guessed the vscrollbar, does the content width fit
|
||||||
* the possible new allocation width ?
|
* the possible new allocation width ?
|
||||||
*/
|
*/
|
||||||
priv->hscrollbar_visible =
|
priv->hscrollbar_visible = child_scroll_width > width -
|
||||||
child_scroll_width > allocation->width -
|
|
||||||
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
||||||
|
|
||||||
/* Now that we've guessed the hscrollbar, does the content height fit
|
/* Now that we've guessed the hscrollbar, does the content height fit
|
||||||
* the possible new allocation height ?
|
* the possible new allocation height ?
|
||||||
*/
|
*/
|
||||||
priv->vscrollbar_visible =
|
priv->vscrollbar_visible = child_scroll_height > height -
|
||||||
child_scroll_height > allocation->height -
|
|
||||||
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
||||||
}
|
}
|
||||||
else /* priv->vscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
else /* priv->vscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
||||||
{
|
{
|
||||||
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
||||||
priv->hscrollbar_visible = child_scroll_width > allocation->width -
|
priv->hscrollbar_visible = child_scroll_width > width -
|
||||||
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1565,8 +1561,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|||||||
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
||||||
|
|
||||||
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||||
priv->vscrollbar_visible =
|
priv->vscrollbar_visible = child_scroll_height > height -
|
||||||
child_scroll_height > allocation->height -
|
|
||||||
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
||||||
else
|
else
|
||||||
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
||||||
@@ -1582,7 +1577,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|||||||
previous_hvis = priv->hscrollbar_visible;
|
previous_hvis = priv->hscrollbar_visible;
|
||||||
previous_vvis = priv->vscrollbar_visible;
|
previous_vvis = priv->vscrollbar_visible;
|
||||||
|
|
||||||
gtk_scrolled_window_allocate_child (scrolled_window, allocation);
|
gtk_scrolled_window_allocate_child (scrolled_window, width, height);
|
||||||
|
|
||||||
/* Explicitly force scrollbar visibility checks.
|
/* Explicitly force scrollbar visibility checks.
|
||||||
*
|
*
|
||||||
@@ -1609,7 +1604,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|||||||
priv->hscrollbar_visible = TRUE;
|
priv->hscrollbar_visible = TRUE;
|
||||||
priv->vscrollbar_visible = TRUE;
|
priv->vscrollbar_visible = TRUE;
|
||||||
|
|
||||||
gtk_scrolled_window_allocate_child (scrolled_window, allocation);
|
gtk_scrolled_window_allocate_child (scrolled_window, width, height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3040,7 +3035,8 @@ _gtk_scrolled_window_get_overshoot (GtkScrolledWindow *scrolled_window,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
|
gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
|
||||||
const GtkAllocation *content_allocation)
|
int width,
|
||||||
|
int height)
|
||||||
{
|
{
|
||||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (swindow);
|
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (swindow);
|
||||||
GtkWidget *widget = GTK_WIDGET (swindow), *child;
|
GtkWidget *widget = GTK_WIDGET (swindow), *child;
|
||||||
@@ -3050,7 +3046,7 @@ gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
|
|||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
|
|
||||||
child_allocation = *content_allocation;
|
child_allocation = (GtkAllocation) {0, 0, width, height};
|
||||||
|
|
||||||
/* Get possible scrollbar dimensions */
|
/* Get possible scrollbar dimensions */
|
||||||
gtk_widget_measure (priv->vscrollbar, GTK_ORIENTATION_HORIZONTAL, -1,
|
gtk_widget_measure (priv->vscrollbar, GTK_ORIENTATION_HORIZONTAL, -1,
|
||||||
|
|||||||
+9
-4
@@ -392,14 +392,19 @@ gtk_search_bar_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_search_bar_size_allocate (GtkWidget *widget,
|
gtk_search_bar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkSearchBar *bar = GTK_SEARCH_BAR (widget);
|
GtkSearchBar *bar = GTK_SEARCH_BAR (widget);
|
||||||
GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
|
GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->revealer, allocation, baseline);
|
gtk_widget_size_allocate (priv->revealer,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -517,13 +517,18 @@ gtk_shortcuts_shortcut_snapshot (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
|
gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation, baseline);
|
GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, width, height, baseline);
|
||||||
|
|
||||||
gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box), allocation, -1);
|
gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box),
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+87
-2
@@ -120,6 +120,92 @@ get_box_padding (GtkCssStyle *style,
|
|||||||
border->right = get_number (style, GTK_CSS_PROPERTY_PADDING_RIGHT);
|
border->right = get_number (style, GTK_CSS_PROPERTY_PADDING_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* translate initial/final into start/end */
|
||||||
|
static GtkAlign
|
||||||
|
effective_align (GtkAlign align,
|
||||||
|
GtkTextDirection direction)
|
||||||
|
{
|
||||||
|
switch (align)
|
||||||
|
{
|
||||||
|
case GTK_ALIGN_START:
|
||||||
|
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_END : GTK_ALIGN_START;
|
||||||
|
case GTK_ALIGN_END:
|
||||||
|
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END;
|
||||||
|
case GTK_ALIGN_FILL:
|
||||||
|
case GTK_ALIGN_CENTER:
|
||||||
|
case GTK_ALIGN_BASELINE:
|
||||||
|
default:
|
||||||
|
return align;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
adjust_for_align (GtkAlign align,
|
||||||
|
gint *natural_size,
|
||||||
|
gint *allocated_size)
|
||||||
|
{
|
||||||
|
switch (align)
|
||||||
|
{
|
||||||
|
case GTK_ALIGN_BASELINE:
|
||||||
|
case GTK_ALIGN_FILL:
|
||||||
|
default:
|
||||||
|
/* change nothing */
|
||||||
|
break;
|
||||||
|
case GTK_ALIGN_START:
|
||||||
|
*allocated_size = MIN (*allocated_size, *natural_size);
|
||||||
|
break;
|
||||||
|
case GTK_ALIGN_END:
|
||||||
|
if (*allocated_size > *natural_size)
|
||||||
|
*allocated_size = *natural_size;
|
||||||
|
break;
|
||||||
|
case GTK_ALIGN_CENTER:
|
||||||
|
if (*allocated_size > *natural_size)
|
||||||
|
*allocated_size = MIN (*allocated_size, *natural_size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
adjust_for_margin(gint start_margin,
|
||||||
|
gint end_margin,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size,
|
||||||
|
gint *allocated_size)
|
||||||
|
{
|
||||||
|
*minimum_size -= (start_margin + end_margin);
|
||||||
|
*natural_size -= (start_margin + end_margin);
|
||||||
|
*allocated_size -= (start_margin + end_margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_widget_adjust_size_allocation (GtkWidget *widget,
|
||||||
|
GtkOrientation orientation,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size,
|
||||||
|
gint *allocated_size)
|
||||||
|
{
|
||||||
|
GtkWidgetPrivate *priv = widget->priv;
|
||||||
|
|
||||||
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
{
|
||||||
|
adjust_for_margin (priv->margin.left,
|
||||||
|
priv->margin.right,
|
||||||
|
minimum_size, natural_size,
|
||||||
|
allocated_size);
|
||||||
|
adjust_for_align (effective_align (priv->halign, _gtk_widget_get_direction (widget)),
|
||||||
|
natural_size, allocated_size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
adjust_for_margin (priv->margin.top,
|
||||||
|
priv->margin.bottom,
|
||||||
|
minimum_size, natural_size,
|
||||||
|
allocated_size);
|
||||||
|
adjust_for_align (effective_align (priv->valign, GTK_TEXT_DIR_NONE),
|
||||||
|
natural_size, allocated_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
@@ -199,7 +285,6 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
int adjusted_for_size;
|
int adjusted_for_size;
|
||||||
int minimum_for_size = 0;
|
int minimum_for_size = 0;
|
||||||
int natural_for_size = 0;
|
int natural_for_size = 0;
|
||||||
int dummy = 0;
|
|
||||||
|
|
||||||
/* Pull the minimum for_size from the cache as it's needed to adjust
|
/* Pull the minimum for_size from the cache as it's needed to adjust
|
||||||
* the proposed 'for_size' */
|
* the proposed 'for_size' */
|
||||||
@@ -213,7 +298,7 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
adjusted_for_size = for_size;
|
adjusted_for_size = for_size;
|
||||||
gtk_widget_adjust_size_allocation (widget, OPPOSITE_ORIENTATION (orientation),
|
gtk_widget_adjust_size_allocation (widget, OPPOSITE_ORIENTATION (orientation),
|
||||||
&for_size, &natural_for_size,
|
&for_size, &natural_for_size,
|
||||||
&dummy, &adjusted_for_size);
|
&adjusted_for_size);
|
||||||
|
|
||||||
adjusted_for_size -= css_extra_for_size;
|
adjusted_for_size -= css_extra_for_size;
|
||||||
|
|
||||||
|
|||||||
+14
-7
@@ -258,9 +258,10 @@ static void gtk_spin_button_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_spin_button_size_allocate (GtkWidget *widget,
|
static void gtk_spin_button_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_spin_button_grab_notify (GtkWidget *widget,
|
static void gtk_spin_button_grab_notify (GtkWidget *widget,
|
||||||
gboolean was_grabbed);
|
gboolean was_grabbed);
|
||||||
static void gtk_spin_button_state_flags_changed (GtkWidget *widget,
|
static void gtk_spin_button_state_flags_changed (GtkWidget *widget,
|
||||||
@@ -1091,13 +1092,19 @@ gtk_spin_button_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_spin_button_size_allocate (GtkWidget *widget,
|
gtk_spin_button_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (GTK_SPIN_BUTTON (widget));
|
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (GTK_SPIN_BUTTON (widget));
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->box, allocation, baseline);
|
gtk_widget_size_allocate (priv->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
},
|
||||||
|
baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+19
-17
@@ -168,9 +168,10 @@ static void gtk_stack_forall (GtkContainer *contain
|
|||||||
static void gtk_stack_compute_expand (GtkWidget *widget,
|
static void gtk_stack_compute_expand (GtkWidget *widget,
|
||||||
gboolean *hexpand,
|
gboolean *hexpand,
|
||||||
gboolean *vexpand);
|
gboolean *vexpand);
|
||||||
static void gtk_stack_size_allocate (GtkWidget *widget,
|
static void gtk_stack_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_stack_snapshot (GtkWidget *widget,
|
static void gtk_stack_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_stack_measure (GtkWidget *widget,
|
static void gtk_stack_measure (GtkWidget *widget,
|
||||||
@@ -2001,9 +2002,10 @@ gtk_stack_snapshot (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_stack_size_allocate (GtkWidget *widget,
|
gtk_stack_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkStack *stack = GTK_STACK (widget);
|
GtkStack *stack = GTK_STACK (widget);
|
||||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||||
@@ -2019,11 +2021,11 @@ gtk_stack_size_allocate (GtkWidget *widget,
|
|||||||
gtk_widget_measure (priv->last_visible_child->widget, GTK_ORIENTATION_HORIZONTAL,
|
gtk_widget_measure (priv->last_visible_child->widget, GTK_ORIENTATION_HORIZONTAL,
|
||||||
-1,
|
-1,
|
||||||
&min, &nat, NULL, NULL);
|
&min, &nat, NULL, NULL);
|
||||||
child_allocation.width = MAX (min, allocation->width);
|
child_allocation.width = MAX (min, width);
|
||||||
gtk_widget_measure (priv->last_visible_child->widget, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (priv->last_visible_child->widget, GTK_ORIENTATION_VERTICAL,
|
||||||
child_allocation.width,
|
child_allocation.width,
|
||||||
&min, &nat, NULL, NULL);
|
&min, &nat, NULL, NULL);
|
||||||
child_allocation.height = MAX (min, allocation->height);
|
child_allocation.height = MAX (min, height);
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation, -1);
|
gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation, -1);
|
||||||
|
|
||||||
@@ -2034,8 +2036,8 @@ gtk_stack_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
child_allocation.width = allocation->width;
|
child_allocation.width = width;
|
||||||
child_allocation.height = allocation->height;
|
child_allocation.height = height;
|
||||||
|
|
||||||
if (priv->visible_child)
|
if (priv->visible_child)
|
||||||
{
|
{
|
||||||
@@ -2043,31 +2045,31 @@ gtk_stack_size_allocate (GtkWidget *widget,
|
|||||||
int min_height;
|
int min_height;
|
||||||
|
|
||||||
gtk_widget_measure (priv->visible_child->widget, GTK_ORIENTATION_HORIZONTAL,
|
gtk_widget_measure (priv->visible_child->widget, GTK_ORIENTATION_HORIZONTAL,
|
||||||
allocation->height, &min_width, NULL, NULL, NULL);
|
height, &min_width, NULL, NULL, NULL);
|
||||||
child_allocation.width = MAX (child_allocation.width, min_width);
|
child_allocation.width = MAX (child_allocation.width, min_width);
|
||||||
|
|
||||||
gtk_widget_measure (priv->visible_child->widget, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (priv->visible_child->widget, GTK_ORIENTATION_VERTICAL,
|
||||||
child_allocation.width, &min_height, NULL, NULL, NULL);
|
child_allocation.width, &min_height, NULL, NULL, NULL);
|
||||||
child_allocation.height = MAX (child_allocation.height, min_height);
|
child_allocation.height = MAX (child_allocation.height, min_height);
|
||||||
|
|
||||||
if (child_allocation.width > allocation->width)
|
if (child_allocation.width > width)
|
||||||
{
|
{
|
||||||
GtkAlign halign = gtk_widget_get_halign (priv->visible_child->widget);
|
GtkAlign halign = gtk_widget_get_halign (priv->visible_child->widget);
|
||||||
|
|
||||||
if (halign == GTK_ALIGN_CENTER || halign == GTK_ALIGN_FILL)
|
if (halign == GTK_ALIGN_CENTER || halign == GTK_ALIGN_FILL)
|
||||||
child_allocation.x = (allocation->width - child_allocation.width) / 2;
|
child_allocation.x = (width - child_allocation.width) / 2;
|
||||||
else if (halign == GTK_ALIGN_END)
|
else if (halign == GTK_ALIGN_END)
|
||||||
child_allocation.x = (allocation->width - child_allocation.width);
|
child_allocation.x = (width - child_allocation.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child_allocation.height > allocation->height)
|
if (child_allocation.height > height)
|
||||||
{
|
{
|
||||||
GtkAlign valign = gtk_widget_get_valign (priv->visible_child->widget);
|
GtkAlign valign = gtk_widget_get_valign (priv->visible_child->widget);
|
||||||
|
|
||||||
if (valign == GTK_ALIGN_CENTER || valign == GTK_ALIGN_FILL)
|
if (valign == GTK_ALIGN_CENTER || valign == GTK_ALIGN_FILL)
|
||||||
child_allocation.y = (allocation->height - child_allocation.height) / 2;
|
child_allocation.y = (height - child_allocation.height) / 2;
|
||||||
else if (valign == GTK_ALIGN_END)
|
else if (valign == GTK_ALIGN_END)
|
||||||
child_allocation.y = (allocation->height - child_allocation.height);
|
child_allocation.y = (height - child_allocation.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation, -1);
|
gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation, -1);
|
||||||
|
|||||||
+9
-4
@@ -147,13 +147,18 @@ gtk_statusbar_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_statusbar_size_allocate (GtkWidget *widget,
|
gtk_statusbar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkStatusbarPrivate *priv = gtk_statusbar_get_instance_private (GTK_STATUSBAR (widget));
|
GtkStatusbarPrivate *priv = gtk_statusbar_get_instance_private (GTK_STATUSBAR (widget));
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->frame, allocation, baseline);
|
gtk_widget_size_allocate (priv->frame,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+11
-10
@@ -316,9 +316,10 @@ gtk_switch_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_switch_size_allocate (GtkWidget *widget,
|
gtk_switch_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkSwitch *self = GTK_SWITCH (widget);
|
GtkSwitch *self = GTK_SWITCH (widget);
|
||||||
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
|
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
|
||||||
@@ -326,29 +327,29 @@ gtk_switch_size_allocate (GtkWidget *widget,
|
|||||||
GtkAllocation slider_alloc;
|
GtkAllocation slider_alloc;
|
||||||
int min;
|
int min;
|
||||||
|
|
||||||
slider_alloc.x = round (priv->handle_pos * (allocation->width / 2));
|
slider_alloc.x = round (priv->handle_pos * (width / 2));
|
||||||
slider_alloc.y = 0;
|
slider_alloc.y = 0;
|
||||||
slider_alloc.width = allocation->width / 2;
|
slider_alloc.width = width / 2;
|
||||||
slider_alloc.height = allocation->height;
|
slider_alloc.height = height;
|
||||||
|
|
||||||
gtk_widget_size_allocate (priv->slider, &slider_alloc, -1);
|
gtk_widget_size_allocate (priv->slider, &slider_alloc, -1);
|
||||||
|
|
||||||
|
|
||||||
/* Center ON label in left half */
|
/* Center ON label in left half */
|
||||||
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
|
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
|
||||||
child_alloc.x = ((allocation->width / 2) - min) / 2;
|
child_alloc.x = ((width / 2) - min) / 2;
|
||||||
child_alloc.width = min;
|
child_alloc.width = min;
|
||||||
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
|
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
|
||||||
child_alloc.y = (allocation->height - min) / 2;
|
child_alloc.y = (height - min) / 2;
|
||||||
child_alloc.height = min;
|
child_alloc.height = min;
|
||||||
gtk_widget_size_allocate (priv->on_label, &child_alloc, -1);
|
gtk_widget_size_allocate (priv->on_label, &child_alloc, -1);
|
||||||
|
|
||||||
/* Center OFF label in right half */
|
/* Center OFF label in right half */
|
||||||
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
|
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
|
||||||
child_alloc.x = (allocation->width / 2) + ((allocation->width / 2) - min) / 2;
|
child_alloc.x = (width / 2) + ((width / 2) - min) / 2;
|
||||||
child_alloc.width = min;
|
child_alloc.width = min;
|
||||||
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
|
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
|
||||||
child_alloc.y = (allocation->height - min) / 2;
|
child_alloc.y = (height - min) / 2;
|
||||||
child_alloc.height = min;
|
child_alloc.height = min;
|
||||||
gtk_widget_size_allocate (priv->off_label, &child_alloc, -1);
|
gtk_widget_size_allocate (priv->off_label, &child_alloc, -1);
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-6
@@ -366,7 +366,8 @@ static void gtk_text_view_measure (GtkWidget *widget,
|
|||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_text_view_size_allocate (GtkWidget *widget,
|
static void gtk_text_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static void gtk_text_view_realize (GtkWidget *widget);
|
static void gtk_text_view_realize (GtkWidget *widget);
|
||||||
static void gtk_text_view_unrealize (GtkWidget *widget);
|
static void gtk_text_view_unrealize (GtkWidget *widget);
|
||||||
@@ -4082,9 +4083,10 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_view_size_allocate (GtkWidget *widget,
|
gtk_text_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int widget_width,
|
||||||
int baseline)
|
int widget_height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkTextView *text_view;
|
GtkTextView *text_view;
|
||||||
GtkTextViewPrivate *priv;
|
GtkTextViewPrivate *priv;
|
||||||
@@ -4105,14 +4107,14 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
|||||||
*/
|
*/
|
||||||
left_rect.width = priv->border_window_size.left;
|
left_rect.width = priv->border_window_size.left;
|
||||||
right_rect.width = priv->border_window_size.right;
|
right_rect.width = priv->border_window_size.right;
|
||||||
width = allocation->width - left_rect.width - right_rect.width;
|
width = widget_width - left_rect.width - right_rect.width;
|
||||||
text_rect.width = MAX (1, width);
|
text_rect.width = MAX (1, width);
|
||||||
top_rect.width = text_rect.width;
|
top_rect.width = text_rect.width;
|
||||||
bottom_rect.width = text_rect.width;
|
bottom_rect.width = text_rect.width;
|
||||||
|
|
||||||
top_rect.height = priv->border_window_size.top;
|
top_rect.height = priv->border_window_size.top;
|
||||||
bottom_rect.height = priv->border_window_size.bottom;
|
bottom_rect.height = priv->border_window_size.bottom;
|
||||||
height = allocation->height - top_rect.height - bottom_rect.height;
|
height = widget_height - top_rect.height - bottom_rect.height;
|
||||||
text_rect.height = MAX (1, height);
|
text_rect.height = MAX (1, height);
|
||||||
left_rect.height = text_rect.height;
|
left_rect.height = text_rect.height;
|
||||||
right_rect.height = text_rect.height;
|
right_rect.height = text_rect.height;
|
||||||
|
|||||||
+10
-24
@@ -191,7 +191,8 @@ static void gtk_toolbar_get_property (GObject *object,
|
|||||||
static void gtk_toolbar_snapshot (GtkWidget *widget,
|
static void gtk_toolbar_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_toolbar_size_allocate (GtkWidget *widget,
|
static void gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static void gtk_toolbar_style_updated (GtkWidget *widget);
|
static void gtk_toolbar_style_updated (GtkWidget *widget);
|
||||||
static gboolean gtk_toolbar_focus (GtkWidget *widget,
|
static gboolean gtk_toolbar_focus (GtkWidget *widget,
|
||||||
@@ -1201,9 +1202,10 @@ rebuild_menu (GtkToolbar *toolbar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_toolbar_size_allocate (GtkWidget *widget,
|
gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
|
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
|
||||||
GtkToolbarPrivate *priv = toolbar->priv;
|
GtkToolbarPrivate *priv = toolbar->priv;
|
||||||
@@ -1241,14 +1243,14 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
available_size = size = allocation->width;
|
available_size = size = width;
|
||||||
short_size = allocation->height;
|
short_size = height;
|
||||||
arrow_size = arrow_requisition.width;
|
arrow_size = arrow_requisition.width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
available_size = size = allocation->height;
|
available_size = size = height;
|
||||||
short_size = allocation->width;
|
short_size = width;
|
||||||
arrow_size = arrow_requisition.height;
|
arrow_size = arrow_requisition.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1411,22 +1413,6 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
|
|||||||
fixup_allocation_for_rtl (available_size, &item_area);
|
fixup_allocation_for_rtl (available_size, &item_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* translate the items by allocation->(x,y) */
|
|
||||||
for (i = 0; i < n_items; ++i)
|
|
||||||
{
|
|
||||||
allocations[i].x += allocation->x;
|
|
||||||
allocations[i].y += allocation->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_arrow)
|
|
||||||
{
|
|
||||||
arrow_allocation.x += allocation->x;
|
|
||||||
arrow_allocation.y += allocation->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
item_area.x += allocation->x;
|
|
||||||
item_area.y += allocation->y;
|
|
||||||
|
|
||||||
/* did anything change? */
|
/* did anything change? */
|
||||||
for (list = priv->content, i = 0; list != NULL; list = list->next, i++)
|
for (list = priv->content, i = 0; list != NULL; list = list->next, i++)
|
||||||
{
|
{
|
||||||
|
|||||||
+16
-14
@@ -592,9 +592,10 @@ static void gtk_tree_view_measure (GtkWidget *widget,
|
|||||||
int *natural,
|
int *natural,
|
||||||
int *minimum_baseline,
|
int *minimum_baseline,
|
||||||
int *natural_baseline);
|
int *natural_baseline);
|
||||||
static void gtk_tree_view_size_allocate (GtkWidget *widget,
|
static void gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_tree_view_snapshot (GtkWidget *widget,
|
static void gtk_tree_view_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
|
|
||||||
@@ -2540,9 +2541,10 @@ gtk_tree_view_size_allocate_drag_column (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_tree_view_size_allocate (GtkWidget *widget,
|
gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||||
GList *tmp_list;
|
GList *tmp_list;
|
||||||
@@ -2557,14 +2559,14 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
|||||||
page_size = gtk_adjustment_get_page_size (tree_view->priv->vadjustment);
|
page_size = gtk_adjustment_get_page_size (tree_view->priv->vadjustment);
|
||||||
gtk_adjustment_configure (tree_view->priv->hadjustment,
|
gtk_adjustment_configure (tree_view->priv->hadjustment,
|
||||||
gtk_adjustment_get_value (tree_view->priv->hadjustment) +
|
gtk_adjustment_get_value (tree_view->priv->hadjustment) +
|
||||||
(_gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL ? allocation->width - page_size : 0),
|
(_gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL ? width - page_size : 0),
|
||||||
0,
|
0,
|
||||||
MAX (allocation->width, tree_view->priv->width),
|
MAX (width, tree_view->priv->width),
|
||||||
allocation->width * 0.1,
|
width * 0.1,
|
||||||
allocation->width * 0.9,
|
width * 0.9,
|
||||||
allocation->width);
|
width);
|
||||||
|
|
||||||
page_size = allocation->height - gtk_tree_view_get_effective_header_height (tree_view);
|
page_size = height - gtk_tree_view_get_effective_header_height (tree_view);
|
||||||
gtk_adjustment_configure (tree_view->priv->vadjustment,
|
gtk_adjustment_configure (tree_view->priv->vadjustment,
|
||||||
gtk_adjustment_get_value (tree_view->priv->vadjustment),
|
gtk_adjustment_get_value (tree_view->priv->vadjustment),
|
||||||
0,
|
0,
|
||||||
@@ -2654,9 +2656,9 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
|||||||
* or top right corner (for LTR)
|
* or top right corner (for LTR)
|
||||||
*/
|
*/
|
||||||
min_x = gtk_adjustment_get_value (tree_view->priv->hadjustment);
|
min_x = gtk_adjustment_get_value (tree_view->priv->hadjustment);
|
||||||
max_x = min_x + allocation->width - child_rect.width;
|
max_x = min_x + width - child_rect.width;
|
||||||
min_y = 0;
|
min_y = 0;
|
||||||
max_y = min_y + allocation->height - gtk_tree_view_get_effective_header_height (tree_view) - child_rect.height;
|
max_y = min_y + height - gtk_tree_view_get_effective_header_height (tree_view) - child_rect.height;
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_LTR)
|
if (direction == GTK_TEXT_DIR_LTR)
|
||||||
/* Ensure that child's right edge is not sticking to the right
|
/* Ensure that child's right edge is not sticking to the right
|
||||||
|
|||||||
+9
-4
@@ -119,13 +119,18 @@ gtk_video_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_video_size_allocate (GtkWidget *widget,
|
gtk_video_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkVideo *self = GTK_VIDEO (widget);
|
GtkVideo *self = GTK_VIDEO (widget);
|
||||||
|
|
||||||
gtk_widget_size_allocate (self->box, allocation, baseline);
|
gtk_widget_size_allocate (self->box,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+8
-6
@@ -96,9 +96,10 @@ static void gtk_viewport_get_property (GObject *object,
|
|||||||
static void gtk_viewport_destroy (GtkWidget *widget);
|
static void gtk_viewport_destroy (GtkWidget *widget);
|
||||||
static void gtk_viewport_snapshot (GtkWidget *widget,
|
static void gtk_viewport_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_viewport_size_allocate (GtkWidget *widget,
|
static void gtk_viewport_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline);
|
int height,
|
||||||
|
int baseline);
|
||||||
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
|
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void viewport_set_adjustment (GtkViewport *viewport,
|
static void viewport_set_adjustment (GtkViewport *viewport,
|
||||||
@@ -521,9 +522,10 @@ gtk_viewport_snapshot (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_viewport_size_allocate (GtkWidget *widget,
|
gtk_viewport_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
||||||
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
|
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
|
||||||
|
|||||||
+533
-484
File diff suppressed because it is too large
Load Diff
+25
-9
@@ -250,7 +250,8 @@ struct _GtkWidgetClass
|
|||||||
void (* realize) (GtkWidget *widget);
|
void (* realize) (GtkWidget *widget);
|
||||||
void (* unrealize) (GtkWidget *widget);
|
void (* unrealize) (GtkWidget *widget);
|
||||||
void (* size_allocate) (GtkWidget *widget,
|
void (* size_allocate) (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
void (* state_flags_changed) (GtkWidget *widget,
|
void (* state_flags_changed) (GtkWidget *widget,
|
||||||
GtkStateFlags previous_state_flags);
|
GtkStateFlags previous_state_flags);
|
||||||
@@ -407,6 +408,12 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
void gtk_widget_size_allocate (GtkWidget *widget,
|
void gtk_widget_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
const GtkAllocation *allocation,
|
||||||
int baseline);
|
int baseline);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
void gtk_widget_size_allocate_transformed (GtkWidget *widget,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int baseline,
|
||||||
|
const graphene_matrix_t *transform);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
|
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
|
||||||
@@ -456,12 +463,6 @@ gboolean gtk_widget_send_focus_change (GtkWidget *widget,
|
|||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_widget_activate (GtkWidget *widget);
|
gboolean gtk_widget_activate (GtkWidget *widget);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
gboolean gtk_widget_intersect (GtkWidget *widget,
|
|
||||||
const GdkRectangle *area,
|
|
||||||
GdkRectangle *intersection);
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_widget_freeze_child_notify (GtkWidget *widget);
|
void gtk_widget_freeze_child_notify (GtkWidget *widget);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
@@ -678,8 +679,6 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
void gtk_widget_set_vexpand_set (GtkWidget *widget,
|
void gtk_widget_set_vexpand_set (GtkWidget *widget,
|
||||||
gboolean set);
|
gboolean set);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_widget_queue_compute_expand (GtkWidget *widget);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
gboolean gtk_widget_compute_expand (GtkWidget *widget,
|
gboolean gtk_widget_compute_expand (GtkWidget *widget,
|
||||||
GtkOrientation orientation);
|
GtkOrientation orientation);
|
||||||
|
|
||||||
@@ -1050,6 +1049,23 @@ void gtk_widget_snapshot_child (GtkWidget *widget,
|
|||||||
GtkWidget *child,
|
GtkWidget *child,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
void gtk_widget_set_transform (GtkWidget *widget,
|
||||||
|
const graphene_matrix_t *transform);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
void gtk_widget_get_transform (GtkWidget *widget,
|
||||||
|
graphene_matrix_t *out_transform);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
gboolean gtk_widget_translate_coordinatesf (GtkWidget *src_widget,
|
||||||
|
GtkWidget *dest_widget,
|
||||||
|
double src_x,
|
||||||
|
double src_y,
|
||||||
|
double *dest_x,
|
||||||
|
double *dest_y);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
|
||||||
|
|
||||||
|
|||||||
+24
-9
@@ -138,11 +138,20 @@ struct _GtkWidgetPrivate
|
|||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
|
||||||
/* The widget's allocated size */
|
/* The widget's allocated size */
|
||||||
GtkAllocation allocated_size;
|
int allocated_width;
|
||||||
|
int allocated_height;
|
||||||
gint allocated_size_baseline;
|
gint allocated_size_baseline;
|
||||||
GtkAllocation allocation;
|
/* Size with widget margins and alignment applied */
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
gint allocated_baseline;
|
gint allocated_baseline;
|
||||||
|
|
||||||
|
/* Align and widget margin offset the position by this
|
||||||
|
* amount. */
|
||||||
|
int allocated_offset_x;
|
||||||
|
int allocated_offset_y;
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
|
||||||
/* The widget's requested sizes */
|
/* The widget's requested sizes */
|
||||||
SizeRequestCache requests;
|
SizeRequestCache requests;
|
||||||
|
|
||||||
@@ -291,12 +300,6 @@ void gtk_widget_adjust_size_request (GtkWidget *widg
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size);
|
gint *natural_size);
|
||||||
void gtk_widget_adjust_size_allocation (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
gint *minimum_size,
|
|
||||||
gint *natural_size,
|
|
||||||
gint *allocated_pos,
|
|
||||||
gint *allocated_size);
|
|
||||||
void gtk_widget_adjust_baseline_request (GtkWidget *widget,
|
void gtk_widget_adjust_baseline_request (GtkWidget *widget,
|
||||||
gint *minimum_baseline,
|
gint *minimum_baseline,
|
||||||
gint *natural_baseline);
|
gint *natural_baseline);
|
||||||
@@ -328,6 +331,11 @@ void gtk_widget_get_origin_relative_to_parent (GtkWidget *wi
|
|||||||
int *origin_x,
|
int *origin_x,
|
||||||
int *origin_y);
|
int *origin_y);
|
||||||
|
|
||||||
|
gboolean gtk_widget_emit_event_signals (GtkWidget *widget,
|
||||||
|
const GdkEvent *event);
|
||||||
|
|
||||||
|
void gtk_widget_init_legacy_controller (GtkWidget *widget);
|
||||||
|
|
||||||
void gtk_widget_cancel_event_sequence (GtkWidget *widget,
|
void gtk_widget_cancel_event_sequence (GtkWidget *widget,
|
||||||
GtkGesture *gesture,
|
GtkGesture *gesture,
|
||||||
GdkEventSequence *sequence,
|
GdkEventSequence *sequence,
|
||||||
@@ -454,7 +462,14 @@ static inline void
|
|||||||
_gtk_widget_get_allocation (GtkWidget *widget,
|
_gtk_widget_get_allocation (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
*allocation = widget->priv->allocation;
|
GtkWidgetPrivate *priv = widget->priv;
|
||||||
|
|
||||||
|
*allocation = (GtkAllocation) {
|
||||||
|
(int)graphene_matrix_get_value (&priv->transform, 3, 0),
|
||||||
|
(int)graphene_matrix_get_value (&priv->transform, 3, 1),
|
||||||
|
priv->width,
|
||||||
|
priv->height
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GtkWidget *
|
static inline GtkWidget *
|
||||||
|
|||||||
+16
-18
@@ -425,8 +425,9 @@ static void gtk_window_map (GtkWidget *widget);
|
|||||||
static void gtk_window_unmap (GtkWidget *widget);
|
static void gtk_window_unmap (GtkWidget *widget);
|
||||||
static void gtk_window_realize (GtkWidget *widget);
|
static void gtk_window_realize (GtkWidget *widget);
|
||||||
static void gtk_window_unrealize (GtkWidget *widget);
|
static void gtk_window_unrealize (GtkWidget *widget);
|
||||||
static void gtk_window_size_allocate (GtkWidget *widget,
|
static void gtk_window_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline);
|
int baseline);
|
||||||
static gboolean gtk_window_close_request (GtkWindow *window);
|
static gboolean gtk_window_close_request (GtkWindow *window);
|
||||||
static void gtk_window_focus_in (GtkWidget *widget);
|
static void gtk_window_focus_in (GtkWidget *widget);
|
||||||
@@ -6850,8 +6851,8 @@ gtk_window_realize (GtkWidget *widget)
|
|||||||
_gtk_widget_get_allocation (widget, &allocation);
|
_gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
/* ensure widget tree is properly size allocated */
|
/* ensure widget tree is properly size allocated */
|
||||||
if (allocation.x == -1 &&
|
if (allocation.x == 0 &&
|
||||||
allocation.y == -1 &&
|
allocation.y == 0 &&
|
||||||
allocation.width == 1 &&
|
allocation.width == 1 &&
|
||||||
allocation.height == 1)
|
allocation.height == 1)
|
||||||
{
|
{
|
||||||
@@ -7136,7 +7137,8 @@ popover_size_allocate (GtkWindowPopover *popover,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_gtk_window_set_allocation (GtkWindow *window,
|
_gtk_window_set_allocation (GtkWindow *window,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
GtkAllocation *allocation_out)
|
GtkAllocation *allocation_out)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = (GtkWidget *)window;
|
GtkWidget *widget = (GtkWidget *)window;
|
||||||
@@ -7145,13 +7147,12 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
GtkBorder window_border = { 0 };
|
GtkBorder window_border = { 0 };
|
||||||
GList *link;
|
GList *link;
|
||||||
|
|
||||||
g_assert (allocation != NULL);
|
|
||||||
g_assert (allocation_out != NULL);
|
g_assert (allocation_out != NULL);
|
||||||
|
|
||||||
child_allocation.x = 0;
|
child_allocation.x = 0;
|
||||||
child_allocation.y = 0;
|
child_allocation.y = 0;
|
||||||
child_allocation.width = allocation->width;
|
child_allocation.width = width;
|
||||||
child_allocation.height = allocation->height;
|
child_allocation.height = height;
|
||||||
|
|
||||||
get_shadow_width (window, &window_border);
|
get_shadow_width (window, &window_border);
|
||||||
|
|
||||||
@@ -7170,9 +7171,7 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
|
|
||||||
title_allocation.x = window_border.left;
|
title_allocation.x = window_border.left;
|
||||||
title_allocation.y = window_border.top;
|
title_allocation.y = window_border.top;
|
||||||
title_allocation.width =
|
title_allocation.width = MAX (1, width - window_border.left - window_border.right);
|
||||||
MAX (1, (gint) allocation->width -
|
|
||||||
window_border.left - window_border.right);
|
|
||||||
|
|
||||||
gtk_widget_measure (priv->title_box, GTK_ORIENTATION_VERTICAL,
|
gtk_widget_measure (priv->title_box, GTK_ORIENTATION_VERTICAL,
|
||||||
title_allocation.width,
|
title_allocation.width,
|
||||||
@@ -7196,9 +7195,7 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
|
|
||||||
if (!_gtk_widget_is_toplevel (widget) && _gtk_widget_get_realized (widget))
|
if (!_gtk_widget_is_toplevel (widget) && _gtk_widget_get_realized (widget))
|
||||||
{
|
{
|
||||||
gdk_surface_move_resize (_gtk_widget_get_surface (widget),
|
gdk_surface_move_resize (_gtk_widget_get_surface (widget), 0, 0, width, height);
|
||||||
allocation->x, allocation->y,
|
|
||||||
allocation->width, allocation->height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*allocation_out = child_allocation;
|
*allocation_out = child_allocation;
|
||||||
@@ -7212,15 +7209,16 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_window_size_allocate (GtkWidget *widget,
|
gtk_window_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkWindow *window = GTK_WINDOW (widget);
|
GtkWindow *window = GTK_WINDOW (widget);
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
|
|
||||||
_gtk_window_set_allocation (window, allocation, &child_allocation);
|
_gtk_window_set_allocation (window, width, height, &child_allocation);
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (window));
|
child = gtk_bin_get_child (GTK_BIN (window));
|
||||||
if (child && gtk_widget_get_visible (child))
|
if (child && gtk_widget_get_visible (child))
|
||||||
|
|||||||
@@ -50,9 +50,10 @@ void _gtk_window_unset_focus_and_default (GtkWindow *window,
|
|||||||
void _gtk_window_set_is_active (GtkWindow *window,
|
void _gtk_window_set_is_active (GtkWindow *window,
|
||||||
gboolean is_active);
|
gboolean is_active);
|
||||||
|
|
||||||
void _gtk_window_set_allocation (GtkWindow *window,
|
void _gtk_window_set_allocation (GtkWindow *window,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
GtkAllocation *allocation_out);
|
int height,
|
||||||
|
GtkAllocation *allocation_out);
|
||||||
|
|
||||||
typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
|
typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
|
||||||
guint keyval,
|
guint keyval,
|
||||||
|
|||||||
@@ -240,12 +240,18 @@ gtk_stack_combo_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_stack_combo_size_allocate (GtkWidget *widget,
|
gtk_stack_combo_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkStackCombo *self = GTK_STACK_COMBO (widget);
|
GtkStackCombo *self = GTK_STACK_COMBO (widget);
|
||||||
gtk_widget_size_allocate (GTK_WIDGET (self->combo), allocation, baseline);
|
|
||||||
|
gtk_widget_size_allocate (GTK_WIDGET (self->combo),
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -37,49 +37,6 @@
|
|||||||
#include "gtkeventcontrollermotion.h"
|
#include "gtkeventcontrollermotion.h"
|
||||||
#include "gtkeventcontrollerkey.h"
|
#include "gtkeventcontrollerkey.h"
|
||||||
|
|
||||||
static gboolean
|
|
||||||
inspector_contains (GtkWidget *widget,
|
|
||||||
double x,
|
|
||||||
double y)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
|
||||||
|
|
||||||
if (!gtk_widget_is_drawable (widget))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return GTK_WIDGET_GET_CLASS (widget)->contains (widget, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *
|
|
||||||
inspector_pick (GtkWidget *widget,
|
|
||||||
double x,
|
|
||||||
double y)
|
|
||||||
{
|
|
||||||
/* Like gtk_widget_pick and gtk_widget_contains,
|
|
||||||
* but we need to consider insensitive widgets as well. */
|
|
||||||
GtkWidget *child;
|
|
||||||
|
|
||||||
for (child = _gtk_widget_get_last_child (widget);
|
|
||||||
child;
|
|
||||||
child = _gtk_widget_get_prev_sibling (child))
|
|
||||||
{
|
|
||||||
GtkWidget *picked;
|
|
||||||
int dx, dy;
|
|
||||||
|
|
||||||
gtk_widget_get_origin_relative_to_parent (child, &dx, &dy);
|
|
||||||
|
|
||||||
picked = GTK_WIDGET_GET_CLASS (child)->pick (child, x - dx, y - dy);
|
|
||||||
if (picked)
|
|
||||||
return picked;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!inspector_contains (widget, x, y))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
find_widget_at_pointer (GdkDevice *device)
|
find_widget_at_pointer (GdkDevice *device)
|
||||||
{
|
{
|
||||||
@@ -122,7 +79,7 @@ find_widget_at_pointer (GdkDevice *device)
|
|||||||
gdk_surface_get_device_position_double (gtk_widget_get_surface (widget),
|
gdk_surface_get_device_position_double (gtk_widget_get_surface (widget),
|
||||||
device, &x, &y, NULL);
|
device, &x, &y, NULL);
|
||||||
|
|
||||||
widget = inspector_pick (widget, x, y);
|
widget = gtk_widget_pick (widget, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ state_flags_changed (GtkWidget *w, GtkStateFlags old_flags, GtkInspectorMiscInfo
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
allocation_changed (GtkWidget *w,
|
allocation_changed (GtkWidget *w,
|
||||||
GdkRectangle *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
int baseline,
|
int baseline,
|
||||||
GtkInspectorMiscInfo *sl)
|
GtkInspectorMiscInfo *sl)
|
||||||
{
|
{
|
||||||
@@ -442,7 +443,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
|
|||||||
state_flags_changed (GTK_WIDGET (sl->priv->object), 0, sl);
|
state_flags_changed (GTK_WIDGET (sl->priv->object), 0, sl);
|
||||||
|
|
||||||
g_signal_connect_object (object, "size-allocate", G_CALLBACK (allocation_changed), sl, 0);
|
g_signal_connect_object (object, "size-allocate", G_CALLBACK (allocation_changed), sl, 0);
|
||||||
allocation_changed (GTK_WIDGET (sl->priv->object), NULL, -1, sl);
|
allocation_changed (GTK_WIDGET (sl->priv->object), 0, 0, -1, sl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ gtk_tests = [
|
|||||||
['testflowbox'],
|
['testflowbox'],
|
||||||
['testfontchooser'],
|
['testfontchooser'],
|
||||||
['testfontoptions'],
|
['testfontoptions'],
|
||||||
|
['testformentry'],
|
||||||
['testframe'],
|
['testframe'],
|
||||||
['testfullscreen'],
|
['testfullscreen'],
|
||||||
['testgiconpixbuf'],
|
['testgiconpixbuf'],
|
||||||
@@ -124,6 +125,7 @@ gtk_tests = [
|
|||||||
['testpopupat'],
|
['testpopupat'],
|
||||||
['testgaction'],
|
['testgaction'],
|
||||||
['testwidgetfocus'],
|
['testwidgetfocus'],
|
||||||
|
['testwidgettransforms'],
|
||||||
['testcenterbox'],
|
['testcenterbox'],
|
||||||
['testgridbaseline'],
|
['testgridbaseline'],
|
||||||
['showrendernode'],
|
['showrendernode'],
|
||||||
|
|||||||
@@ -0,0 +1,229 @@
|
|||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define GTK_TYPE_FORM_ENTRY (gtk_form_entry_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (GtkFormEntry, gtk_form_entry, GTK, FORM_ENTRY, GtkWidget)
|
||||||
|
|
||||||
|
#define FINAL_SCALE 0.7
|
||||||
|
#define TRANSITION_DURATION (200 * 1000)
|
||||||
|
|
||||||
|
struct _GtkFormEntry
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *entry;
|
||||||
|
GtkWidget *placeholder;
|
||||||
|
|
||||||
|
double placeholder_scale;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GtkFormEntry, gtk_form_entry, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_form_entry_size_allocate (GtkWidget *widget,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int baseline)
|
||||||
|
{
|
||||||
|
GtkFormEntry *self = (GtkFormEntry *)widget;
|
||||||
|
int placeholder_height;
|
||||||
|
int top;
|
||||||
|
|
||||||
|
gtk_widget_measure (self->placeholder, GTK_ORIENTATION_VERTICAL, -1,
|
||||||
|
&placeholder_height, NULL, NULL, NULL);
|
||||||
|
top = placeholder_height * FINAL_SCALE;
|
||||||
|
|
||||||
|
gtk_widget_size_allocate (self->entry,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, top,
|
||||||
|
width, height - top
|
||||||
|
}, -1);
|
||||||
|
|
||||||
|
/* Placeholder allocation depends on self->placeholder_scale.
|
||||||
|
* If that's 1.0, we don't scale it and center it on the
|
||||||
|
* GtkEntry. Otherwise, we move it up until y = 0. */
|
||||||
|
{
|
||||||
|
const int max_y = top + ((height - top) / 2) - (placeholder_height / 2);
|
||||||
|
const double t = self->placeholder_scale; /* TODO: Interpolate */
|
||||||
|
const int y = 0 + (t * max_y);
|
||||||
|
int x;
|
||||||
|
graphene_matrix_t m;
|
||||||
|
|
||||||
|
/* Get 0 in entry coords so we can position the placeholder there. */
|
||||||
|
gtk_widget_translate_coordinates (self->entry, widget, 0, 0, &x, NULL);
|
||||||
|
|
||||||
|
x *= t;
|
||||||
|
|
||||||
|
graphene_matrix_init_scale (&m,
|
||||||
|
CLAMP (t, FINAL_SCALE, 1.0),
|
||||||
|
CLAMP (t, FINAL_SCALE, 1.0),
|
||||||
|
1);
|
||||||
|
graphene_matrix_translate (&m,
|
||||||
|
&GRAPHENE_POINT3D_INIT (x, y, 0));
|
||||||
|
|
||||||
|
gtk_widget_size_allocate_transformed (self->placeholder,
|
||||||
|
width,
|
||||||
|
placeholder_height,
|
||||||
|
-1,
|
||||||
|
&m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_form_entry_measure (GtkWidget *widget,
|
||||||
|
GtkOrientation orientation,
|
||||||
|
int for_size,
|
||||||
|
int *minimum,
|
||||||
|
int *natural,
|
||||||
|
int *minimum_baseline,
|
||||||
|
int *natural_baseline)
|
||||||
|
{
|
||||||
|
GtkFormEntry *self = (GtkFormEntry *)widget;
|
||||||
|
|
||||||
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
{
|
||||||
|
int min1, nat1;
|
||||||
|
int min2, nat2;
|
||||||
|
|
||||||
|
gtk_widget_measure (self->entry, orientation, for_size,
|
||||||
|
&min1, &nat1, NULL, NULL);
|
||||||
|
|
||||||
|
gtk_widget_measure (self->entry, orientation, for_size,
|
||||||
|
&min2, &nat2, NULL, NULL);
|
||||||
|
|
||||||
|
*minimum = MAX (min1, min2);
|
||||||
|
*natural = MAX (nat1, nat2);
|
||||||
|
}
|
||||||
|
else /* VERTICAL */
|
||||||
|
{
|
||||||
|
int min, nat;
|
||||||
|
int pmin, pnat;
|
||||||
|
|
||||||
|
gtk_widget_measure (self->entry, orientation, -1,
|
||||||
|
&min, &nat, NULL, NULL);
|
||||||
|
|
||||||
|
gtk_widget_measure (self->entry, orientation, -1,
|
||||||
|
&pmin, &pnat, NULL, NULL);
|
||||||
|
|
||||||
|
*minimum = min + (pmin * FINAL_SCALE);
|
||||||
|
*natural = nat + (pnat * FINAL_SCALE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
tick_cb (GtkWidget *widget,
|
||||||
|
GdkFrameClock *frame_clock,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkFormEntry *self = user_data;
|
||||||
|
|
||||||
|
self->placeholder_scale -= 0.02;
|
||||||
|
|
||||||
|
gtk_widget_queue_allocate (GTK_WIDGET (self));
|
||||||
|
gtk_widget_queue_draw (self->placeholder);
|
||||||
|
|
||||||
|
if (self->placeholder_scale <= 0)
|
||||||
|
{
|
||||||
|
self->placeholder_scale = 0;
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_form_entry_focused (GtkEventControllerKey *controller,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkFormEntry *self = user_data;
|
||||||
|
|
||||||
|
gtk_widget_add_tick_callback (GTK_WIDGET (self), tick_cb, self, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_form_entry_unfocused (GtkEventControllerKey *controller,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkFormEntry *self = user_data;
|
||||||
|
|
||||||
|
self->placeholder_scale = 1.0;
|
||||||
|
gtk_widget_queue_allocate (GTK_WIDGET (self));
|
||||||
|
gtk_widget_queue_draw (self->placeholder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_form_entry_class_init (GtkFormEntryClass *klass)
|
||||||
|
{
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
|
widget_class->measure = gtk_form_entry_measure;
|
||||||
|
widget_class->size_allocate = gtk_form_entry_size_allocate;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_form_entry_init (GtkFormEntry *self)
|
||||||
|
{
|
||||||
|
GtkEventController *key_controller;
|
||||||
|
gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);
|
||||||
|
|
||||||
|
self->entry = gtk_entry_new ();
|
||||||
|
self->placeholder = gtk_label_new ("");
|
||||||
|
gtk_label_set_xalign (GTK_LABEL (self->placeholder), 0);
|
||||||
|
self->placeholder_scale = 1.0;
|
||||||
|
|
||||||
|
gtk_widget_set_parent (self->entry, GTK_WIDGET (self));
|
||||||
|
gtk_widget_set_parent (self->placeholder, GTK_WIDGET (self));
|
||||||
|
|
||||||
|
key_controller = gtk_event_controller_key_new ();
|
||||||
|
g_signal_connect (key_controller, "focus-in", G_CALLBACK (gtk_form_entry_focused), self);
|
||||||
|
g_signal_connect (key_controller, "focus-out", G_CALLBACK (gtk_form_entry_unfocused), self);
|
||||||
|
gtk_widget_add_controller (self->entry, key_controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gtk_form_entry_new (const char *text)
|
||||||
|
{
|
||||||
|
GtkWidget *w = g_object_new (GTK_TYPE_FORM_ENTRY, NULL);
|
||||||
|
|
||||||
|
gtk_label_set_text (GTK_LABEL (((GtkFormEntry*)w)->placeholder), text);
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
GtkWidget *window;
|
||||||
|
GtkWidget *box;
|
||||||
|
GtkWidget *form_entry1;
|
||||||
|
GtkWidget *form_entry2;
|
||||||
|
|
||||||
|
gtk_init ();
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||||
|
form_entry1 = gtk_form_entry_new ("First Name");
|
||||||
|
form_entry2 = gtk_form_entry_new ("Last Name");
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), form_entry1);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), form_entry2);
|
||||||
|
|
||||||
|
|
||||||
|
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gtk_window_set_default_size ((GtkWindow *)window, 200, 200);
|
||||||
|
g_signal_connect (window, "close-request", G_CALLBACK (gtk_main_quit), NULL);
|
||||||
|
gtk_widget_show (window);
|
||||||
|
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
child_size_allocate (GtkWidget *child,
|
child_size_allocate (GtkWidget *child,
|
||||||
GdkRectangle *allocation,
|
int width,
|
||||||
|
int height,
|
||||||
gint baseline,
|
gint baseline,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,13 +88,14 @@ GType gtk_focus_widget_get_type (void) G_GNUC_CONST;
|
|||||||
G_DEFINE_TYPE(GtkFocusWidget, gtk_focus_widget, GTK_TYPE_WIDGET)
|
G_DEFINE_TYPE(GtkFocusWidget, gtk_focus_widget, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_focus_widget_size_allocate (GtkWidget *widget,
|
gtk_focus_widget_size_allocate (GtkWidget *widget,
|
||||||
const GtkAllocation *allocation,
|
int width,
|
||||||
int baseline)
|
int height,
|
||||||
|
int baseline)
|
||||||
{
|
{
|
||||||
GtkFocusWidget *self = GTK_FOCUS_WIDGET (widget);
|
GtkFocusWidget *self = GTK_FOCUS_WIDGET (widget);
|
||||||
int child_width = (allocation->width) / 2;
|
int child_width = width / 2;
|
||||||
int child_height = (allocation->height) / 2;
|
int child_height = height / 2;
|
||||||
GtkAllocation child_alloc;
|
GtkAllocation child_alloc;
|
||||||
|
|
||||||
child_alloc.x = 0;
|
child_alloc.x = 0;
|
||||||
|
|||||||
@@ -0,0 +1,350 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static const char *css =
|
||||||
|
"button {"
|
||||||
|
" all: unset; "
|
||||||
|
" background-color: white;"
|
||||||
|
" border: 20px solid black;"
|
||||||
|
" padding: 20px;"
|
||||||
|
" margin: 40px;"
|
||||||
|
"}"
|
||||||
|
"button:hover {"
|
||||||
|
" background-color: blue;"
|
||||||
|
" border-color: red;"
|
||||||
|
"}"
|
||||||
|
"image {"
|
||||||
|
" background-color: teal;"
|
||||||
|
"}"
|
||||||
|
;
|
||||||
|
|
||||||
|
/* Just so we can avoid a signal */
|
||||||
|
GtkWidget *transform_tester;
|
||||||
|
GtkWidget *test_widget;
|
||||||
|
GtkWidget *test_child;
|
||||||
|
float scale = 1;
|
||||||
|
graphene_matrix_t global_transform;
|
||||||
|
|
||||||
|
static const GdkRGBA RED = {1, 0, 0, 0.4};
|
||||||
|
static const GdkRGBA GREEN = {0, 1, 0, 0.4};
|
||||||
|
static const GdkRGBA BLUE = {0, 0, 1, 0.4};
|
||||||
|
static const GdkRGBA BLACK = {0, 0, 0, 1};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ######################################################################### */
|
||||||
|
/* ############################## MatrixChooser ############################ */
|
||||||
|
/* ######################################################################### */
|
||||||
|
|
||||||
|
|
||||||
|
#define GTK_TYPE_MATRIX_CHOOSER (gtk_matrix_chooser_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (GtkMatrixChooser, gtk_matrix_chooser, GTK, MATRIX_CHOOSER, GtkWidget)
|
||||||
|
|
||||||
|
struct _GtkMatrixChooser
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GtkMatrixChooser, gtk_matrix_chooser, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_matrix_chooser_init (GtkMatrixChooser *self)
|
||||||
|
{
|
||||||
|
gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_matrix_chooser_class_init (GtkMatrixChooserClass *klass)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ######################################################################### */
|
||||||
|
/* ############################# TransformTester ########################### */
|
||||||
|
/* ######################################################################### */
|
||||||
|
|
||||||
|
#define TEST_WIDGET_MIN_SIZE 100
|
||||||
|
|
||||||
|
#define GTK_TYPE_TRANSFORM_TESTER (gtk_transform_tester_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (GtkTransformTester, gtk_transform_tester, GTK, TRANSFORM_TESTER, GtkWidget);
|
||||||
|
|
||||||
|
struct _GtkTransformTester
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *test_widget;
|
||||||
|
int pick_increase;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GtkTransformTester, gtk_transform_tester, GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_transform_tester_measure (GtkWidget *widget,
|
||||||
|
GtkOrientation orientation,
|
||||||
|
int for_size,
|
||||||
|
int *minimum,
|
||||||
|
int *natural,
|
||||||
|
int *minimum_baseline,
|
||||||
|
int *natural_baseline)
|
||||||
|
{
|
||||||
|
GtkTransformTester *self = (GtkTransformTester *)widget;
|
||||||
|
|
||||||
|
if (self->test_widget)
|
||||||
|
{
|
||||||
|
gtk_widget_measure (self->test_widget, orientation, for_size,
|
||||||
|
minimum, natural, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_transform_tester_size_allocate (GtkWidget *widget,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int baseline)
|
||||||
|
{
|
||||||
|
GtkTransformTester *self = (GtkTransformTester *)widget;
|
||||||
|
|
||||||
|
gtk_widget_size_allocate (self->test_widget,
|
||||||
|
&(GtkAllocation) {
|
||||||
|
0, 0,
|
||||||
|
width, height
|
||||||
|
}, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_transform_tester_snapshot (GtkWidget *widget,
|
||||||
|
GtkSnapshot *snapshot)
|
||||||
|
{
|
||||||
|
GtkTransformTester *self = (GtkTransformTester *)widget;
|
||||||
|
const int width = gtk_widget_get_width (widget);
|
||||||
|
const int height = gtk_widget_get_height (widget);
|
||||||
|
const int inc = self->pick_increase;
|
||||||
|
graphene_rect_t child_bounds;
|
||||||
|
graphene_rect_t self_bounds;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_transform_tester_parent_class)->snapshot (widget, snapshot);
|
||||||
|
|
||||||
|
gtk_widget_compute_bounds (self->test_widget, widget, &child_bounds);
|
||||||
|
gtk_widget_compute_bounds (self->test_widget, self->test_widget, &self_bounds);
|
||||||
|
|
||||||
|
{
|
||||||
|
const struct {
|
||||||
|
graphene_point_t coords;
|
||||||
|
GdkRGBA color;
|
||||||
|
} points[4] = {
|
||||||
|
{ self_bounds.origin, {1, 0, 0, 1} },
|
||||||
|
{ GRAPHENE_POINT_INIT (self_bounds.origin.x + self_bounds.size.width, self_bounds.origin.y), {0, 1, 0, 1} },
|
||||||
|
{ GRAPHENE_POINT_INIT (self_bounds.origin.x + self_bounds.size.width, self_bounds.origin.y + self_bounds.size.height), {0, 0, 1, 1} },
|
||||||
|
{ GRAPHENE_POINT_INIT (self_bounds.origin.x, self_bounds.origin.y + self_bounds.size.height), {1, 0, 1, 1} }
|
||||||
|
};
|
||||||
|
|
||||||
|
for (x = 0; x < G_N_ELEMENTS (points); x ++)
|
||||||
|
{
|
||||||
|
double px, py;
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinatesf (self->test_widget, widget,
|
||||||
|
points[x].coords.x, points[x].coords.y,
|
||||||
|
&px, &py);
|
||||||
|
|
||||||
|
gtk_snapshot_append_color (snapshot, &points[x].color,
|
||||||
|
&GRAPHENE_RECT_INIT (px, py,
|
||||||
|
4,
|
||||||
|
4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now add custom drawing */
|
||||||
|
for (x = 0; x < width; x += inc)
|
||||||
|
{
|
||||||
|
for (y = 0; y < height; y += inc)
|
||||||
|
{
|
||||||
|
const float px = x;
|
||||||
|
const float py = y;
|
||||||
|
GtkWidget *picked;
|
||||||
|
#if 1
|
||||||
|
picked = gtk_widget_pick (widget, px, py);
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
double dx, dy;
|
||||||
|
gtk_widget_translate_coordinatesf (widget, self->test_widget, px, py, &dx, &dy);
|
||||||
|
picked = gtk_widget_pick (self->test_widget, dx, dy);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (picked == self->test_widget)
|
||||||
|
gtk_snapshot_append_color (snapshot, &GREEN,
|
||||||
|
&GRAPHENE_RECT_INIT (px - (inc / 2), py - (inc / 2), inc, inc));
|
||||||
|
else if (picked == test_child)
|
||||||
|
gtk_snapshot_append_color (snapshot, &BLUE,
|
||||||
|
&GRAPHENE_RECT_INIT (px - (inc / 2), py - (inc / 2), inc, inc));
|
||||||
|
|
||||||
|
else
|
||||||
|
gtk_snapshot_append_color (snapshot, &RED,
|
||||||
|
&GRAPHENE_RECT_INIT (px - (inc / 2), py - (inc / 2), inc, inc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gtk_snapshot_append_color (snapshot, &BLACK,
|
||||||
|
&GRAPHENE_RECT_INIT (child_bounds.origin.x,
|
||||||
|
child_bounds.origin.y,
|
||||||
|
child_bounds.size.width,
|
||||||
|
1));
|
||||||
|
|
||||||
|
gtk_snapshot_append_color (snapshot, &BLACK,
|
||||||
|
&GRAPHENE_RECT_INIT (child_bounds.origin.x + child_bounds.size.width,
|
||||||
|
child_bounds.origin.y,
|
||||||
|
1,
|
||||||
|
child_bounds.size.height));
|
||||||
|
|
||||||
|
gtk_snapshot_append_color (snapshot, &BLACK,
|
||||||
|
&GRAPHENE_RECT_INIT (child_bounds.origin.x,
|
||||||
|
child_bounds.origin.y + child_bounds.size.height,
|
||||||
|
child_bounds.size.width,
|
||||||
|
1));
|
||||||
|
|
||||||
|
gtk_snapshot_append_color (snapshot, &BLACK,
|
||||||
|
&GRAPHENE_RECT_INIT (child_bounds.origin.x,
|
||||||
|
child_bounds.origin.y,
|
||||||
|
1,
|
||||||
|
child_bounds.size.height));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_transform_tester_init (GtkTransformTester *self)
|
||||||
|
{
|
||||||
|
gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);
|
||||||
|
|
||||||
|
self->pick_increase = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_transform_tester_class_init (GtkTransformTesterClass *klass)
|
||||||
|
{
|
||||||
|
GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
|
||||||
|
|
||||||
|
widget_class->measure = gtk_transform_tester_measure;
|
||||||
|
widget_class->size_allocate = gtk_transform_tester_size_allocate;
|
||||||
|
widget_class->snapshot = gtk_transform_tester_snapshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_transform_tester_set_test_widget (GtkTransformTester *self,
|
||||||
|
GtkWidget *test_widget)
|
||||||
|
{
|
||||||
|
g_assert (!self->test_widget);
|
||||||
|
|
||||||
|
self->test_widget = test_widget;
|
||||||
|
gtk_widget_set_parent (test_widget, (GtkWidget *)self);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
transform_func (gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkAllocation alloc;
|
||||||
|
|
||||||
|
scale += 2.5f;
|
||||||
|
gtk_widget_get_allocation (test_widget, &alloc);
|
||||||
|
|
||||||
|
graphene_matrix_init_identity (&global_transform);
|
||||||
|
graphene_matrix_translate (&global_transform,
|
||||||
|
&(graphene_point3d_t){
|
||||||
|
/*- alloc.width,*/
|
||||||
|
/*0,*/
|
||||||
|
- alloc.width / 2,
|
||||||
|
- alloc.height / 2,
|
||||||
|
0}
|
||||||
|
);
|
||||||
|
|
||||||
|
graphene_matrix_rotate (&global_transform, scale,
|
||||||
|
graphene_vec3_z_axis ());
|
||||||
|
|
||||||
|
graphene_matrix_translate (&global_transform,
|
||||||
|
&(graphene_point3d_t){
|
||||||
|
alloc.width / 2,
|
||||||
|
alloc.height /2,
|
||||||
|
0}
|
||||||
|
);
|
||||||
|
|
||||||
|
/*graphene_matrix_init_scale (&global_transform, 2, 2, 1);*/
|
||||||
|
|
||||||
|
|
||||||
|
gtk_widget_set_transform (test_widget, &global_transform);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*graphene_matrix_init_scale (&global_transform, 0.5, 1, 1);*/
|
||||||
|
/*graphene_matrix_translate (&global_transform,*/
|
||||||
|
/*&(graphene_point3d_t){*/
|
||||||
|
/*alloc.width / 2, 0, 0*/
|
||||||
|
/*});*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*gtk_widget_set_transform (test_child, &global_transform);*/
|
||||||
|
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (test_widget);
|
||||||
|
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
GtkWidget *window;
|
||||||
|
GtkWidget *matrix_chooser;
|
||||||
|
GtkWidget *box;
|
||||||
|
GtkCssProvider *provider;
|
||||||
|
|
||||||
|
gtk_init ();
|
||||||
|
|
||||||
|
provider = gtk_css_provider_new ();
|
||||||
|
gtk_css_provider_load_from_data (provider, css, -1);
|
||||||
|
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
|
GTK_STYLE_PROVIDER (provider),
|
||||||
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
matrix_chooser = g_object_new (GTK_TYPE_MATRIX_CHOOSER, NULL);
|
||||||
|
transform_tester = g_object_new (GTK_TYPE_TRANSFORM_TESTER, NULL);
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||||
|
|
||||||
|
test_widget = gtk_button_new ();
|
||||||
|
gtk_widget_set_size_request (test_widget, TEST_WIDGET_MIN_SIZE, TEST_WIDGET_MIN_SIZE);
|
||||||
|
gtk_widget_set_halign (test_widget, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (test_widget, GTK_ALIGN_CENTER);
|
||||||
|
|
||||||
|
|
||||||
|
test_child = gtk_image_new_from_icon_name ("corebird");
|
||||||
|
gtk_widget_set_halign (test_child, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (test_child, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_size_request (test_child, TEST_WIDGET_MIN_SIZE / 2, TEST_WIDGET_MIN_SIZE / 2);
|
||||||
|
gtk_container_add (GTK_CONTAINER (test_widget), test_child);
|
||||||
|
|
||||||
|
|
||||||
|
gtk_transform_tester_set_test_widget (GTK_TRANSFORM_TESTER (transform_tester), test_widget);
|
||||||
|
|
||||||
|
g_timeout_add (16, transform_func, NULL);
|
||||||
|
|
||||||
|
gtk_widget_set_vexpand (transform_tester, TRUE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), transform_tester);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), matrix_chooser);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
|
gtk_window_set_default_size ((GtkWindow *)window, 200, 200);
|
||||||
|
g_signal_connect (window, "close-request", G_CALLBACK (gtk_main_quit), NULL);
|
||||||
|
gtk_widget_show (window);
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -51,6 +51,7 @@ tests = [
|
|||||||
['textbuffer'],
|
['textbuffer'],
|
||||||
['textiter'],
|
['textiter'],
|
||||||
['treelistmodel'],
|
['treelistmodel'],
|
||||||
|
['translate'],
|
||||||
['treemodel', ['treemodel.c', 'liststore.c', 'treestore.c', 'filtermodel.c',
|
['treemodel', ['treemodel.c', 'liststore.c', 'treestore.c', 'filtermodel.c',
|
||||||
'modelrefcount.c', 'sortmodel.c', 'gtktreemodelrefcount.c']],
|
'modelrefcount.c', 'sortmodel.c', 'gtktreemodelrefcount.c']],
|
||||||
['treepath'],
|
['treepath'],
|
||||||
|
|||||||
@@ -0,0 +1,420 @@
|
|||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#define BORDER_WIDTH 30
|
||||||
|
|
||||||
|
static const char *css =
|
||||||
|
"button, box {"
|
||||||
|
" all: unset; "
|
||||||
|
"}"
|
||||||
|
".with-border {"
|
||||||
|
" border: 30px solid white;"
|
||||||
|
"}"
|
||||||
|
;
|
||||||
|
|
||||||
|
static void
|
||||||
|
same_widget (void)
|
||||||
|
{
|
||||||
|
GtkWidget *a = gtk_button_new ();
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = -1000; i < 1000; i ++)
|
||||||
|
{
|
||||||
|
int rx, ry;
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinates (a, a, i, i, &rx, &ry);
|
||||||
|
|
||||||
|
g_assert_cmpint (rx, ==, i);
|
||||||
|
g_assert_cmpint (ry, ==, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
compute_bounds (void)
|
||||||
|
{
|
||||||
|
const int WIDTH = 200;
|
||||||
|
const int HEIGHT = 100;
|
||||||
|
GtkWidget *a = gtk_button_new ();
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
graphene_rect_t bounds;
|
||||||
|
|
||||||
|
graphene_matrix_init_scale (&transform, 2, 1, 1);
|
||||||
|
|
||||||
|
gtk_widget_measure (a, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (a, &(GtkAllocation){0, 0, WIDTH, HEIGHT}, -1);
|
||||||
|
|
||||||
|
gtk_widget_compute_bounds (a, a, &bounds);
|
||||||
|
g_assert_cmpfloat (bounds.origin.x, ==, 0);
|
||||||
|
g_assert_cmpfloat (bounds.origin.y, ==, 0);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.width, WIDTH, 1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.height, HEIGHT, 1);
|
||||||
|
|
||||||
|
gtk_widget_set_transform (a, &transform);
|
||||||
|
gtk_widget_compute_bounds (a, a, &bounds);
|
||||||
|
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.width, WIDTH, 1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.height, HEIGHT, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
compute_bounds_with_parent (void)
|
||||||
|
{
|
||||||
|
const int WIDTH = 200;
|
||||||
|
const int HEIGHT = 100;
|
||||||
|
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
GtkWidget *a = gtk_button_new ();
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
graphene_rect_t bounds;
|
||||||
|
|
||||||
|
gtk_widget_set_hexpand (a, FALSE);
|
||||||
|
gtk_widget_set_vexpand (a, FALSE);
|
||||||
|
gtk_widget_set_halign (a, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_valign (a, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_size_request (a, WIDTH, HEIGHT);
|
||||||
|
gtk_widget_set_margin_start (a, 25);
|
||||||
|
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), a);
|
||||||
|
gtk_widget_measure (a, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_measure (box, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (box, &(GtkAllocation){0, 0, WIDTH * 10, HEIGHT * 10}, -1);
|
||||||
|
|
||||||
|
gtk_widget_compute_bounds (a, box, &bounds);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.origin.x, 25, 1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.origin.y, 0, 1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.width, WIDTH, 1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.height, HEIGHT, 1);
|
||||||
|
|
||||||
|
|
||||||
|
/* Now set a transform and check that the bounds returned by compute_bounds
|
||||||
|
* have the proper values */
|
||||||
|
|
||||||
|
graphene_matrix_init_scale (&transform, 2, 1, 1);
|
||||||
|
gtk_widget_set_transform (a, &transform);
|
||||||
|
|
||||||
|
|
||||||
|
gtk_widget_compute_bounds (a, box, &bounds);
|
||||||
|
/* FIXME: Positions here are borked */
|
||||||
|
/*g_assert_cmpfloat_with_epsilon (bounds.origin.x, 25, 1);*/
|
||||||
|
/*g_assert_cmpfloat_with_epsilon (bounds.origin.y, 0, 1);*/
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.width, WIDTH * 2, 1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (bounds.size.height, HEIGHT, 1);
|
||||||
|
/*g_message ("RESULT: %f, %f, %f, %f",*/
|
||||||
|
/*bounds.origin.x, bounds.origin.y,*/
|
||||||
|
/*bounds.size.width, bounds.size.height);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
translate_with_parent (void)
|
||||||
|
{
|
||||||
|
const int WIDTH = 200;
|
||||||
|
const int HEIGHT = 100;
|
||||||
|
const float x_scale = 2.0f;
|
||||||
|
const int x_margin = 25;
|
||||||
|
GtkWidget *parent = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
GtkWidget *child = gtk_button_new ();
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
gtk_widget_set_hexpand (child, FALSE);
|
||||||
|
gtk_widget_set_vexpand (child, FALSE);
|
||||||
|
gtk_widget_set_halign (child, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_valign (child, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_size_request (child, WIDTH, HEIGHT);
|
||||||
|
gtk_widget_set_margin_start (child, x_margin);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (parent), child);
|
||||||
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_measure (parent, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (parent, &(GtkAllocation){0, 0, WIDTH * 10, HEIGHT * 10}, -1);
|
||||||
|
|
||||||
|
/* First we have no transformation. We take a coordinate and translate it from parent
|
||||||
|
* to child, then back from child to parent and check if we get our original coordinate. */
|
||||||
|
for (i = 0; i < 100; i ++)
|
||||||
|
{
|
||||||
|
double cx, cy;
|
||||||
|
double px, py;
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinatesf (parent, child, i, i, &cx, &cy);
|
||||||
|
|
||||||
|
/* Back up */
|
||||||
|
gtk_widget_translate_coordinatesf (child, parent, cx, cy, &px, &py);
|
||||||
|
|
||||||
|
g_assert_cmpfloat_with_epsilon (px, i, 0.1f);
|
||||||
|
g_assert_cmpfloat_with_epsilon (py, i, 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
graphene_matrix_init_scale (&transform, x_scale, 1, 1);
|
||||||
|
gtk_widget_set_transform (child, &transform);
|
||||||
|
|
||||||
|
/* Same thing... */
|
||||||
|
for (i = 1; i < 100; i ++)
|
||||||
|
{
|
||||||
|
double cx, cy;
|
||||||
|
double px, py;
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinatesf (parent, child, i, i, &cx, &cy);
|
||||||
|
/*g_message ("### %d/%d in child coords: %f/%f", i, i, cx, cy);*/
|
||||||
|
/*g_assert_cmpfloat_with_epsilon (cx, (-x_margin+i) / x_scale, 0.1f);*/
|
||||||
|
/*g_assert_cmpfloat_with_epsilon (cy, i, 0.1f);*/
|
||||||
|
|
||||||
|
/* Back up */
|
||||||
|
gtk_widget_translate_coordinatesf (child, parent, cx, cy, &px, &py);
|
||||||
|
/*g_message ("%f, %f", px, py);*/
|
||||||
|
/*g_message ("%f/%f in parent coords: %f/%f", cx, cy, px, py);*/
|
||||||
|
|
||||||
|
g_assert_cmpfloat_with_epsilon (px, i, 0.1f);
|
||||||
|
g_assert_cmpfloat_with_epsilon (py, i, 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Now try a translation... */
|
||||||
|
gtk_widget_set_margin_start (child, 0);
|
||||||
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_measure (parent, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (parent, &(GtkAllocation){0, 0, WIDTH * 10, HEIGHT * 10}, -1);
|
||||||
|
graphene_matrix_init_translate (&transform,
|
||||||
|
&(graphene_point3d_t){20, 0, 0});
|
||||||
|
gtk_widget_set_transform (child, &transform);
|
||||||
|
|
||||||
|
{
|
||||||
|
double dx, dy;
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinatesf (parent, child, 0, 0, &dx, &dy);
|
||||||
|
|
||||||
|
g_assert_cmpfloat_with_epsilon (dx, -20, 0.1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (dy, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
translate_with_css (void)
|
||||||
|
{
|
||||||
|
const int WIDTH = 200;
|
||||||
|
const int HEIGHT = 100;
|
||||||
|
GtkWidget *parent = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
GtkWidget *child = gtk_button_new ();
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (child), "with-border");
|
||||||
|
|
||||||
|
gtk_widget_set_hexpand (child, FALSE);
|
||||||
|
gtk_widget_set_vexpand (child, FALSE);
|
||||||
|
gtk_widget_set_halign (child, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_valign (child, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_size_request (child, WIDTH, HEIGHT);
|
||||||
|
/*gtk_widget_set_margin_start (child, x_margin);*/
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (parent), child);
|
||||||
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_measure (parent, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (parent, &(GtkAllocation){0, 0, WIDTH * 10, HEIGHT * 10}, -1);
|
||||||
|
|
||||||
|
/* Basic checks without a transformation */
|
||||||
|
{
|
||||||
|
double dx, dy;
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinatesf (child, parent, 0, 0, &dx, &dy);
|
||||||
|
g_assert_cmpfloat_with_epsilon (dx, BORDER_WIDTH, 0.1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (dy, BORDER_WIDTH, 0.1);
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinatesf (parent, child, 0, 0, &dx, &dy);
|
||||||
|
g_assert_cmpfloat_with_epsilon (dx, - BORDER_WIDTH, 0.1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (dy, - BORDER_WIDTH, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
graphene_matrix_init_scale (&transform, 2, 2, 1);
|
||||||
|
gtk_widget_set_transform (child, &transform);
|
||||||
|
|
||||||
|
/* Since the border is also scaled, the values should be double from above. */
|
||||||
|
{
|
||||||
|
double px, py;
|
||||||
|
double cx, cy;
|
||||||
|
|
||||||
|
/*g_message (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");*/
|
||||||
|
gtk_widget_translate_coordinatesf (child, parent, 0, 0, &px, &py);
|
||||||
|
/*g_message ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");*/
|
||||||
|
g_assert_cmpfloat_with_epsilon (px, BORDER_WIDTH * 2, 0.1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (py, BORDER_WIDTH * 2, 0.1);
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinatesf (parent, child, px, py, &cx, &cy);
|
||||||
|
g_assert_cmpfloat_with_epsilon (cx, 0, 0.1);
|
||||||
|
g_assert_cmpfloat_with_epsilon (cy, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pick (void)
|
||||||
|
{
|
||||||
|
const int WIDTH = 200;
|
||||||
|
const int HEIGHT = 100;
|
||||||
|
GtkWidget *parent = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
GtkWidget *child = gtk_button_new ();
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
|
||||||
|
gtk_widget_set_hexpand (child, TRUE);
|
||||||
|
gtk_widget_set_vexpand (child, TRUE);
|
||||||
|
gtk_widget_set_halign (child, GTK_ALIGN_FILL);
|
||||||
|
gtk_widget_set_valign (child, GTK_ALIGN_FILL);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (parent), child);
|
||||||
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_measure (parent, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (parent, &(GtkAllocation){0, 0, WIDTH, HEIGHT}, -1);
|
||||||
|
|
||||||
|
g_assert (gtk_widget_get_width (child) == WIDTH);
|
||||||
|
g_assert (gtk_widget_get_height (child) == HEIGHT);
|
||||||
|
|
||||||
|
/* We scale the child widget to only half its size on the x axis,
|
||||||
|
* which means doing a pick on the left half of the parent should
|
||||||
|
* return the child but a pick on the right half should return the
|
||||||
|
* parent. */
|
||||||
|
graphene_matrix_init_scale (&transform, 0.5, 1, 1);
|
||||||
|
gtk_widget_set_transform (child, &transform);
|
||||||
|
|
||||||
|
/*g_assert (gtk_widget_pick (parent, WIDTH * 0.25, HEIGHT / 2) == child);*/
|
||||||
|
/*g_assert (gtk_widget_pick (parent, WIDTH * 0.75, HEIGHT / 2) == parent);*/
|
||||||
|
|
||||||
|
/* Now we test translations by simply offsetting the child widget by its own size,
|
||||||
|
* which will move it to the left and entirely out of the parent's allocation. */
|
||||||
|
graphene_matrix_init_translate (&transform,
|
||||||
|
&(graphene_point3d_t){ - WIDTH, 0, 0 });
|
||||||
|
gtk_widget_set_transform (child, &transform);
|
||||||
|
|
||||||
|
/* ... which means that picking on the parent with any positive x coordinate will
|
||||||
|
* yield the parent widget, while negative x coordinates (up until -WIDTH) will
|
||||||
|
* yield the child */
|
||||||
|
g_assert (gtk_widget_pick (parent, WIDTH * 0.1, 0) == parent);
|
||||||
|
g_assert (gtk_widget_pick (parent, WIDTH * 0.9, 0) == parent);
|
||||||
|
|
||||||
|
/*double dx, dy;*/
|
||||||
|
/*gtk_widget_translate_coordinatesf (parent, child, - WIDTH * 0.1, 0, &dx, &dy);*/
|
||||||
|
/*g_message ("translate: %f, %f", dx, dy);*/
|
||||||
|
|
||||||
|
|
||||||
|
g_assert (gtk_widget_pick (parent, -WIDTH * 0.1, 0) == child);
|
||||||
|
g_assert (gtk_widget_pick (parent, -WIDTH * 0.9, 0) == child);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static void
|
||||||
|
single_widget_scale (void)
|
||||||
|
{
|
||||||
|
GtkWidget *p = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
GtkWidget *w = gtk_button_new ();
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
GtkWidget *picked;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (p), w);
|
||||||
|
|
||||||
|
gtk_widget_set_hexpand (w, TRUE);
|
||||||
|
gtk_widget_set_vexpand (w, TRUE);
|
||||||
|
|
||||||
|
graphene_matrix_init_scale (&transform, 0.5f, 0.5f, 1);
|
||||||
|
gtk_widget_set_transform (w, &transform);
|
||||||
|
|
||||||
|
/* Just to shut up the GtkWidget warning... */
|
||||||
|
gtk_widget_measure (p, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (p, &(GtkAllocation) {0, 0, 100, 100}, -1);
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinates (p, w, 0, 0, &x, &y);
|
||||||
|
g_assert_cmpint (x, ==, 0);
|
||||||
|
g_assert_cmpint (y, ==, 0);
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinates (p, w, 10, 10, &x, &y);
|
||||||
|
g_assert_cmpint (x, ==, 10 / 2);
|
||||||
|
g_assert_cmpint (y, ==, 10 / 2);
|
||||||
|
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinates (p, w, 100, 100, &x, &y);
|
||||||
|
g_assert_cmpint (x, ==, 100 / 2);
|
||||||
|
g_assert_cmpint (y, ==, 100 / 2);
|
||||||
|
|
||||||
|
picked = gtk_widget_pick (p, 0, 0);
|
||||||
|
g_assert (picked == w);
|
||||||
|
|
||||||
|
picked = gtk_widget_pick (p, 51, 51);
|
||||||
|
g_assert (picked == p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
single_widget_rotate (void)
|
||||||
|
{
|
||||||
|
GtkWidget *p = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
GtkWidget *w = gtk_button_new ();
|
||||||
|
graphene_matrix_t transform;
|
||||||
|
GtkWidget *picked;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (p), w);
|
||||||
|
|
||||||
|
gtk_widget_set_hexpand (w, TRUE);
|
||||||
|
gtk_widget_set_vexpand (w, TRUE);
|
||||||
|
|
||||||
|
graphene_matrix_init_rotate (&transform,
|
||||||
|
45.0, /* Deg */
|
||||||
|
graphene_vec3_z_axis ());
|
||||||
|
gtk_widget_set_transform (w, &transform);
|
||||||
|
|
||||||
|
/* Just to shut up the GtkWidget warning... */
|
||||||
|
gtk_widget_measure (p, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL, NULL, NULL);
|
||||||
|
gtk_widget_size_allocate (p, &(GtkAllocation) {0, 0, 100, 100}, -1);
|
||||||
|
|
||||||
|
gtk_widget_translate_coordinates (p, w, 0, 0, &x, &y);
|
||||||
|
g_assert_cmpint (x, ==, 0);
|
||||||
|
g_assert_cmpint (y, ==, 0);
|
||||||
|
|
||||||
|
|
||||||
|
picked = gtk_widget_pick (p, 0, 0);
|
||||||
|
g_assert (picked == w);
|
||||||
|
|
||||||
|
picked = gtk_widget_pick (p, 0, 100);
|
||||||
|
g_assert (picked == w);
|
||||||
|
|
||||||
|
/* Now it gets interesting... */
|
||||||
|
|
||||||
|
/* This should return the button parent since the button is rotated away from the
|
||||||
|
* y axis on top */
|
||||||
|
picked = gtk_widget_pick (p, 20, 0);
|
||||||
|
g_assert (picked == p);
|
||||||
|
|
||||||
|
picked = gtk_widget_pick (p, 50, 10);
|
||||||
|
g_assert (picked == p);
|
||||||
|
|
||||||
|
picked = gtk_widget_pick (p, 100, 100);
|
||||||
|
g_assert (picked == p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
GtkCssProvider *provider;
|
||||||
|
|
||||||
|
gtk_init ();
|
||||||
|
|
||||||
|
// TODO: Do this only conditionally and/or per-testcase.
|
||||||
|
provider = gtk_css_provider_new ();
|
||||||
|
gtk_css_provider_load_from_data (provider, css, -1);
|
||||||
|
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
|
GTK_STYLE_PROVIDER (provider),
|
||||||
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
|
||||||
|
|
||||||
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
|
g_test_add_func ("/translate/same-widget", same_widget);
|
||||||
|
g_test_add_func ("/translate/compute-bounds", compute_bounds);
|
||||||
|
g_test_add_func ("/translate/compute-bounds-with-parent", compute_bounds_with_parent);
|
||||||
|
g_test_add_func ("/translate/translate-with-parent", translate_with_parent);
|
||||||
|
g_test_add_func ("/translate/translate-with-css", translate_with_css);
|
||||||
|
g_test_add_func ("/translate/pick", pick);
|
||||||
|
|
||||||
|
return g_test_run ();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user