Index: gtk+-3.22.5/gtk/gtkwindow.c
===================================================================
--- gtk+-3.22.5.orig/gtk/gtkwindow.c
+++ gtk+-3.22.5/gtk/gtkwindow.c
@@ -6067,7 +6067,11 @@ static gboolean
 gtk_window_should_use_csd (GtkWindow *window)
 {
   GtkWindowPrivate *priv = window->priv;
-  const gchar *csd_env;
+  const gchar *csd_env = g_getenv ("GTK_CSD");
+
+  /* Users can override a program's request for CSD with GTK_CSD. */
+  if (g_strcmp0 (csd_env, "0") == 0)
+    return FALSE;
 
   if (priv->csd_requested)
     return TRUE;
@@ -6078,8 +6082,6 @@ gtk_window_should_use_csd (GtkWindow *wi
   if (priv->type == GTK_WINDOW_POPUP)
     return FALSE;
 
-  csd_env = g_getenv ("GTK_CSD");
-
 #ifdef GDK_WINDOWING_BROADWAY
   if (GDK_IS_BROADWAY_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
     return TRUE;
