[gtk+/gtk-3-16] GtkWindow: Get the correct shadow width even before window is realized



commit be8ff8e56a942b3193804a14f707f83851b464d0
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Apr 29 15:08:44 2015 +0800

    GtkWindow: Get the correct shadow width even before window is realized
    
    The window state 'client_decorated' will only be set the window is being
    realized. If anyone tries to get the shadow size before that it'd get
    the with as if there always was no shadow.
    
    This avoids negative sized opaque regions caused by the allocation being
    smaller than shadow.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748615

 gtk/gtkwindow.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 3ec7e09..0751194 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6468,7 +6468,8 @@ static void
 get_shadow_width (GtkWidget *widget,
                   GtkBorder *shadow_width)
 {
-  GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv;
+  GtkWindow *window = GTK_WINDOW (widget);
+  GtkWindowPrivate *priv = window->priv;
   GtkBorder border = { 0 };
   GtkBorder d = { 0 };
   GtkBorder margin;
@@ -6480,7 +6481,8 @@ get_shadow_width (GtkWidget *widget,
   *shadow_width = border;
 
   if (!priv->decorated ||
-      !priv->client_decorated)
+      !gtk_window_should_use_csd (window) ||
+      !gtk_window_supports_client_shadow (window))
     return;
 
   if (priv->maximized ||


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