frames: Add CSS class on init

Adding the 'default-decoration' CSS class to MetaFrameHeader after
it is set as the headerbar makes it not account for the minimum size
correctly sometimes. This is a bit racy though - if the window opens
very quickly, it works as expected.

Adding the CSS class before the widget is used guarantees it'll
always report the correct size though, so do that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2753>
This commit is contained in:
Georges Basile Stavracas Neto 2022-12-09 12:25:07 -03:00
parent 88a53cc9ce
commit ac09ce11fd
2 changed files with 2 additions and 1 deletions

View File

@ -118,6 +118,8 @@ meta_frame_header_init (MetaFrameHeader *content)
gtk_widget_add_css_class (header_bar, "titlebar"); gtk_widget_add_css_class (header_bar, "titlebar");
gtk_widget_add_css_class (header_bar, "default-decoration"); gtk_widget_add_css_class (header_bar, "default-decoration");
gtk_widget_insert_before (header_bar, GTK_WIDGET (content), NULL); gtk_widget_insert_before (header_bar, GTK_WIDGET (content), NULL);
gtk_widget_add_css_class (GTK_WIDGET (content), "default-decoration");
} }
GtkWidget * GtkWidget *

View File

@ -228,7 +228,6 @@ meta_frame_new (Window window)
header = meta_frame_header_new (); header = meta_frame_header_new ();
gtk_window_set_titlebar (GTK_WINDOW (frame), header); gtk_window_set_titlebar (GTK_WINDOW (frame), header);
gtk_widget_add_css_class (frame, "default-decoration");
content = meta_frame_content_new (window); content = meta_frame_content_new (window);
gtk_window_set_child (GTK_WINDOW (frame), content); gtk_window_set_child (GTK_WINDOW (frame), content);