Use a better workaround for crashes on Wayland.

f39
Vitaly Zaitsev 5 years ago
parent 2a8df0eb38
commit 6b88221133
No known key found for this signature in database
GPG Key ID: BF99FC6DD45AB90A

@ -0,0 +1,48 @@
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

@ -3,12 +3,15 @@
Name: goldendict Name: goldendict
Version: 1.5 Version: 1.5
Release: 0.26.RC2%{?dist} Release: 0.27.RC2%{?dist}
Summary: A feature-rich dictionary lookup program Summary: A feature-rich dictionary lookup program
License: GPLv3+ License: GPLv3+
URL: http://goldendict.org URL: http://goldendict.org
Source0: https://github.com/%{owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz Source0: https://github.com/%{owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
# https://github.com/goldendict/goldendict/pull/1243
Patch100: %{name}-pr1243.patch
BuildRequires: cmake(Qt5LinguistTools) BuildRequires: cmake(Qt5LinguistTools)
BuildRequires: cmake(Qt5XmlPatterns) BuildRequires: cmake(Qt5XmlPatterns)
BuildRequires: cmake(Qt5Multimedia) BuildRequires: cmake(Qt5Multimedia)
@ -83,6 +86,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
%{_datadir}/%{name}/help %{_datadir}/%{name}/help
%changelog %changelog
* Fri Mar 27 2020 Vitaly Zaitsev <vitaly@easycoding.org> - 1.5-0.27.RC2
- Use a better workaround for crashes on Wayland.
* Sun Mar 15 2020 Vitaly Zaitsev <vitaly@easycoding.org> - 1.5-0.26.RC2 * Sun Mar 15 2020 Vitaly Zaitsev <vitaly@easycoding.org> - 1.5-0.26.RC2
- Rebased to a1c7c5b snapshot with a separate desktop action for Wayland. - Rebased to a1c7c5b snapshot with a separate desktop action for Wayland.

Loading…
Cancel
Save