diff --git a/libreoffice-6.3.5.2-kde4-detection.patch b/libreoffice-6.3.5.2-kde4-detection.patch new file mode 100644 index 0000000..6918038 --- /dev/null +++ b/libreoffice-6.3.5.2-kde4-detection.patch @@ -0,0 +1,170 @@ +diff -urN libreoffice-6.3.5.2/vcl/inc/unx/desktops.hxx libreoffice-6.3.5.2-patched/vcl/inc/unx/desktops.hxx +--- libreoffice-6.3.5.2/vcl/inc/unx/desktops.hxx 2020-02-11 22:14:56.000000000 +1000 ++++ libreoffice-6.3.5.2-patched/vcl/inc/unx/desktops.hxx 2020-03-25 22:24:27.343432021 +1000 +@@ -31,6 +31,7 @@ + DESKTOP_UNITY, + DESKTOP_XFCE, + DESKTOP_MATE, ++ DESKTOP_KDE4, + DESKTOP_KDE5, + DESKTOP_LXQT + }; // keep in sync with desktop_strings[] in salplug.cxx +diff -urN libreoffice-6.3.5.2/vcl/source/app/IconThemeSelector.cxx libreoffice-6.3.5.2-patched/vcl/source/app/IconThemeSelector.cxx +--- libreoffice-6.3.5.2/vcl/source/app/IconThemeSelector.cxx 2020-02-11 22:14:56.000000000 +1000 ++++ libreoffice-6.3.5.2-patched/vcl/source/app/IconThemeSelector.cxx 2020-03-25 22:24:27.343432021 +1000 +@@ -56,7 +56,8 @@ + return OUString("colibre"); + #else + OUString r; +- if ( desktopEnvironment.equalsIgnoreAsciiCase("kde5") || ++ if ( desktopEnvironment.equalsIgnoreAsciiCase("kde4") || ++ desktopEnvironment.equalsIgnoreAsciiCase("kde5") || + desktopEnvironment.equalsIgnoreAsciiCase("lxqt") ) { + r = "breeze"; + } +diff -urN libreoffice-6.3.5.2/vcl/source/app/salplug.cxx libreoffice-6.3.5.2-patched/vcl/source/app/salplug.cxx +--- libreoffice-6.3.5.2/vcl/source/app/salplug.cxx 2020-02-11 22:14:56.000000000 +1000 ++++ libreoffice-6.3.5.2-patched/vcl/source/app/salplug.cxx 2020-03-25 22:41:24.079451287 +1000 +@@ -95,6 +95,8 @@ + * not access the 'gnome_accessibility_module_shutdown' anymore. + * So make sure libgtk+ & co are still mapped into memory when + * atk-bridge's atexit handler gets called. ++ * #i109007# KDE3 seems to have the same problem. ++ * And same applies for KDE4. + */ + if( rModuleBase == "gtk" || rModuleBase == "gtk3" || rModuleBase == "gtk3_kde5" || rModuleBase == "win" ) + { +@@ -185,7 +187,8 @@ + desktop == DESKTOP_XFCE || + desktop == DESKTOP_MATE ) + pList = pStandardFallbackList; +- else if( desktop == DESKTOP_KDE5 || ++ else if( desktop == DESKTOP_KDE4 || ++ desktop == DESKTOP_KDE5 || + desktop == DESKTOP_LXQT ) + pList = pKDEFallbackList; + +@@ -318,7 +321,8 @@ + // Order to match desktops.hxx' DesktopType + static const char * const desktop_strings[] = { + "none", "unknown", "GNOME", "UNITY", +- "XFCE", "MATE", "KDE5", "LXQT" }; ++ "XFCE", "MATE", "KDE4", "KDE5", ++ "LXQT" }; + static OUString aDesktopEnvironment; + if( aDesktopEnvironment.isEmpty()) + { +diff -urN libreoffice-6.3.5.2/vcl/unx/generic/desktopdetect/desktopdetector.cxx libreoffice-6.3.5.2-patched/vcl/unx/generic/desktopdetect/desktopdetector.cxx +--- libreoffice-6.3.5.2/vcl/unx/generic/desktopdetect/desktopdetector.cxx 2020-02-11 22:14:56.000000000 +1000 ++++ libreoffice-6.3.5.2-patched/vcl/unx/generic/desktopdetect/desktopdetector.cxx 2020-03-25 22:28:24.099436507 +1000 +@@ -116,6 +116,80 @@ + } + + ++static bool bWasXError = false; ++ ++static bool WasXError() ++{ ++ bool bRet = bWasXError; ++ bWasXError = false; ++ return bRet; ++} ++ ++extern "C" ++{ ++ static int autodect_error_handler( Display*, XErrorEvent* ) ++ { ++ bWasXError = true; ++ return 0; ++ } ++ ++ typedef int(* XErrorHandler)(Display*,XErrorEvent*); ++} ++ ++static int KDEVersion( Display* pDisplay ) ++{ ++ int nRet = 0; ++ ++ Atom nFullSession = XInternAtom( pDisplay, "KDE_FULL_SESSION", True ); ++ Atom nKDEVersion = XInternAtom( pDisplay, "KDE_SESSION_VERSION", True ); ++ ++ if( nFullSession ) ++ { ++ if( !nKDEVersion ) ++ return 3; ++ ++ Atom aRealType = None; ++ int nFormat = 8; ++ unsigned long nItems = 0; ++ unsigned long nBytesLeft = 0; ++ unsigned char* pProperty = nullptr; ++ XGetWindowProperty( pDisplay, ++ DefaultRootWindow( pDisplay ), ++ nKDEVersion, ++ 0, 1, ++ False, ++ AnyPropertyType, ++ &aRealType, ++ &nFormat, ++ &nItems, ++ &nBytesLeft, ++ &pProperty ); ++ if( !WasXError() && nItems != 0 && pProperty ) ++ { ++ nRet = *reinterpret_cast< sal_Int32* >( pProperty ); ++ } ++ if( pProperty ) ++ { ++ XFree( pProperty ); ++ pProperty = nullptr; ++ } ++ } ++ return nRet; ++} ++ ++static bool is_kde4_desktop( Display* pDisplay ) ++{ ++ static const char * pFullVersion = getenv( "KDE_FULL_SESSION" ); ++ static const char * pSessionVersion = getenv( "KDE_SESSION_VERSION" ); ++ if ( pFullVersion && pSessionVersion && strcmp(pSessionVersion, "4") == 0 ) ++ return true; ++ ++ if ( KDEVersion( pDisplay ) == 4 ) ++ return true; ++ ++ return false; ++} ++ + static bool is_kde5_desktop() + { + static const char * pFullVersion = getenv( "KDE_FULL_SESSION" ); +@@ -141,6 +215,8 @@ + return DESKTOP_LXQT; + if ( aOver.equalsIgnoreAsciiCase( "kde5" ) ) + return DESKTOP_KDE5; ++ if ( aOver.equalsIgnoreAsciiCase( "kde4" ) ) ++ return DESKTOP_KDE4; + if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) + return DESKTOP_GNOME; + if ( aOver.equalsIgnoreAsciiCase( "gnome-wayland" ) ) +@@ -248,10 +324,16 @@ + return DESKTOP_NONE; + + DesktopType ret; +- if ( is_gnome_desktop( pDisplay ) ) +- ret = DESKTOP_GNOME; +- else +- ret = DESKTOP_UNKNOWN; ++ XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); ++ if ( is_kde4_desktop( pDisplay ) ) ++ ret = DESKTOP_KDE4; ++ else if ( is_gnome_desktop( pDisplay ) ) ++ ret = DESKTOP_GNOME; ++ else ++ ret = DESKTOP_UNKNOWN; ++ ++ // set the default handler again ++ XSetErrorHandler( pOldHdl ); + + XCloseDisplay( pDisplay ); + diff --git a/libreoffice.spec b/libreoffice.spec index d5446f8..1ed272e 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -7,7 +7,7 @@ %bcond_with icecream %bcond_with ccache %bcond_with clang -%bcond_with gtk3-kde5 +%bcond_without gtk3-kde5 %if %{with l10n} %define langs en-US af ar as bg bn br bs ca cs cy da de dz el en-GB es et eu fa fi fr ga gl gu he hi hr hu it ja ko kn lt lv mai mk ml mr nb nl nn nr nso or pa-IN pl pt pt-BR ro ru si sk sl sr ss st sv ta te th tn tr ts uk ve xh zh-TW zh-CN zu @@ -17,7 +17,7 @@ %define helplangs en-US %endif -%define javaless 0 +%define javaless 1 %define relurl http://download.documentfoundation.org/libreoffice/src/%{version} %define devurl http://dev-www.libreoffice.org/ooo_external @@ -45,7 +45,7 @@ Summary: Office suite Name: libreoffice Epoch: 1 Version: 6.3.5 -Release: 1 +Release: 2 License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic Group: Office Url: http://www.libreoffice.org @@ -89,6 +89,7 @@ Source1000: libreoffice.rpmlintrc Patch0: libreoffice-5.4.0.1-disable-test-languagetag.patch Patch1: libreoffice-4.2.5-icu-49.patch +Patch2: libreoffice-6.3.5.2-kde4-detection.patch # ROSA vendor patch Patch100: libreoffice-4.1-vendor.patch @@ -182,7 +183,7 @@ BuildRequires: pkgconfig(libe-book-0.1) BuildRequires: pkgconfig(libeot) BuildRequires: pkgconfig(libexttextcat) BuildRequires: pkgconfig(libepubgen-0.1) -BuildRequires: pkgconfig(libixion-0.15) +BuildRequires: pkgconfig(libixion-0.14) BuildRequires: pkgconfig(liblangtag) BuildRequires: pkgconfig(libmspub-0.1) BuildRequires: pkgconfig(libmwaw-0.3) >= 0.3.4 @@ -204,7 +205,7 @@ BuildRequires: pkgconfig(libwpg-0.3) BuildRequires: pkgconfig(libwps-0.4) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libxslt) -BuildRequires: pkgconfig(mdds-1.5) +BuildRequires: pkgconfig(mdds-1.4) BuildRequires: pkgconfig(mythes) BuildRequires: pkgconfig(neon) BuildRequires: pkgconfig(nspr) @@ -555,6 +556,7 @@ Summary: KDE5 Integration for LibreOffice (Widgets, Dialogs, Addressbook) Group: Office Requires: %{name}-common = %{EVRD} Recommends: %{name}-style-breeze = %{EVRD} +Obsoletes: %{name}-kde4 < %{EVRD} %description kde5 This package contains the KDE5 plugin for drawing LibreOffice widgets with