diff --git a/goldendict-pr1243.patch b/goldendict-pr1243.patch new file mode 100644 index 0000000..10ae83d --- /dev/null +++ b/goldendict-pr1243.patch @@ -0,0 +1,48 @@ +From 6ca112b797e70774d252b3635d41b4c5d38ea9dd Mon Sep 17 00:00:00 2001 +From: Vitaly Zaitsev +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 +--- + 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 diff --git a/goldendict.spec b/goldendict.spec index 26362d2..d612d2d 100644 --- a/goldendict.spec +++ b/goldendict.spec @@ -3,12 +3,15 @@ Name: goldendict Version: 1.5 -Release: 0.26.RC2%{?dist} +Release: 0.27.RC2%{?dist} Summary: A feature-rich dictionary lookup program License: GPLv3+ URL: http://goldendict.org 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(Qt5XmlPatterns) BuildRequires: cmake(Qt5Multimedia) @@ -83,6 +86,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop %{_datadir}/%{name}/help %changelog +* Fri Mar 27 2020 Vitaly Zaitsev - 1.5-0.27.RC2 +- Use a better workaround for crashes on Wayland. + * Sun Mar 15 2020 Vitaly Zaitsev - 1.5-0.26.RC2 - Rebased to a1c7c5b snapshot with a separate desktop action for Wayland.