mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-23 04:10:11 +00:00
Merge branch 'misc-layout-improvements' into 'main'
Misc layout improvements See merge request GNOME/gtk!8039
This commit is contained in:
commit
1fc190596f
@ -122,7 +122,12 @@ gtk_layout_manager_real_get_request_mode (GtkLayoutManager *manager,
|
||||
child != NULL;
|
||||
child = _gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
GtkSizeRequestMode res = gtk_widget_get_request_mode (child);
|
||||
GtkSizeRequestMode res;
|
||||
|
||||
if (!gtk_widget_should_layout (child))
|
||||
continue;
|
||||
|
||||
res = gtk_widget_get_request_mode (child);
|
||||
|
||||
switch (res)
|
||||
{
|
||||
@ -143,8 +148,8 @@ gtk_layout_manager_real_get_request_mode (GtkLayoutManager *manager,
|
||||
if (hfw == 0 && wfh == 0)
|
||||
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
||||
|
||||
return hfw > wfh ? GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH
|
||||
: GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
|
||||
return hfw >= wfh ? GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH
|
||||
: GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2328,9 +2328,30 @@ gtk_stack_compute_expand (GtkWidget *widget,
|
||||
static GtkSizeRequestMode
|
||||
gtk_stack_get_request_mode (GtkWidget *widget)
|
||||
{
|
||||
GtkStack *stack = GTK_STACK (widget);
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||
GtkWidget *w;
|
||||
int wfh = 0, hfw = 0;
|
||||
|
||||
if (!priv->homogeneous[GTK_ORIENTATION_VERTICAL] &&
|
||||
!priv->homogeneous[GTK_ORIENTATION_HORIZONTAL])
|
||||
{
|
||||
GtkSizeRequestMode lv_mode;
|
||||
|
||||
/* Only the visible child, and perhaps the last visible child
|
||||
* during a transition, matter. Attempt to return constant-size
|
||||
* when we can. */
|
||||
if (priv->last_visible_child)
|
||||
lv_mode = gtk_widget_get_request_mode (priv->last_visible_child->widget);
|
||||
else
|
||||
lv_mode = GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
||||
|
||||
if (lv_mode == GTK_SIZE_REQUEST_CONSTANT_SIZE && priv->visible_child)
|
||||
return gtk_widget_get_request_mode (priv->visible_child->widget);
|
||||
else
|
||||
return lv_mode;
|
||||
}
|
||||
|
||||
for (w = gtk_widget_get_first_child (widget);
|
||||
w != NULL;
|
||||
w = gtk_widget_get_next_sibling (w))
|
||||
|
Loading…
Reference in New Issue
Block a user