[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
This commit is contained in:
Calum Lind 2022-01-21 10:35:09 +00:00
parent 15d2d27a53
commit 4f17fc41a5
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
2 changed files with 7 additions and 3 deletions

View File

@ -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,

View File

@ -0,0 +1,3 @@
import os
os.environ['GTK_CSD'] = os.getenv('GTK_CSD', '0')