From 0d860b1994961585b42ea2f25ab5bc8a0fb7331d Mon Sep 17 00:00:00 2001
From: Patrick Storz <eduard.braun2@gmx.de>
Date: Sat, 29 Feb 2020 17:53:19 +0100
Subject: [PATCH] Only install low level keyboard hook if GTK_CSD=1

Added in eece8a7dd2405f76829031f3d6dd5e39fb5dc542 in order to
intercept keyboard combos to provide AeroSnap-like functionality for
CSD windows.

Unfortunately it causes many issues, e.g.
- https://gitlab.gnome.org/GNOME/gtk/issues/2015
- https://gitlab.gnome.org/GNOME/gtk/issues/1082
- https://gitlab.gnome.org/GNOME/gtk/issues/1033

As the hook is completely useless for non-CSD windows, only install
it if CSD is explicitly requested (environment variable GTK_CSD=1).
---
 gdk/win32/gdkevents-win32.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 7aef277c27..8b64d7dd22 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -530,7 +530,9 @@ _gdk_events_init (GdkDisplay *display)
   g_source_set_can_recurse (source, TRUE);
   g_source_attach (source, NULL);
 
-  set_up_low_level_keyboard_hook ();
+  if (g_strcmp0 (g_getenv ("GTK_CSD"), "1") == 0) {
+    set_up_low_level_keyboard_hook ();
+  }
 }
 
 gboolean
-- 
2.25.1.windows.1

