[gtk+] Make gtk_window_set_titlebar work on realized windows



commit 0c483e1423d4a0b5f6321e36c2c402c55566df59
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 3 22:38:06 2014 -0500

    Make gtk_window_set_titlebar work on realized windows
    
    Since realize does a lot of the heavy lifting of setting up
    csd, we have to re-realize the window if we go from no-custom
    titlebar to a custom titlebar or vice versa.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722919

 gtk/gtkwindow.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 3605f5a..ea281fe 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -3686,9 +3686,17 @@ gtk_window_set_titlebar (GtkWindow *window,
 
   g_return_if_fail (GTK_IS_WINDOW (window));
 
-  was_mapped = gtk_widget_get_mapped (widget);
-  if (gtk_widget_get_realized (widget))
-    gtk_widget_unrealize (widget);
+  if ((!priv->title_box && titlebar) || (priv->title_box && !titlebar))
+    {
+      was_mapped = gtk_widget_get_mapped (widget);
+      if (gtk_widget_get_realized (widget))
+        {
+          g_warning ("gtk_window_set_titlebar() called on a realized window");
+          gtk_widget_unrealize (widget);
+        }
+    }
+  else
+    was_mapped = FALSE;
 
   unset_titlebar (window);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]