From c7f3b93d99f22ed066dbcce4d7bc5e6bd097ad67 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 24 Nov 2014 06:49:19 -0500 Subject: [PATCH] Keep gtk_window_set_hide_titlebar_when_maximized working This broke in 510c2cdfb6362568f4384790dc06e0b1b4aba0e5. https://bugzilla.gnome.org/show_bug.cgi?id=740287 --- gtk/gtkwindow.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 6cb355b56a..c01a47ee00 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -3716,6 +3716,21 @@ gtk_window_get_destroy_with_parent (GtkWindow *window) return window->priv->destroy_with_parent; } +static void +gtk_window_apply_hide_titlebar_when_maximized (GtkWindow *window) +{ +#ifdef GDK_WINDOWING_X11 + GdkWindow *gdk_window; + gboolean setting; + + setting = window->priv->hide_titlebar_when_maximized; + gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); + + if (GDK_IS_X11_WINDOW (gdk_window)) + gdk_x11_window_set_hide_titlebar_when_maximized (gdk_window, setting); +#endif +} + /** * gtk_window_set_hide_titlebar_when_maximized: * @window: a #GtkWindow @@ -3743,18 +3758,9 @@ gtk_window_set_hide_titlebar_when_maximized (GtkWindow *window, if (window->priv->hide_titlebar_when_maximized == setting) return; -#ifdef GDK_WINDOWING_X11 - { - GdkWindow *gdk_window; - - gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); - - if (GDK_IS_X11_WINDOW (gdk_window)) - gdk_x11_window_set_hide_titlebar_when_maximized (gdk_window, setting); - } -#endif - window->priv->hide_titlebar_when_maximized = setting; + gtk_window_apply_hide_titlebar_when_maximized (window); + g_object_notify (G_OBJECT (window), "hide-titlebar-when-maximized"); } @@ -5972,8 +5978,7 @@ gtk_window_map (GtkWidget *widget) if (priv->type == GTK_WINDOW_TOPLEVEL) { gtk_window_set_theme_variant (window); - gtk_window_set_hide_titlebar_when_maximized (window, - priv->hide_titlebar_when_maximized); + gtk_window_apply_hide_titlebar_when_maximized (window); } /* No longer use the default settings */