You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
goldendict/goldendict-pr1243.patch

49 lines
1.6 KiB

From 6ca112b797e70774d252b3635d41b4c5d38ea9dd Mon Sep 17 00:00:00 2001
From: Vitaly Zaitsev <vitaly@easycoding.org>
Date: Fri, 27 Mar 2020 11:08:52 +0100
Subject: [PATCH] Use a better workaround for Wayland crashes.
GoldenDict use lots of X11 functions and it currently cannot work natively on Wayland. This workaround will force GoldenDict to use XWayland.
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
---
main.cc | 11 +++++++++++
redist/goldendict.desktop | 5 -----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/main.cc b/main.cc
index b3f16ed7..f6a85c07 100644
--- a/main.cc
+++ b/main.cc
@@ -212,6 +212,17 @@ class LogFilePtrGuard
int main( int argc, char ** argv )
{
+#ifdef Q_OS_UNIX
+ // GoldenDict use lots of X11 functions and it currently cannot work
+ // natively on Wayland. This workaround will force GoldenDict to use
+ // XWayland.
+ char * xdg_envc = getenv("XDG_SESSION_TYPE");
+ QString xdg_session = xdg_envc ? QString::fromLatin1(xdg_envc) : QString();
+ if (!QString::compare(xdg_session, QString("wayland"), Qt::CaseInsensitive))
+ {
+ setenv("QT_QPA_PLATFORM", "xcb", 1);
+ }
+#endif
#ifdef Q_OS_MAC
setenv("LANG", "en_US.UTF-8", 1);
diff --git a/redist/goldendict.desktop b/redist/goldendict.desktop
index 13a5fe8f..9cb1d574 100755
--- a/redist/goldendict.desktop
+++ b/redist/goldendict.desktop
@@ -7,8 +7,3 @@ GenericName=Multiformat Dictionary
Comment=GoldenDict
Icon=goldendict
Exec=goldendict
-Actions=X11;
-
-[Desktop Action X11]
-Name=GoldenDict (X11)
-Exec=env QT_QPA_PLATFORM=xcb goldendict