[gtk+] Re-realize the window if needed



commit 365902cd58dca6b8dc5e4a92d2b59a269137fcb3
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 24 14:32:00 2014 -0500

    Re-realize the window if needed
    
    When gtk_window_set_titlebar is called, we need to set up
    client-side decorations properly, and the easiest way to do
    so is to realize the window again. Really, you should call
    set_titlebar before the window is realized.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722919

 gtk/gtkwindow.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 132617a..3605f5a 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -3682,9 +3682,14 @@ gtk_window_set_titlebar (GtkWindow *window,
   GtkWidget *widget = GTK_WIDGET (window);
   GtkWindowPrivate *priv = window->priv;
   GdkVisual *visual;
+  gboolean was_mapped;
 
   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);
+
   unset_titlebar (window);
 
   if (titlebar == NULL)
@@ -3715,7 +3720,8 @@ gtk_window_set_titlebar (GtkWindow *window,
   gtk_style_context_add_class (gtk_widget_get_style_context (titlebar),
                                GTK_STYLE_CLASS_TITLEBAR);
 
-  gtk_widget_queue_resize (widget);
+  if (was_mapped)
+    gtk_widget_map (widget);
 }
 
 gboolean


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