bin-layout: Fix text direction checks
When using the new ActorAlign flags we must get the real alignment for the horizontal axis, as clutter_actor_allocate() will compute the effective alignment by itself; if we use the effective alignment then ClutterActor.allocate() will swap it, and undo our work. When using the old BinAlignment flags we should reverse the alignment depending on whether the text direction of the child is RTL or LTR. See bug: https://bugzilla.gnome.org/show_bug.cgi?id=684214
This commit is contained in:
parent
4578a87d1d
commit
64c7973c74
@ -382,7 +382,8 @@ clutter_bin_layout_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gdouble
|
static gdouble
|
||||||
get_bin_alignment_factor (ClutterBinAlignment alignment)
|
get_bin_alignment_factor (ClutterBinAlignment alignment,
|
||||||
|
ClutterTextDirection text_dir)
|
||||||
{
|
{
|
||||||
switch (alignment)
|
switch (alignment)
|
||||||
{
|
{
|
||||||
@ -390,10 +391,10 @@ get_bin_alignment_factor (ClutterBinAlignment alignment)
|
|||||||
return 0.5;
|
return 0.5;
|
||||||
|
|
||||||
case CLUTTER_BIN_ALIGNMENT_START:
|
case CLUTTER_BIN_ALIGNMENT_START:
|
||||||
return 0.0;
|
return text_dir == CLUTTER_TEXT_DIRECTION_LTR ? 0.0 : 1.0;
|
||||||
|
|
||||||
case CLUTTER_BIN_ALIGNMENT_END:
|
case CLUTTER_BIN_ALIGNMENT_END:
|
||||||
return 1.0;
|
return text_dir == CLUTTER_TEXT_DIRECTION_LTR ? 1.0 : 0.0;
|
||||||
|
|
||||||
case CLUTTER_BIN_ALIGNMENT_FIXED:
|
case CLUTTER_BIN_ALIGNMENT_FIXED:
|
||||||
case CLUTTER_BIN_ALIGNMENT_FILL:
|
case CLUTTER_BIN_ALIGNMENT_FILL:
|
||||||
@ -497,16 +498,20 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
{
|
{
|
||||||
ClutterActorAlign align;
|
ClutterActorAlign align;
|
||||||
|
|
||||||
align = _clutter_actor_get_effective_x_align (child);
|
align = clutter_actor_get_x_align (child);
|
||||||
x_fill = align == CLUTTER_ACTOR_ALIGN_FILL;
|
x_fill = align == CLUTTER_ACTOR_ALIGN_FILL;
|
||||||
x_align = get_actor_align_factor (align);
|
x_align = get_actor_align_factor (align);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ClutterTextDirection text_dir;
|
||||||
|
|
||||||
x_fill = (layer->x_align == CLUTTER_BIN_ALIGNMENT_FILL);
|
x_fill = (layer->x_align == CLUTTER_BIN_ALIGNMENT_FILL);
|
||||||
|
|
||||||
|
text_dir = clutter_actor_get_text_direction (child);
|
||||||
|
|
||||||
if (!is_fixed_position_set)
|
if (!is_fixed_position_set)
|
||||||
x_align = get_bin_alignment_factor (layer->x_align);
|
x_align = get_bin_alignment_factor (layer->x_align, text_dir);
|
||||||
else
|
else
|
||||||
x_align = 0.0;
|
x_align = 0.0;
|
||||||
}
|
}
|
||||||
@ -524,7 +529,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
y_fill = (layer->y_align == CLUTTER_BIN_ALIGNMENT_FILL);
|
y_fill = (layer->y_align == CLUTTER_BIN_ALIGNMENT_FILL);
|
||||||
|
|
||||||
if (!is_fixed_position_set)
|
if (!is_fixed_position_set)
|
||||||
y_align = get_bin_alignment_factor (layer->y_align);
|
y_align = get_bin_alignment_factor (layer->y_align,
|
||||||
|
CLUTTER_TEXT_DIRECTION_LTR);
|
||||||
else
|
else
|
||||||
y_align = 0.0;
|
y_align = 0.0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user