diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-10-19 08:42:33 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-10-19 09:39:07 -0400 |
commit | 81ee273e98c85140ac28c4916dc1311d8792bb17 (patch) | |
tree | c80bf138feb93bc999c2931088355a4755a57cc1 /gtk | |
parent | f3fe1812aa932b22ec2ddfaaa0c09a40078d4d31 (diff) | |
download | gtk+-81ee273e98c85140ac28c4916dc1311d8792bb17.tar.gz |
columnview: Make right-aligned content work
Make right-aligned content work in resized columns.
There is currently no way to make a title right-aligned,
but we can still make it work correctly. This is a follow
up to 7eb0ae39c5549bfaa4e.
Fixes: #3276
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcolumnviewcell.c | 8 | ||||
-rw-r--r-- | gtk/gtkcolumnviewtitle.c | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/gtk/gtkcolumnviewcell.c b/gtk/gtkcolumnviewcell.c index f7db70e04f..1ada1b4292 100644 --- a/gtk/gtkcolumnviewcell.c +++ b/gtk/gtkcolumnviewcell.c @@ -124,15 +124,15 @@ gtk_column_view_cell_size_allocate (GtkWidget *widget, int height, int baseline) { - GtkColumnViewCell *self = GTK_COLUMN_VIEW_CELL (widget); GtkWidget *child = gtk_widget_get_first_child (widget); if (child) { - if (gtk_column_view_column_get_fixed_width (self->column) > -1) - gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, height, NULL, &width, NULL, NULL); + int min; + + gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, height, &min, NULL, NULL, NULL); - gtk_widget_allocate (child, width, height, baseline, NULL); + gtk_widget_allocate (child, MAX (min, width), height, baseline, NULL); } } diff --git a/gtk/gtkcolumnviewtitle.c b/gtk/gtkcolumnviewtitle.c index f2cb4fca83..c76c8a9a8b 100644 --- a/gtk/gtkcolumnviewtitle.c +++ b/gtk/gtkcolumnviewtitle.c @@ -136,10 +136,11 @@ gtk_column_view_title_size_allocate (GtkWidget *widget, if (child) { - if (gtk_column_view_column_get_fixed_width (self->column) > -1) - gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, height, NULL, &width, NULL, NULL); + int min; - gtk_widget_allocate (child, width, height, baseline, NULL); + gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, height, &min, NULL, NULL, NULL); + + gtk_widget_allocate (child, MAX (min, width), height, baseline, NULL); } if (self->popup_menu) |