mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
clutter/actor: Respect CONTENT_SIZE request mode in get_preferred_* APIs
Right now the CONTENT_SIZE request mode for a ClutterActor is only respected by `clutter_actor_get_preferred_size()`, but not by `get_preferred_width()` and `get_preferred_height()`. Those simply try to ask the layout manager and will return [0, 0] for actors without children. So be consistent and also return the content size in those two functions. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1019
This commit is contained in:
parent
30bf588a38
commit
f2f89d9b46
@ -9725,6 +9725,23 @@ clutter_actor_get_preferred_width (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the request mode is CONTENT_SIZE we simply return the content width */
|
||||
if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
|
||||
{
|
||||
float content_width = 0.f;
|
||||
|
||||
if (priv->content != NULL)
|
||||
clutter_content_get_preferred_size (priv->content, &content_width, NULL);
|
||||
|
||||
if (min_width_p != NULL)
|
||||
*min_width_p = content_width;
|
||||
|
||||
if (natural_width_p != NULL)
|
||||
*natural_width_p = content_width;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
|
||||
|
||||
/* the remaining cases are:
|
||||
@ -9873,6 +9890,23 @@ clutter_actor_get_preferred_height (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the request mode is CONTENT_SIZE we simply return the content height */
|
||||
if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
|
||||
{
|
||||
float content_height = 0.f;
|
||||
|
||||
if (priv->content != NULL)
|
||||
clutter_content_get_preferred_size (priv->content, NULL, &content_height);
|
||||
|
||||
if (min_height_p != NULL)
|
||||
*min_height_p = content_height;
|
||||
|
||||
if (natural_height_p != NULL)
|
||||
*natural_height_p = content_height;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
|
||||
|
||||
/* the remaining cases are:
|
||||
|
Loading…
Reference in New Issue
Block a user