diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index aebfd91ac7..51a35d95fc 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -1160,7 +1160,7 @@ gtk_paned_get_preferred_size_for_opposite_orientation (GtkWidget *widget, int *natural) { GtkPaned *paned = GTK_PANED (widget); - int for_start_child, for_end_child; + int for_start_child, for_end_child, for_handle; int child_min, child_nat; if (size > -1 && @@ -1168,22 +1168,21 @@ gtk_paned_get_preferred_size_for_opposite_orientation (GtkWidget *widget, paned->end_child && gtk_widget_get_visible (paned->end_child)) { int start_child_req, end_child_req; - int handle_size; gtk_widget_measure (paned->handle_widget, - OPPOSITE_ORIENTATION (paned->orientation), + paned->orientation, -1, - NULL, &handle_size, + NULL, &for_handle, NULL, NULL); gtk_widget_measure (paned->start_child, paned->orientation, -1, &start_child_req, NULL, NULL, NULL); gtk_widget_measure (paned->end_child, paned->orientation, -1, &end_child_req, NULL, NULL, NULL); gtk_paned_compute_position (paned, - size - handle_size, start_child_req, end_child_req, + size - for_handle, start_child_req, end_child_req, NULL, NULL, &for_start_child); - for_end_child = size - for_start_child - handle_size; + for_end_child = size - for_start_child - for_handle; if (paned->shrink_start_child) for_start_child = MAX (start_child_req, for_start_child); @@ -1194,6 +1193,7 @@ gtk_paned_get_preferred_size_for_opposite_orientation (GtkWidget *widget, { for_start_child = size; for_end_child = size; + for_handle = -1; } *minimum = *natural = 0; @@ -1202,7 +1202,7 @@ gtk_paned_get_preferred_size_for_opposite_orientation (GtkWidget *widget, { gtk_widget_measure (paned->start_child, OPPOSITE_ORIENTATION (paned->orientation), - MAX (for_start_child, -1), + for_start_child, &child_min, &child_nat, NULL, NULL); @@ -1214,7 +1214,20 @@ gtk_paned_get_preferred_size_for_opposite_orientation (GtkWidget *widget, { gtk_widget_measure (paned->end_child, OPPOSITE_ORIENTATION (paned->orientation), - MAX (for_end_child, -1), + for_end_child, + &child_min, &child_nat, + NULL, NULL); + + *minimum = MAX (*minimum, child_min); + *natural = MAX (*natural, child_nat); + } + + if (paned->start_child && gtk_widget_get_visible (paned->start_child) && + paned->end_child && gtk_widget_get_visible (paned->end_child)) + { + gtk_widget_measure (paned->handle_widget, + OPPOSITE_ORIENTATION (paned->orientation), + for_handle, &child_min, &child_nat, NULL, NULL); diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build index c87eb278dd..5f36c6ddb4 100644 --- a/testsuite/reftests/meson.build +++ b/testsuite/reftests/meson.build @@ -427,6 +427,9 @@ testdata = [ 'opacity-initial.ui', 'overlay-no-main-widget.ref.ui', 'overlay-no-main-widget.ui', + 'paned-handle-size.css', + 'paned-handle-size.ref.ui', + 'paned-handle-size.ui', 'paned-undersized.css', 'paned-undersized.ref.ui', 'paned-undersized.ui', diff --git a/testsuite/reftests/paned-handle-size.css b/testsuite/reftests/paned-handle-size.css new file mode 100644 index 0000000000..502437c543 --- /dev/null +++ b/testsuite/reftests/paned-handle-size.css @@ -0,0 +1,15 @@ +paned separator, +picture { + all: unset; + background: firebrick; +} + +paned.vertical > separator { + min-width: 10px; + min-height: 20px; +} + +paned.horizontal > separator { + min-width: 20px; + min-height: 10px; +} diff --git a/testsuite/reftests/paned-handle-size.ref.ui b/testsuite/reftests/paned-handle-size.ref.ui new file mode 100644 index 0000000000..72a83a93c3 --- /dev/null +++ b/testsuite/reftests/paned-handle-size.ref.ui @@ -0,0 +1,55 @@ + + + + 0 + + + + + vertical + + + top left + + + + + 20 + + + + + bottom left + + + + + + + 20 + + + + + vertical + + + top right + + + + + 20 + + + + + bottom right + + + + + + + + diff --git a/testsuite/reftests/paned-handle-size.ui b/testsuite/reftests/paned-handle-size.ui new file mode 100644 index 0000000000..c050dd2fde --- /dev/null +++ b/testsuite/reftests/paned-handle-size.ui @@ -0,0 +1,40 @@ + + + + 0 + + + + + vertical + + + top left + + + + + bottom left + + + + + + + vertical + + + top right + + + + + bottom right + + + + + + + +