Bug 573322 - Do box layout in int
This fixes some centering issues, e.g. in the search area. This patch is from Havoc Pennington.
This commit is contained in:
parent
0b81a4a7e9
commit
59b12687d4
417
src/big/box.c
417
src/big/box.c
@ -2,7 +2,7 @@
|
|||||||
/* big-box.c: Box container.
|
/* big-box.c: Box container.
|
||||||
|
|
||||||
Copyright (C) 2006-2008 Red Hat, Inc.
|
Copyright (C) 2006-2008 Red Hat, Inc.
|
||||||
Copyright (C) 2008 litl, LLC.
|
Copyright (C) 2008-2009 litl, LLC.
|
||||||
|
|
||||||
The libbigwidgets-lgpl is free software; you can redistribute it and/or
|
The libbigwidgets-lgpl is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
@ -20,8 +20,6 @@
|
|||||||
Suite 330, Boston, MA 02111-1307, USA.
|
Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
@ -93,16 +91,16 @@ struct _BigBoxPrivate
|
|||||||
BigBoxOrientation orientation;
|
BigBoxOrientation orientation;
|
||||||
BigBoxAlignment x_align;
|
BigBoxAlignment x_align;
|
||||||
BigBoxAlignment y_align;
|
BigBoxAlignment y_align;
|
||||||
ClutterUnit spacing;
|
int spacing;
|
||||||
ClutterUnit padding_top;
|
int padding_top;
|
||||||
ClutterUnit padding_bottom;
|
int padding_bottom;
|
||||||
ClutterUnit padding_left;
|
int padding_left;
|
||||||
ClutterUnit padding_right;
|
int padding_right;
|
||||||
ClutterUnit border_top;
|
int border_top;
|
||||||
ClutterUnit border_bottom;
|
int border_bottom;
|
||||||
ClutterUnit border_left;
|
int border_left;
|
||||||
ClutterUnit border_right;
|
int border_right;
|
||||||
ClutterUnit corner_radius;
|
int corner_radius;
|
||||||
ClutterColor border_color;
|
ClutterColor border_color;
|
||||||
guint background_border_top;
|
guint background_border_top;
|
||||||
guint background_border_bottom;
|
guint background_border_bottom;
|
||||||
@ -136,9 +134,9 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ClutterUnit minimum;
|
int minimum;
|
||||||
ClutterUnit natural;
|
int natural;
|
||||||
ClutterUnit adjustment;
|
int adjustment;
|
||||||
guint does_not_fit : 1;
|
guint does_not_fit : 1;
|
||||||
} BigBoxAdjustInfo;
|
} BigBoxAdjustInfo;
|
||||||
|
|
||||||
@ -448,13 +446,13 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_bg_texture_allocation (ClutterActor *self,
|
big_box_get_bg_texture_allocation (ClutterActor *self,
|
||||||
ClutterUnit allocated_width,
|
int allocated_width,
|
||||||
ClutterUnit allocated_height,
|
int allocated_height,
|
||||||
ClutterActorBox *bg_box)
|
ClutterActorBox *bg_box)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit bg_width, bg_height;
|
float bg_width, bg_height;
|
||||||
ClutterUnit min_x1, min_y1, max_x2, max_y2;
|
int min_x1, min_y1, max_x2, max_y2;
|
||||||
|
|
||||||
g_return_if_fail (BIG_IS_BOX (self));
|
g_return_if_fail (BIG_IS_BOX (self));
|
||||||
|
|
||||||
@ -493,7 +491,7 @@ big_box_get_bg_texture_allocation (ClutterActor *self,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BIG_BOX_ALIGNMENT_CENTER:
|
case BIG_BOX_ALIGNMENT_CENTER:
|
||||||
bg_box->x1 = MAX (min_x1, priv->border_left + roundf ((allocated_width - bg_width) / 2));
|
bg_box->x1 = MAX (min_x1, priv->border_left + (allocated_width - bg_width) / 2);
|
||||||
bg_box->x2 = MIN (bg_box->x1 + bg_width, max_x2);
|
bg_box->x2 = MIN (bg_box->x1 + bg_width, max_x2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -522,7 +520,7 @@ big_box_get_bg_texture_allocation (ClutterActor *self,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BIG_BOX_ALIGNMENT_CENTER:
|
case BIG_BOX_ALIGNMENT_CENTER:
|
||||||
bg_box->y1 = MAX (min_y1, priv->border_top + roundf ((allocated_height - bg_height) / 2));
|
bg_box->y1 = MAX (min_y1, priv->border_top + (allocated_height - bg_height) / 2);
|
||||||
bg_box->y2 = MIN (bg_box->y1 + bg_height, max_y2);
|
bg_box->y2 = MIN (bg_box->y1 + bg_height, max_y2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -604,8 +602,8 @@ big_box_update_draw_rounded_corner (BigBox *box)
|
|||||||
g_object_set (priv->background_rectangle,
|
g_object_set (priv->background_rectangle,
|
||||||
"color", &priv->background_color,
|
"color", &priv->background_color,
|
||||||
"border-color", &priv->border_color,
|
"border-color", &priv->border_color,
|
||||||
"border-width", CLUTTER_UNITS_TO_DEVICE (priv->border_top),
|
"border-width", priv->border_top,
|
||||||
"corner-radius", CLUTTER_UNITS_TO_DEVICE (priv->corner_radius),
|
"corner-radius", priv->corner_radius,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -736,7 +734,7 @@ big_box_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SPACING:
|
case PROP_SPACING:
|
||||||
priv->spacing = CLUTTER_UNITS_FROM_DEVICE (g_value_get_int (value));
|
priv->spacing = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_X_ALIGN:
|
case PROP_X_ALIGN:
|
||||||
@ -753,19 +751,19 @@ big_box_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_TOP:
|
case PROP_PADDING_TOP:
|
||||||
priv->padding_top = CLUTTER_UNITS_FROM_DEVICE (g_value_get_int (value));
|
priv->padding_top = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_BOTTOM:
|
case PROP_PADDING_BOTTOM:
|
||||||
priv->padding_bottom = CLUTTER_UNITS_FROM_DEVICE (g_value_get_int (value));
|
priv->padding_bottom = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_LEFT:
|
case PROP_PADDING_LEFT:
|
||||||
priv->padding_left = CLUTTER_UNITS_FROM_DEVICE(g_value_get_int (value));
|
priv->padding_left = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_RIGHT:
|
case PROP_PADDING_RIGHT:
|
||||||
priv->padding_right = CLUTTER_UNITS_FROM_DEVICE(g_value_get_int (value));
|
priv->padding_right = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER:
|
case PROP_BORDER:
|
||||||
@ -774,27 +772,27 @@ big_box_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_TOP:
|
case PROP_BORDER_TOP:
|
||||||
priv->border_top = CLUTTER_UNITS_FROM_DEVICE(g_value_get_int (value));
|
priv->border_top = g_value_get_int (value);
|
||||||
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_BOTTOM:
|
case PROP_BORDER_BOTTOM:
|
||||||
priv->border_bottom = CLUTTER_UNITS_FROM_DEVICE(g_value_get_int (value));
|
priv->border_bottom = g_value_get_int (value);
|
||||||
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_LEFT:
|
case PROP_BORDER_LEFT:
|
||||||
priv->border_left = CLUTTER_UNITS_FROM_DEVICE(g_value_get_int (value));
|
priv->border_left = g_value_get_int (value);
|
||||||
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_RIGHT:
|
case PROP_BORDER_RIGHT:
|
||||||
priv->border_right = CLUTTER_UNITS_FROM_DEVICE(g_value_get_int (value));
|
priv->border_right = g_value_get_int (value);
|
||||||
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_CORNER_RADIUS:
|
case PROP_CORNER_RADIUS:
|
||||||
priv->corner_radius = CLUTTER_UNITS_FROM_DEVICE(g_value_get_uint (value));
|
priv->corner_radius = g_value_get_uint (value);
|
||||||
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
big_box_update_draw_rounded_corner (BIG_BOX (gobject));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -933,7 +931,7 @@ big_box_get_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SPACING:
|
case PROP_SPACING:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->spacing));
|
g_value_set_int (value, priv->spacing);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_X_ALIGN:
|
case PROP_X_ALIGN:
|
||||||
@ -945,39 +943,39 @@ big_box_get_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_TOP:
|
case PROP_PADDING_TOP:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->padding_top));
|
g_value_set_int (value, priv->padding_top);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_BOTTOM:
|
case PROP_PADDING_BOTTOM:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->padding_bottom));
|
g_value_set_int (value, priv->padding_bottom);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_LEFT:
|
case PROP_PADDING_LEFT:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->padding_left));
|
g_value_set_int (value, priv->padding_left);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PADDING_RIGHT:
|
case PROP_PADDING_RIGHT:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->padding_right));
|
g_value_set_int (value, priv->padding_right);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_TOP:
|
case PROP_BORDER_TOP:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->border_top));
|
g_value_set_int (value, priv->border_top);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_BOTTOM:
|
case PROP_BORDER_BOTTOM:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->border_bottom));
|
g_value_set_int (value, priv->border_bottom);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_LEFT:
|
case PROP_BORDER_LEFT:
|
||||||
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE(priv->border_left));
|
g_value_set_int (value, priv->border_left);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BORDER_RIGHT:
|
case PROP_BORDER_RIGHT:
|
||||||
g_value_set_int (value,CLUTTER_UNITS_TO_DEVICE(priv->border_right));
|
g_value_set_int (value, priv->border_right);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_CORNER_RADIUS:
|
case PROP_CORNER_RADIUS:
|
||||||
g_value_set_uint (value,CLUTTER_UNITS_TO_DEVICE (priv->corner_radius));
|
g_value_set_uint (value, priv->corner_radius);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BACKGROUND_TEXTURE:
|
case PROP_BACKGROUND_TEXTURE:
|
||||||
@ -1068,14 +1066,14 @@ big_box_dispose (GObject *gobject)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_content_width_request (ClutterActor *self,
|
big_box_get_content_width_request (ClutterActor *self,
|
||||||
ClutterUnit *min_width_p,
|
int *min_width_p,
|
||||||
ClutterUnit *natural_width_p)
|
int *natural_width_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit total_min;
|
int total_min;
|
||||||
ClutterUnit total_natural;
|
int total_natural;
|
||||||
gint n_children_in_min;
|
int n_children_in_min;
|
||||||
gint n_children_in_natural;
|
int n_children_in_natural;
|
||||||
GList *c;
|
GList *c;
|
||||||
|
|
||||||
priv = BIG_BOX (self)->priv;
|
priv = BIG_BOX (self)->priv;
|
||||||
@ -1105,10 +1103,10 @@ big_box_get_content_width_request (ClutterActor *self,
|
|||||||
&natural_width);
|
&natural_width);
|
||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
g_debug ("Child %p min width %d natural %d",
|
g_debug ("Child %p min width %g natural %g",
|
||||||
child->actor,
|
child->actor,
|
||||||
CLUTTER_UNITS_TO_DEVICE (min_width),
|
min_width,
|
||||||
CLUTTER_UNITS_TO_DEVICE (natural_width));
|
natural_width);
|
||||||
|
|
||||||
n_children_in_natural += 1;
|
n_children_in_natural += 1;
|
||||||
|
|
||||||
@ -1157,14 +1155,14 @@ big_box_get_content_width_request (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_preferred_width (ClutterActor *self,
|
big_box_get_preferred_width (ClutterActor *self,
|
||||||
ClutterUnit for_height,
|
float for_height,
|
||||||
ClutterUnit *min_width_p,
|
float *min_width_p,
|
||||||
ClutterUnit *natural_width_p)
|
float *natural_width_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit content_min_width;
|
int content_min_width;
|
||||||
ClutterUnit content_natural_width;
|
int content_natural_width;
|
||||||
ClutterUnit outside;
|
int outside;
|
||||||
|
|
||||||
priv = BIG_BOX (self)->priv;
|
priv = BIG_BOX (self)->priv;
|
||||||
|
|
||||||
@ -1183,25 +1181,25 @@ big_box_get_preferred_width (ClutterActor *self,
|
|||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
{
|
{
|
||||||
if (min_width_p)
|
if (min_width_p)
|
||||||
g_debug ("Computed minimum width as %d", CLUTTER_UNITS_TO_DEVICE (*min_width_p));
|
g_debug ("Computed minimum width as %g", *min_width_p);
|
||||||
if (natural_width_p)
|
if (natural_width_p)
|
||||||
g_debug ("Computed natural width as %d", CLUTTER_UNITS_TO_DEVICE (*natural_width_p));
|
g_debug ("Computed natural width as %g", *natural_width_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_content_area_horizontal (ClutterActor *self,
|
big_box_get_content_area_horizontal (ClutterActor *self,
|
||||||
ClutterUnit requested_content_width,
|
int requested_content_width,
|
||||||
ClutterUnit natural_content_width,
|
int natural_content_width,
|
||||||
ClutterUnit allocated_box_width,
|
int allocated_box_width,
|
||||||
ClutterUnit *x_p,
|
int *x_p,
|
||||||
ClutterUnit *width_p)
|
int *width_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit left;
|
int left;
|
||||||
ClutterUnit right;
|
int right;
|
||||||
ClutterUnit unpadded_box_width;
|
int unpadded_box_width;
|
||||||
ClutterUnit content_width;
|
int content_width;
|
||||||
|
|
||||||
priv = BIG_BOX (self)->priv;
|
priv = BIG_BOX (self)->priv;
|
||||||
|
|
||||||
@ -1242,7 +1240,7 @@ big_box_get_content_area_horizontal (ClutterActor *self,
|
|||||||
break;
|
break;
|
||||||
case BIG_BOX_ALIGNMENT_CENTER:
|
case BIG_BOX_ALIGNMENT_CENTER:
|
||||||
if (x_p)
|
if (x_p)
|
||||||
*x_p = left + roundf ((unpadded_box_width - content_width) / 2);
|
*x_p = left + (unpadded_box_width - content_width) / 2;
|
||||||
if (width_p)
|
if (width_p)
|
||||||
*width_p = content_width;
|
*width_p = content_width;
|
||||||
break;
|
break;
|
||||||
@ -1251,17 +1249,17 @@ big_box_get_content_area_horizontal (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_content_area_vertical (ClutterActor *self,
|
big_box_get_content_area_vertical (ClutterActor *self,
|
||||||
ClutterUnit requested_content_height,
|
int requested_content_height,
|
||||||
ClutterUnit natural_content_height,
|
int natural_content_height,
|
||||||
ClutterUnit allocated_box_height,
|
int allocated_box_height,
|
||||||
ClutterUnit *y_p,
|
int *y_p,
|
||||||
ClutterUnit *height_p)
|
int *height_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit top;
|
int top;
|
||||||
ClutterUnit bottom;
|
int bottom;
|
||||||
ClutterUnit unpadded_box_height;
|
int unpadded_box_height;
|
||||||
ClutterUnit content_height;
|
int content_height;
|
||||||
|
|
||||||
priv = BIG_BOX (self)->priv;
|
priv = BIG_BOX (self)->priv;
|
||||||
|
|
||||||
@ -1302,7 +1300,7 @@ big_box_get_content_area_vertical (ClutterActor *self,
|
|||||||
break;
|
break;
|
||||||
case BIG_BOX_ALIGNMENT_CENTER:
|
case BIG_BOX_ALIGNMENT_CENTER:
|
||||||
if (y_p)
|
if (y_p)
|
||||||
*y_p = top + roundf ((unpadded_box_height - content_height) / 2);
|
*y_p = top + (unpadded_box_height - content_height) / 2;
|
||||||
if (height_p)
|
if (height_p)
|
||||||
*height_p = content_height;
|
*height_p = content_height;
|
||||||
break;
|
break;
|
||||||
@ -1327,13 +1325,22 @@ big_box_adjust_infos_new (BigBox *box,
|
|||||||
}
|
}
|
||||||
else if (priv->orientation == BIG_BOX_ORIENTATION_VERTICAL)
|
else if (priv->orientation == BIG_BOX_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
|
float minimum, natural;
|
||||||
|
|
||||||
clutter_actor_get_preferred_height (child->actor, for_content_width,
|
clutter_actor_get_preferred_height (child->actor, for_content_width,
|
||||||
&adjusts[i].minimum, &adjusts[i].natural);
|
&minimum, &natural);
|
||||||
|
adjusts[i].minimum = minimum;
|
||||||
|
adjusts[i].natural = natural;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clutter_actor_get_preferred_width (child->actor, -1, &adjusts[i].minimum,
|
float minimum, natural;
|
||||||
&adjusts[i].natural);
|
|
||||||
|
clutter_actor_get_preferred_width (child->actor, -1,
|
||||||
|
&minimum, &natural);
|
||||||
|
|
||||||
|
adjusts[i].minimum = minimum;
|
||||||
|
adjusts[i].natural = natural;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
@ -1367,12 +1374,12 @@ big_box_adjust_if_fits_as_not_fitting (GList *children,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
big_box_adjust_up_to_natural_size (GList *children,
|
big_box_adjust_up_to_natural_size (GList *children,
|
||||||
ClutterUnit *remaining_extra_space_p,
|
int *remaining_extra_space_p,
|
||||||
BigBoxAdjustInfo *adjusts,
|
BigBoxAdjustInfo *adjusts,
|
||||||
gboolean if_fits)
|
gboolean if_fits)
|
||||||
{
|
{
|
||||||
ClutterUnit smallest_increase;
|
int smallest_increase;
|
||||||
ClutterUnit space_to_distribute;
|
int space_to_distribute;
|
||||||
GList *c;
|
GList *c;
|
||||||
gint n_needing_increase;
|
gint n_needing_increase;
|
||||||
gint i;
|
gint i;
|
||||||
@ -1382,7 +1389,7 @@ big_box_adjust_up_to_natural_size (GList *children,
|
|||||||
if (*remaining_extra_space_p == 0)
|
if (*remaining_extra_space_p == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
smallest_increase = CLUTTER_MAXUNIT;
|
smallest_increase = G_MAXINT;
|
||||||
n_needing_increase = 0;
|
n_needing_increase = 0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -1473,12 +1480,12 @@ big_box_adjust_up_to_natural_size (GList *children,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
big_box_adjust_one_if_fits (GList *children,
|
big_box_adjust_one_if_fits (GList *children,
|
||||||
ClutterUnit spacing,
|
int spacing,
|
||||||
ClutterUnit *remaining_extra_space_p,
|
int *remaining_extra_space_p,
|
||||||
BigBoxAdjustInfo *adjusts)
|
BigBoxAdjustInfo *adjusts)
|
||||||
{
|
{
|
||||||
GList *c;
|
GList *c;
|
||||||
ClutterUnit spacing_delta;
|
int spacing_delta;
|
||||||
gint i;
|
gint i;
|
||||||
gboolean visible_children = FALSE;
|
gboolean visible_children = FALSE;
|
||||||
|
|
||||||
@ -1572,11 +1579,11 @@ big_box_count_expandable_children (GList *children,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_adjust_for_expandable (GList *children,
|
big_box_adjust_for_expandable (GList *children,
|
||||||
ClutterUnit *remaining_extra_space_p,
|
int *remaining_extra_space_p,
|
||||||
BigBoxAdjustInfo *adjusts)
|
BigBoxAdjustInfo *adjusts)
|
||||||
{
|
{
|
||||||
GList *c;
|
GList *c;
|
||||||
ClutterUnit expand_space;
|
int expand_space;
|
||||||
gint expand_count;
|
gint expand_count;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
@ -1619,10 +1626,10 @@ big_box_adjust_for_expandable (GList *children,
|
|||||||
static void
|
static void
|
||||||
big_box_compute_adjusts (GList *children,
|
big_box_compute_adjusts (GList *children,
|
||||||
BigBoxAdjustInfo *adjusts,
|
BigBoxAdjustInfo *adjusts,
|
||||||
ClutterUnit spacing,
|
int spacing,
|
||||||
ClutterUnit alloc_request_delta)
|
int alloc_request_delta)
|
||||||
{
|
{
|
||||||
ClutterUnit remaining_extra_space;
|
int remaining_extra_space;
|
||||||
|
|
||||||
if (children == NULL)
|
if (children == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1664,7 +1671,7 @@ big_box_compute_adjusts (GList *children,
|
|||||||
/* remaining_extra_space need not be 0, if we had no expandable children */
|
/* remaining_extra_space need not be 0, if we had no expandable children */
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterUnit
|
static int
|
||||||
big_box_get_adjusted_size (BigBoxAdjustInfo *adjust)
|
big_box_get_adjusted_size (BigBoxAdjustInfo *adjust)
|
||||||
{
|
{
|
||||||
return adjust->minimum + adjust->adjustment;
|
return adjust->minimum + adjust->adjustment;
|
||||||
@ -1672,16 +1679,16 @@ big_box_get_adjusted_size (BigBoxAdjustInfo *adjust)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_hbox_height_request (ClutterActor *self,
|
big_box_get_hbox_height_request (ClutterActor *self,
|
||||||
ClutterUnit for_width,
|
int for_width,
|
||||||
ClutterUnit *min_height_p,
|
int *min_height_p,
|
||||||
ClutterUnit *natural_height_p)
|
int *natural_height_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit total_min;
|
int total_min;
|
||||||
ClutterUnit total_natural;
|
int total_natural;
|
||||||
ClutterUnit requested_content_width;
|
int requested_content_width;
|
||||||
ClutterUnit natural_content_width;
|
int natural_content_width;
|
||||||
ClutterUnit allocated_content_width;
|
int allocated_content_width;
|
||||||
BigBoxAdjustInfo *width_adjusts;
|
BigBoxAdjustInfo *width_adjusts;
|
||||||
GList *c;
|
GList *c;
|
||||||
gint i;
|
gint i;
|
||||||
@ -1713,7 +1720,7 @@ big_box_get_hbox_height_request (ClutterActor *self,
|
|||||||
{
|
{
|
||||||
BigBoxChild *child = c->data;
|
BigBoxChild *child = c->data;
|
||||||
ClutterUnit min_height, natural_height;
|
ClutterUnit min_height, natural_height;
|
||||||
ClutterUnit req = 0;
|
int req = 0;
|
||||||
|
|
||||||
if (!BOX_CHILD_IN_LAYOUT (child))
|
if (!BOX_CHILD_IN_LAYOUT (child))
|
||||||
{
|
{
|
||||||
@ -1748,15 +1755,15 @@ big_box_get_hbox_height_request (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_vbox_height_request (ClutterActor *self,
|
big_box_get_vbox_height_request (ClutterActor *self,
|
||||||
ClutterUnit for_width,
|
int for_width,
|
||||||
ClutterUnit *min_height_p,
|
int *min_height_p,
|
||||||
ClutterUnit *natural_height_p)
|
int *natural_height_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit total_min;
|
int total_min;
|
||||||
ClutterUnit total_natural;
|
int total_natural;
|
||||||
gint n_children_in_min;
|
int n_children_in_min;
|
||||||
gint n_children_in_natural;
|
int n_children_in_natural;
|
||||||
GList *c;
|
GList *c;
|
||||||
|
|
||||||
priv = BIG_BOX (self)->priv;
|
priv = BIG_BOX (self)->priv;
|
||||||
@ -1769,8 +1776,8 @@ big_box_get_vbox_height_request (ClutterActor *self,
|
|||||||
for (c = priv->children; c != NULL; c = c->next)
|
for (c = priv->children; c != NULL; c = c->next)
|
||||||
{
|
{
|
||||||
BigBoxChild *child = (BigBoxChild *) c->data;
|
BigBoxChild *child = (BigBoxChild *) c->data;
|
||||||
ClutterUnit min_height;
|
float min_height;
|
||||||
ClutterUnit natural_height;
|
float natural_height;
|
||||||
|
|
||||||
if (!BOX_CHILD_IN_LAYOUT (child))
|
if (!BOX_CHILD_IN_LAYOUT (child))
|
||||||
continue;
|
continue;
|
||||||
@ -1807,9 +1814,9 @@ big_box_get_vbox_height_request (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_content_height_request (ClutterActor *self,
|
big_box_get_content_height_request (ClutterActor *self,
|
||||||
ClutterUnit for_width,
|
int for_width,
|
||||||
ClutterUnit *min_height_p,
|
int *min_height_p,
|
||||||
ClutterUnit *natural_height_p)
|
int *natural_height_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
|
|
||||||
@ -1825,14 +1832,14 @@ big_box_get_content_height_request (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_get_preferred_height (ClutterActor *self,
|
big_box_get_preferred_height (ClutterActor *self,
|
||||||
ClutterUnit for_width,
|
float for_width,
|
||||||
ClutterUnit *min_height_p,
|
float *min_height_p,
|
||||||
ClutterUnit *natural_height_p)
|
float *natural_height_p)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit content_min_height, content_natural_height;
|
int content_min_height, content_natural_height;
|
||||||
ClutterUnit content_for_width;
|
int content_for_width;
|
||||||
ClutterUnit outside;
|
int outside;
|
||||||
|
|
||||||
priv = BIG_BOX (self)->priv;
|
priv = BIG_BOX (self)->priv;
|
||||||
|
|
||||||
@ -1935,15 +1942,15 @@ big_box_layout (ClutterActor *self,
|
|||||||
child_box.y2 = child_box.y1 + req;
|
child_box.y2 = child_box.y1 + req;
|
||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
g_debug ("V - Child %p %s being allocated: %d, %d, %d, %d w: %d h: %d",
|
g_debug ("V - Child %p %s being allocated: %g, %g, %g, %g w: %g h: %g",
|
||||||
child->actor,
|
child->actor,
|
||||||
g_type_name_from_instance((GTypeInstance*) child->actor),
|
g_type_name_from_instance((GTypeInstance*) child->actor),
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x1),
|
child_box.x1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y1),
|
child_box.y1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x2),
|
child_box.x2,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y2),
|
child_box.y2,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x2 - child_box.x1),
|
child_box.x2 - child_box.x1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y2 - child_box.y1));
|
child_box.y2 - child_box.y1);
|
||||||
|
|
||||||
clutter_actor_allocate (child->actor, &child_box,
|
clutter_actor_allocate (child->actor, &child_box,
|
||||||
absolute_origin_changed);
|
absolute_origin_changed);
|
||||||
@ -1958,15 +1965,15 @@ big_box_layout (ClutterActor *self,
|
|||||||
child_box.y2 = child_box.y1 + allocated_content_height;
|
child_box.y2 = child_box.y1 + allocated_content_height;
|
||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
g_debug ("H - Child %p %s being allocated: %d, %d, %d, %d w: %d h: %d",
|
g_debug ("H - Child %p %s being allocated: %g, %g, %g, %g w: %g h: %g",
|
||||||
child->actor,
|
child->actor,
|
||||||
g_type_name_from_instance((GTypeInstance*) child->actor),
|
g_type_name_from_instance((GTypeInstance*) child->actor),
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x1),
|
child_box.x1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y1),
|
child_box.y1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x2),
|
child_box.x2,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y2),
|
child_box.y2,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x2 - child_box.x1),
|
child_box.x2 - child_box.x1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y2 - child_box.y1));
|
child_box.y2 - child_box.y1);
|
||||||
|
|
||||||
clutter_actor_allocate (child->actor, &child_box,
|
clutter_actor_allocate (child->actor, &child_box,
|
||||||
absolute_origin_changed);
|
absolute_origin_changed);
|
||||||
@ -2011,24 +2018,24 @@ big_box_allocate (ClutterActor *self,
|
|||||||
gboolean absolute_origin_changed)
|
gboolean absolute_origin_changed)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit requested_content_width;
|
int requested_content_width;
|
||||||
ClutterUnit requested_content_height;
|
int requested_content_height;
|
||||||
ClutterUnit natural_content_width;
|
int natural_content_width;
|
||||||
ClutterUnit natural_content_height;
|
int natural_content_height;
|
||||||
ClutterUnit allocated_content_width;
|
int allocated_content_width;
|
||||||
ClutterUnit allocated_content_height = 0;
|
int allocated_content_height = 0;
|
||||||
ClutterUnit content_x, content_y = 0;
|
int content_x, content_y = 0;
|
||||||
GList *c;
|
GList *c;
|
||||||
|
|
||||||
priv = BIG_BOX (self)->priv;
|
priv = BIG_BOX (self)->priv;
|
||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
g_debug ("Entire box %p being allocated: %d, %d, %d, %d",
|
g_debug ("Entire box %p being allocated: %g, %g, %g, %g",
|
||||||
self,
|
self,
|
||||||
CLUTTER_UNITS_TO_DEVICE (box->x1),
|
box->x1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (box->y1),
|
box->y1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (box->x2),
|
box->x2,
|
||||||
CLUTTER_UNITS_TO_DEVICE (box->y2));
|
box->y2);
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (big_box_parent_class)->allocate (self, box, absolute_origin_changed);
|
CLUTTER_ACTOR_CLASS (big_box_parent_class)->allocate (self, box, absolute_origin_changed);
|
||||||
|
|
||||||
@ -2054,13 +2061,13 @@ big_box_allocate (ClutterActor *self,
|
|||||||
if (allocated_content_height < requested_content_height)
|
if (allocated_content_height < requested_content_height)
|
||||||
g_debug ("Box %p allocated height %d but requested %d",
|
g_debug ("Box %p allocated height %d but requested %d",
|
||||||
self,
|
self,
|
||||||
CLUTTER_UNITS_TO_DEVICE (allocated_content_height),
|
allocated_content_height,
|
||||||
CLUTTER_UNITS_TO_DEVICE (requested_content_height));
|
requested_content_height);
|
||||||
if (allocated_content_width < requested_content_width)
|
if (allocated_content_width < requested_content_width)
|
||||||
g_debug ("Box %p allocated width %d but requested %d",
|
g_debug ("Box %p allocated width %d but requested %d",
|
||||||
self,
|
self,
|
||||||
CLUTTER_UNITS_TO_DEVICE (allocated_content_width),
|
allocated_content_width,
|
||||||
CLUTTER_UNITS_TO_DEVICE (requested_content_width));
|
requested_content_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->background_texture)
|
if (priv->background_texture)
|
||||||
@ -2074,10 +2081,10 @@ big_box_allocate (ClutterActor *self,
|
|||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
{
|
{
|
||||||
g_debug ("Box %p texture allocated width %d and height %d",
|
g_debug ("Box %p texture allocated width %g and height %g",
|
||||||
self,
|
self,
|
||||||
CLUTTER_UNITS_TO_DEVICE (bg_box.x2 - bg_box.x1),
|
bg_box.x2 - bg_box.x1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (bg_box.y2 - bg_box.y1));
|
bg_box.y2 - bg_box.y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_actor_allocate (priv->background_texture, &bg_box,
|
clutter_actor_allocate (priv->background_texture, &bg_box,
|
||||||
@ -2114,7 +2121,7 @@ big_box_allocate (ClutterActor *self,
|
|||||||
}
|
}
|
||||||
else if (child->fixed)
|
else if (child->fixed)
|
||||||
{
|
{
|
||||||
ClutterUnit x, y, width, height;
|
float x, y, width, height;
|
||||||
|
|
||||||
clutter_actor_get_positionu (child->actor, &x, &y);
|
clutter_actor_get_positionu (child->actor, &x, &y);
|
||||||
clutter_actor_get_preferred_width(child->actor, -1, NULL, &width);
|
clutter_actor_get_preferred_width(child->actor, -1, NULL, &width);
|
||||||
@ -2136,7 +2143,7 @@ big_box_allocate (ClutterActor *self,
|
|||||||
child_box.x1 = child_box.x2 - width;
|
child_box.x1 = child_box.x2 - width;
|
||||||
break;
|
break;
|
||||||
case BIG_BOX_ALIGNMENT_CENTER:
|
case BIG_BOX_ALIGNMENT_CENTER:
|
||||||
child_box.x1 = content_x + roundf ((allocated_content_width - width) / 2);
|
child_box.x1 = content_x + (allocated_content_width - width) / 2;
|
||||||
child_box.x2 = child_box.x1 + width;
|
child_box.x2 = child_box.x1 + width;
|
||||||
break;
|
break;
|
||||||
case BIG_BOX_ALIGNMENT_FILL:
|
case BIG_BOX_ALIGNMENT_FILL:
|
||||||
@ -2161,7 +2168,7 @@ big_box_allocate (ClutterActor *self,
|
|||||||
child_box.y1 = child_box.y2 - height;
|
child_box.y1 = child_box.y2 - height;
|
||||||
break;
|
break;
|
||||||
case BIG_BOX_ALIGNMENT_CENTER:
|
case BIG_BOX_ALIGNMENT_CENTER:
|
||||||
child_box.y1 = content_y + roundf ((allocated_content_height - height) / 2);
|
child_box.y1 = content_y + (allocated_content_height - height) / 2;
|
||||||
child_box.y2 = child_box.y1 + height;
|
child_box.y2 = child_box.y1 + height;
|
||||||
break;
|
break;
|
||||||
case BIG_BOX_ALIGNMENT_FILL:
|
case BIG_BOX_ALIGNMENT_FILL:
|
||||||
@ -2171,11 +2178,11 @@ big_box_allocate (ClutterActor *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
g_debug ("Fixed Child being allocated: %d, %d, %d, %d",
|
g_debug ("Fixed Child being allocated: %g, %g, %g, %g",
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x1),
|
child_box.x1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y1),
|
child_box.y1,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.x2),
|
child_box.x2,
|
||||||
CLUTTER_UNITS_TO_DEVICE (child_box.y2));
|
child_box.y2);
|
||||||
|
|
||||||
clutter_actor_allocate(child->actor, &child_box,
|
clutter_actor_allocate(child->actor, &child_box,
|
||||||
absolute_origin_changed);
|
absolute_origin_changed);
|
||||||
@ -2199,15 +2206,17 @@ big_box_paint (ClutterActor *actor)
|
|||||||
int border_top, border_bottom, border_left, border_right;
|
int border_top, border_bottom, border_left, border_right;
|
||||||
int padding_top, padding_bottom, padding_left, padding_right;
|
int padding_top, padding_bottom, padding_left, padding_right;
|
||||||
|
|
||||||
/* First, convert everything to pixels */
|
/* shorter variable names (and cast to int while we're at it
|
||||||
border_top = CLUTTER_UNITS_TO_DEVICE (self->priv->border_top);
|
* though I think this is only for historical reasons)
|
||||||
border_bottom = CLUTTER_UNITS_TO_DEVICE (self->priv->border_bottom);
|
*/
|
||||||
border_left = CLUTTER_UNITS_TO_DEVICE (self->priv->border_left);
|
border_top = self->priv->border_top;
|
||||||
border_right = CLUTTER_UNITS_TO_DEVICE (self->priv->border_right);
|
border_bottom = self->priv->border_bottom;
|
||||||
padding_top = CLUTTER_UNITS_TO_DEVICE (self->priv->padding_top);
|
border_left = self->priv->border_left;
|
||||||
padding_bottom = CLUTTER_UNITS_TO_DEVICE (self->priv->padding_bottom);
|
border_right = self->priv->border_right;
|
||||||
padding_left = CLUTTER_UNITS_TO_DEVICE (self->priv->padding_left);
|
padding_top = self->priv->padding_top;
|
||||||
padding_right = CLUTTER_UNITS_TO_DEVICE (self->priv->padding_right);
|
padding_bottom = self->priv->padding_bottom;
|
||||||
|
padding_left = self->priv->padding_left;
|
||||||
|
padding_right = self->priv->padding_right;
|
||||||
|
|
||||||
actor_opacity = clutter_actor_get_paint_opacity (actor);
|
actor_opacity = clutter_actor_get_paint_opacity (actor);
|
||||||
|
|
||||||
@ -2949,10 +2958,10 @@ big_box_set_child_align(BigBox *box,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
big_box_set_padding (BigBox *box, int padding)
|
big_box_set_padding (BigBox *box,
|
||||||
|
int padding)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit padding_in_units;
|
|
||||||
gboolean padding_changed;
|
gboolean padding_changed;
|
||||||
|
|
||||||
g_return_if_fail (BIG_IS_BOX (box));
|
g_return_if_fail (BIG_IS_BOX (box));
|
||||||
@ -2960,32 +2969,30 @@ big_box_set_padding (BigBox *box, int padding)
|
|||||||
|
|
||||||
priv = box->priv;
|
priv = box->priv;
|
||||||
|
|
||||||
padding_in_units = CLUTTER_UNITS_FROM_DEVICE (padding);
|
padding_changed = (priv->padding_top != padding ||
|
||||||
|
priv->padding_bottom != padding ||
|
||||||
padding_changed = (priv->padding_top != padding_in_units ||
|
priv->padding_left != padding ||
|
||||||
priv->padding_bottom != padding_in_units ||
|
priv->padding_right != padding);
|
||||||
priv->padding_left != padding_in_units ||
|
|
||||||
priv->padding_right != padding_in_units);
|
|
||||||
|
|
||||||
if (padding_changed)
|
if (padding_changed)
|
||||||
{
|
{
|
||||||
g_object_freeze_notify (G_OBJECT (box));
|
g_object_freeze_notify (G_OBJECT (box));
|
||||||
|
|
||||||
if (box->priv->padding_top != padding_in_units)
|
if (box->priv->padding_top != padding)
|
||||||
g_object_notify (G_OBJECT (box), "padding-top");
|
g_object_notify (G_OBJECT (box), "padding-top");
|
||||||
box->priv->padding_top = padding_in_units;
|
box->priv->padding_top = padding;
|
||||||
|
|
||||||
if (box->priv->padding_bottom != padding_in_units)
|
if (box->priv->padding_bottom != padding)
|
||||||
g_object_notify (G_OBJECT (box), "padding-bottom");
|
g_object_notify (G_OBJECT (box), "padding-bottom");
|
||||||
box->priv->padding_bottom = padding_in_units;
|
box->priv->padding_bottom = padding;
|
||||||
|
|
||||||
if (box->priv->padding_left != padding_in_units)
|
if (box->priv->padding_left != padding)
|
||||||
g_object_notify (G_OBJECT (box), "padding-left");
|
g_object_notify (G_OBJECT (box), "padding-left");
|
||||||
box->priv->padding_left = padding_in_units;
|
box->priv->padding_left = padding;
|
||||||
|
|
||||||
if (box->priv->padding_right != padding_in_units)
|
if (box->priv->padding_right != padding)
|
||||||
g_object_notify (G_OBJECT (box), "padding-right");
|
g_object_notify (G_OBJECT (box), "padding-right");
|
||||||
box->priv->padding_right = padding_in_units;
|
box->priv->padding_right = padding;
|
||||||
|
|
||||||
g_object_thaw_notify (G_OBJECT (box));
|
g_object_thaw_notify (G_OBJECT (box));
|
||||||
|
|
||||||
@ -2994,10 +3001,10 @@ big_box_set_padding (BigBox *box, int padding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
big_box_set_border_width (BigBox *box, int border_width)
|
big_box_set_border_width (BigBox *box,
|
||||||
|
int border_width)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
ClutterUnit border_in_units;
|
|
||||||
gboolean border_changed;
|
gboolean border_changed;
|
||||||
|
|
||||||
g_return_if_fail (BIG_IS_BOX (box));
|
g_return_if_fail (BIG_IS_BOX (box));
|
||||||
@ -3005,32 +3012,30 @@ big_box_set_border_width (BigBox *box, int border_width)
|
|||||||
|
|
||||||
priv = box->priv;
|
priv = box->priv;
|
||||||
|
|
||||||
border_in_units = CLUTTER_UNITS_FROM_DEVICE (border_width);
|
border_changed = (priv->border_top != border_width ||
|
||||||
|
priv->border_bottom != border_width ||
|
||||||
border_changed = (priv->border_top != border_in_units ||
|
priv->border_left != border_width ||
|
||||||
priv->border_bottom != border_in_units ||
|
priv->border_right != border_width);
|
||||||
priv->border_left != border_in_units ||
|
|
||||||
priv->border_right != border_in_units);
|
|
||||||
|
|
||||||
if (border_changed)
|
if (border_changed)
|
||||||
{
|
{
|
||||||
g_object_freeze_notify (G_OBJECT (box));
|
g_object_freeze_notify (G_OBJECT (box));
|
||||||
|
|
||||||
if (box->priv->border_top != border_in_units)
|
if (box->priv->border_top != border_width)
|
||||||
g_object_notify (G_OBJECT (box), "border-top");
|
g_object_notify (G_OBJECT (box), "border-top");
|
||||||
box->priv->border_top = border_in_units;
|
box->priv->border_top = border_width;
|
||||||
|
|
||||||
if (box->priv->border_bottom != border_in_units)
|
if (box->priv->border_bottom != border_width)
|
||||||
g_object_notify (G_OBJECT (box), "border-bottom");
|
g_object_notify (G_OBJECT (box), "border-bottom");
|
||||||
box->priv->border_bottom = border_in_units;
|
box->priv->border_bottom = border_width;
|
||||||
|
|
||||||
if (box->priv->border_left != border_in_units)
|
if (box->priv->border_left != border_width)
|
||||||
g_object_notify (G_OBJECT (box), "border-left");
|
g_object_notify (G_OBJECT (box), "border-left");
|
||||||
box->priv->border_left = border_in_units;
|
box->priv->border_left = border_width;
|
||||||
|
|
||||||
if (box->priv->border_right != border_in_units)
|
if (box->priv->border_right != border_width)
|
||||||
g_object_notify (G_OBJECT (box), "border-right");
|
g_object_notify (G_OBJECT (box), "border-right");
|
||||||
box->priv->border_right = border_in_units;
|
box->priv->border_right = border_width;
|
||||||
|
|
||||||
g_object_thaw_notify (G_OBJECT (box));
|
g_object_thaw_notify (G_OBJECT (box));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user