[gtk+] Revert "window: Check if we can use CSD before enabling them"



commit 97e728580cba385c7d8e193b7119f67ab507d511
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jun 22 14:19:29 2015 +0100

    Revert "window: Check if we can use CSD before enabling them"
    
    This reverts commit c5e5ee67490e7e7af56052d8f8beb75db002c2f1.
    
    It turns out that this commit breaks the default sizing of GtkWindow,
    which in turn causes the window to be smaller than the handle size,
    which ends up sending invalid rectangles to Cairo.
    
    We'll have to find another way to fix the CSD issue.
    
    See also: https://bugzilla.gnome.org/show_bug.cgi?id=751140
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750343

 gtk/gtkwindow.c |   50 +++++++++++++++++++-------------------------------
 1 files changed, 19 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index fb8e0b0..a8ebf5c 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4057,32 +4057,6 @@ gtk_window_supports_client_shadow (GtkWindow *window)
   return TRUE;
 }
 
-static gboolean
-gtk_window_can_use_csd (GtkWindow *window)
-{
-  const gchar *csd_env;
-
-#ifdef GDK_WINDOWING_BROADWAY
-  if (GDK_IS_BROADWAY_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
-    return TRUE;
-#endif
-
-#ifdef GDK_WINDOWING_WAYLAND
-  if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
-    return TRUE;
-#endif
-
-#ifdef GDK_WINDOWING_MIR
-  if (GDK_IS_MIR_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
-    return TRUE;
-#endif
-
-  csd_env = g_getenv ("GTK_CSD");
-
-  /* If GTK_CSD is unset we default to CSD support */
-  return csd_env == NULL || (strcmp (csd_env, "1") == 0);
-}
-
 static void
 gtk_window_enable_csd (GtkWindow *window)
 {
@@ -4090,10 +4064,6 @@ gtk_window_enable_csd (GtkWindow *window)
   GtkWidget *widget = GTK_WIDGET (window);
   GdkVisual *visual;
 
-  /* If the environment does not support CSD, then there's no point in enabling them */
-  if (!gtk_window_can_use_csd (window))
-    return;
-
   /* We need a visual with alpha for client shadows */
   if (priv->use_client_shadow)
     {
@@ -5870,6 +5840,7 @@ static gboolean
 gtk_window_should_use_csd (GtkWindow *window)
 {
   GtkWindowPrivate *priv = window->priv;
+  const gchar *csd_env;
 
   if (priv->csd_requested)
     return TRUE;
@@ -5880,7 +5851,24 @@ gtk_window_should_use_csd (GtkWindow *window)
   if (priv->type == GTK_WINDOW_POPUP)
     return FALSE;
 
-  return gtk_window_can_use_csd (window);
+#ifdef GDK_WINDOWING_BROADWAY
+  if (GDK_IS_BROADWAY_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
+    return TRUE;
+#endif
+
+#ifdef GDK_WINDOWING_WAYLAND
+  if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
+    return TRUE;
+#endif
+
+#ifdef GDK_WINDOWING_MIR
+  if (GDK_IS_MIR_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
+    return TRUE;
+#endif
+
+  csd_env = g_getenv ("GTK_CSD");
+
+  return (g_strcmp0 (csd_env, "1") == 0);
 }
 
 static void


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