[gtk+] GtkWindow: Fix the shadow width logic



commit a5b1cdd0c1178cbebc86a116645c2ecac62aaf65
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Fri Oct 30 17:38:25 2015 +0100

    GtkWindow: Fix the shadow width logic
    
    Previous commit 305b34a "GtkWindow: fix move/get position with CSD"
    introduced a regression because some windows presumably use shadows but
    actually don't, resulting in a negative offset being wrongly applied.
    
    Problem is that get_shadow_width() would return non-zero shadows even
    for windows that have no shadow, thus causing the negative offset.
    
    Fix the logic in get_shadow_width() and gtk_window_should_use_csd() so
    that get_shadow_width() returns accurate values.
    
    Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756618

 gtk/gtkwindow.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 54030ca..61888d4 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5948,15 +5948,18 @@ gtk_window_should_use_csd (GtkWindow *window)
   GtkWindowPrivate *priv = window->priv;
   const gchar *csd_env;
 
-  if (priv->csd_requested)
-    return TRUE;
-
   if (!priv->decorated)
     return FALSE;
 
   if (priv->type == GTK_WINDOW_POPUP)
     return FALSE;
 
+  if (priv->csd_requested)
+    return TRUE;
+
+  if (priv->use_client_shadow)
+    return TRUE;
+
 #ifdef GDK_WINDOWING_BROADWAY
   if (GDK_IS_BROADWAY_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
     return TRUE;
@@ -6676,8 +6679,10 @@ get_shadow_width (GtkWindow *window,
   if (!priv->decorated)
     return;
 
-  if (!priv->client_decorated &&
-      !(gtk_window_should_use_csd (window) &&
+  if (!priv->client_decorated)
+    return;
+
+  if (!(gtk_window_should_use_csd (window) &&
         gtk_window_supports_client_shadow (window)))
     return;
 


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