Add patch to re-enable KDE4 detection and enable gtk3-kde5 integratio plugin

This commit is contained in:
Andrey Bondrov 2020-03-25 22:46:07 +10:00
parent 1c86212e00
commit 8ec20b6230
2 changed files with 173 additions and 4 deletions

View file

@ -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 );

View file

@ -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
@ -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
@ -533,7 +534,6 @@ This package contains the GNOME VFS support and a GConf backend.
#----------------------------------------------------------------------------
%if %{with gtk3-kde5}
%package gtk3-kde5
Summary: GTK3-KDE5 Integration for LibreOffice (Widgets, Dialogs, Addressbook)
Group: Office
@ -547,7 +547,6 @@ KDE5/Qt5.x and a KDEish File Picker when running under KDE5.
%files gtk3-kde5
%{ooodir}/program/libvclplug_gtk3_kde5lo.so
%{ooodir}/program/lo_kde5filepicker
%endif
#----------------------------------------------------------------------------