st-entry: don't possibly allocate actors a negative size

Clutter will complain about this, so protect the code against such edge
case.

https://bugzilla.gnome.org/show_bug.cgi?id=783484
This commit is contained in:
Cosimo Cecchi 2017-06-06 17:56:17 -07:00
parent 708f65e388
commit 4e07d0b073

View File

@ -475,7 +475,7 @@ st_entry_allocate (ClutterActor *actor,
clutter_actor_allocate (left_icon, &icon_box, flags);
/* reduce the size for the entry */
child_box.x1 += icon_w + priv->spacing;
child_box.x1 = MIN (child_box.x2, child_box.x1 + icon_w + priv->spacing);
}
if (right_icon)
@ -492,7 +492,7 @@ st_entry_allocate (ClutterActor *actor,
clutter_actor_allocate (right_icon, &icon_box, flags);
/* reduce the size for the entry */
child_box.x2 -= icon_w + priv->spacing;
child_box.x2 = MAX (child_box.x1, child_box.x2 - icon_w - priv->spacing);
}
clutter_actor_get_preferred_height (priv->entry, child_box.x2 - child_box.x1,