From 4f17fc41a506aeba6c595ef7ee2e53fbbd4aeeca Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 21 Jan 2022 10:35:09 +0000 Subject: [PATCH] [Packaging] Disable GTK CSD by default on Windows CirnoT reported how they felt that GTK3 is not reliable on Windows. Seeing some weird issues where clicking Deluge icon on taskbar does bring window to front but doing so again does not minimize it as one would expect. By using GTK_CSD=0 this would reduce these problems. > If changed to 0, this disables the default use of client-side decorations on GTK windows, thus making the window manager responsible for drawing the decorations of windows that do not have a custom titlebar widget. This can be overridden by a global env var. Ref: https://github.com/deluge-torrent/deluge/pull/331#issuecomment-1012311605 Ref: https://docs.gtk.org/gtk3/running.html --- packaging/win/delugewin.spec | 7 ++++--- packaging/win/pyi_rth_gtk_csd.py | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 packaging/win/pyi_rth_gtk_csd.py diff --git a/packaging/win/delugewin.spec b/packaging/win/delugewin.spec index fb7ec6895..d6c93d923 100644 --- a/packaging/win/delugewin.spec +++ b/packaging/win/delugewin.spec @@ -9,6 +9,7 @@ from PyInstaller.utils.hooks import collect_all, copy_metadata datas = [] binaries = [] hiddenimports = [] +runtime_hooks_gtk = [os.path.join(SPECPATH, 'pyi_rth_gtk_csd.py')] # Collect Meta Data datas += copy_metadata('deluge', recursive=True) @@ -72,7 +73,7 @@ b = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir)) + '\Sc hiddenimports=hiddenimports, hookspath=[], hooksconfig={}, - runtime_hooks=[], + runtime_hooks=runtime_hooks_gtk, excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, @@ -166,7 +167,7 @@ e = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir)) + '\Sc hiddenimports=hiddenimports, hookspath=[], hooksconfig={}, - runtime_hooks=[], + runtime_hooks=runtime_hooks_gtk, excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, @@ -197,7 +198,7 @@ f = Analysis([os.path.abspath(os.path.join(HOMEPATH,os.pardir,os.pardir)) + '\Sc hiddenimports=hiddenimports, hookspath=[], hooksconfig={}, - runtime_hooks=[], + runtime_hooks=runtime_hooks_gtk, excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, diff --git a/packaging/win/pyi_rth_gtk_csd.py b/packaging/win/pyi_rth_gtk_csd.py new file mode 100644 index 000000000..345122dd6 --- /dev/null +++ b/packaging/win/pyi_rth_gtk_csd.py @@ -0,0 +1,3 @@ +import os + +os.environ['GTK_CSD'] = os.getenv('GTK_CSD', '0')