combobox: cleanup GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
It was using the wrong padding values for RTL, and generally, using the same variables in a distant macro makes this method even more complicated than it already is...
This commit is contained in:
@ -2515,22 +2515,25 @@ gtk_combo_box_popdown (GtkComboBox *combo_box)
|
|||||||
priv->grab_keyboard = NULL;
|
priv->grab_keyboard = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON \
|
#define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON \
|
||||||
gtk_widget_get_preferred_size (combo_box->priv->button, \
|
GtkAllocation button_allocation; \
|
||||||
&req, NULL); \
|
gtk_widget_get_preferred_size (combo_box->priv->button, \
|
||||||
\
|
&req, NULL); \
|
||||||
if (is_rtl) \
|
\
|
||||||
child.x = allocation->x + padding.right; \
|
if (is_rtl) \
|
||||||
else \
|
button_allocation.x = allocation->x + padding.left; \
|
||||||
child.x = allocation->x + allocation->width - req.width - padding.left; \
|
else \
|
||||||
\
|
button_allocation.x = allocation->x + allocation->width \
|
||||||
child.y = allocation->y + padding.top; \
|
- req.width - padding.right; \
|
||||||
child.width = req.width; \
|
\
|
||||||
child.height = allocation->height - (padding.top + padding.bottom); \
|
button_allocation.y = allocation->y + padding.top; \
|
||||||
child.width = MAX (1, child.width); \
|
button_allocation.width = MAX (1, req.width); \
|
||||||
child.height = MAX (1, child.height); \
|
button_allocation.height = allocation->height - \
|
||||||
\
|
(padding.top + padding.bottom); \
|
||||||
gtk_widget_size_allocate (combo_box->priv->button, &child);
|
button_allocation.height = MAX (1, button_allocation.height); \
|
||||||
|
\
|
||||||
|
gtk_widget_size_allocate (combo_box->priv->button, \
|
||||||
|
&button_allocation);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2640,14 +2643,18 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
|
GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
|
||||||
|
|
||||||
|
/* After the macro, button_allocation has the button allocation rect */
|
||||||
|
|
||||||
if (is_rtl)
|
if (is_rtl)
|
||||||
child.x = allocation->x + req.width + padding.right;
|
child.x = button_allocation.x + button_allocation.width;
|
||||||
else
|
else
|
||||||
child.x = allocation->x + padding.left;
|
child.x = allocation->x + padding.left;
|
||||||
child.y = allocation->y + padding.top;
|
child.y = allocation->y + padding.top;
|
||||||
child.width = allocation->width - req.width - (padding.left + padding.right);
|
child.width = allocation->width - button_allocation.width - (padding.left + padding.right);
|
||||||
|
child.height = button_allocation.height;
|
||||||
|
|
||||||
child.width = MAX (1, child.width);
|
child.width = MAX (1, child.width);
|
||||||
child.height = MAX (1, child.height);
|
|
||||||
gtk_widget_size_allocate (child_widget, &child);
|
gtk_widget_size_allocate (child_widget, &child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2656,18 +2663,18 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
|||||||
/* list mode */
|
/* list mode */
|
||||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
|
|
||||||
/* button */
|
/* After the macro, button_allocation has the button allocation rect */
|
||||||
GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
|
GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
|
||||||
|
|
||||||
/* frame */
|
/* frame */
|
||||||
if (is_rtl)
|
if (is_rtl)
|
||||||
child.x = allocation->x + req.width;
|
child.x = button_allocation.x + button_allocation.width;
|
||||||
else
|
else
|
||||||
child.x = allocation->x;
|
child.x = allocation->x;
|
||||||
|
|
||||||
child.y = allocation->y;
|
child.y = allocation->y;
|
||||||
child.width = allocation->width - req.width;
|
child.width = allocation->width - button_allocation.width - (padding.left + padding.right);
|
||||||
child.height = allocation->height;
|
child.height = button_allocation.height;
|
||||||
|
|
||||||
if (priv->cell_view_frame)
|
if (priv->cell_view_frame)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user