[ooo-build-commit] patches/dev300
Jan Holesovsky
kendy at kemper.freedesktop.org
Wed Jun 17 07:11:56 PDT 2009
patches/dev300/kde4-plugin-detection.diff | 138 ++++++++++++++++++++++++++----
1 file changed, 124 insertions(+), 14 deletions(-)
New commits:
commit 38b7091fd9a9560bc7df7ca00f766aaa35ee3164
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 17 16:05:51 2009 +0200
Detect KDE3/4 correctly using the XWindow atoms.
* patches/dev300/kde4-plugin-detection.diff: KDE_FULL_SESSSION and
KDE_SESSION_VERSION atoms check.
diff --git a/patches/dev300/kde4-plugin-detection.diff b/patches/dev300/kde4-plugin-detection.diff
index 137e544..7b71fb8 100644
--- a/patches/dev300/kde4-plugin-detection.diff
+++ b/patches/dev300/kde4-plugin-detection.diff
@@ -1,5 +1,5 @@
diff --git vcl/unx/source/plugadapt/salplug.cxx vcl/unx/source/plugadapt/salplug.cxx
-index a104ce3..3c71b47 100644
+index e33d05d..a3b60ba 100644
--- vcl/unx/source/plugadapt/salplug.cxx
+++ vcl/unx/source/plugadapt/salplug.cxx
@@ -55,13 +55,16 @@ typedef SalInstance*(*salFactoryProc)( oslModule pModule);
@@ -25,15 +25,117 @@ index a104ce3..3c71b47 100644
static SalInstance* tryInstance( const OUString& rModuleBase )
{
-@@ -302,15 +305,36 @@ static OUString getNetWMName( Display* pDisplay )
- return aRet;
+@@ -214,15 +217,18 @@ extern "C"
+ typedef int(* XErrorHandler)(Display*,XErrorEvent*);
}
--static bool is_kde_desktop( Display* pDisplay )
-+static bool is_kde_desktop(Display*)
+-static OUString getNetWMName( Display* pDisplay )
++static int KDEVersion( Display* pDisplay )
+ {
+- OUString aRet;
++ int nRet = 0;
+
+- Atom nWmCheck = XInternAtom( pDisplay, "_NET_SUPPORTING_WM_CHECK", True );
+- Atom nWmName = XInternAtom( pDisplay, "_NET_WM_NAME", True );
+- if( nWmName && nWmCheck )
++ Atom nFullSession = XInternAtom( pDisplay, "KDE_FULL_SESSION", True );
++ Atom nKDEVersion = XInternAtom( pDisplay, "KDE_SESSION_VERSION", True );
++
++ if( nFullSession )
+ {
+- XLIB_Window aCheckWin = None;
++ if( !nKDEVersion )
++ return 3;
++
+ Atom aRealType = None;
+ int nFormat = 8;
+ unsigned long nItems = 0;
+@@ -230,88 +236,65 @@ static OUString getNetWMName( Display* pDisplay )
+ unsigned char* pProperty = NULL;
+ XGetWindowProperty( pDisplay,
+ DefaultRootWindow( pDisplay ),
+- nWmCheck,
++ nKDEVersion,
+ 0, 1,
+ False,
+- XA_WINDOW,
++ AnyPropertyType,
+ &aRealType,
+ &nFormat,
+ &nItems,
+ &nBytesLeft,
+ &pProperty );
+- if( aRealType == XA_WINDOW && nFormat == 32 && nItems != 0 )
+- aCheckWin = *(XLIB_Window*)pProperty;
++ if( !WasXError() && nItems != 0 && pProperty )
++ {
++ nRet = *reinterpret_cast< sal_Int32* >( pProperty );
++ }
+ if( pProperty )
+ {
+ XFree( pProperty );
+ pProperty = NULL;
+ }
+-
+- // see if that window really exists and has the check property set
+- if( aCheckWin != None )
+- {
+- // clear error flag
+- WasXError();
+- // get the property
+- XGetWindowProperty( pDisplay,
+- aCheckWin,
+- nWmCheck,
+- 0, 1,
+- False,
+- XA_WINDOW,
+- &aRealType,
+- &nFormat,
+- &nItems,
+- &nBytesLeft,
+- &pProperty );
+- if( ! WasXError() && aRealType == XA_WINDOW && nFormat == 32 && nItems != 0 && pProperty )
+- {
+- if( aCheckWin == *(XLIB_Window*)pProperty )
+- {
+- XFree( pProperty );
+- pProperty = NULL;
+- XGetWindowProperty( pDisplay,
+- aCheckWin,
+- nWmName,
+- 0, 256,
+- False,
+- AnyPropertyType,
+- &aRealType,
+- &nFormat,
+- &nItems,
+- &nBytesLeft,
+- &pProperty );
+- if( !WasXError() && nItems != 0 && pProperty && *pProperty )
+- {
+- if( aRealType == XA_STRING ) // some WM's use this although the should use UTF8_STRING
+- {
+- aRet = rtl::OStringToOUString( rtl::OString( (sal_Char*)pProperty ), RTL_TEXTENCODING_ISO_8859_1 );
+- }
+- else
+- aRet = rtl::OStringToOUString( rtl::OString( (sal_Char*)pProperty ), RTL_TEXTENCODING_UTF8 );
+- }
+- }
+- }
+- if( pProperty )
+- {
+- XFree( pProperty );
+- pProperty = NULL;
+- }
+- }
+ }
+- return aRet;
++ return nRet;
+ }
+
+ static bool is_kde_desktop( Display* pDisplay )
{
if ( NULL != getenv( "KDE_FULL_SESSION" ) )
-- return true;
+ {
+ const char *pVer = getenv( "KDE_SESSION_VERSION" );
+ if ( !pVer || pVer[0] == '0' )
@@ -47,15 +149,18 @@ index a104ce3..3c71b47 100644
+ return true;
+ }
+ }
-
++
++ if ( KDEVersion( pDisplay ) == 3 )
+ return true;
+-
- // check for kwin
- rtl::OUString aWM = getNetWMName( pDisplay );
- if( aWM.equalsIgnoreAsciiCaseAscii( "KWin" ) )
-- return true;
++
+ return false;
+}
+
-+static bool is_kde4_desktop(Display*)
++static bool is_kde4_desktop( Display* pDisplay )
+{
+ if ( NULL != getenv( "KDE_FULL_SESSION" ) )
+ {
@@ -65,10 +170,15 @@ index a104ce3..3c71b47 100644
+ if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) )
+ return true;
+ }
-
++
++ if ( KDEVersion( pDisplay ) == 4 )
+ return true;
+-
++
return false;
}
-@@ -344,6 +368,8 @@ static const char * get_desktop_environment()
+
+@@ -344,6 +327,8 @@ static const char * get_desktop_environment()
pRet = desktop_strings[DESKTOP_CDE];
if ( aOver.equalsIgnoreAsciiCase( "kde" ) )
pRet = desktop_strings[DESKTOP_KDE];
@@ -77,7 +187,7 @@ index a104ce3..3c71b47 100644
if ( aOver.equalsIgnoreAsciiCase( "gnome" ) )
pRet = desktop_strings[DESKTOP_GNOME];
if ( aOver.equalsIgnoreAsciiCase( "none" ) )
-@@ -384,7 +410,9 @@ static const char * get_desktop_environment()
+@@ -384,7 +369,9 @@ static const char * get_desktop_environment()
{
XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler );
@@ -88,7 +198,7 @@ index a104ce3..3c71b47 100644
pRet = desktop_strings[DESKTOP_KDE];
else if ( is_gnome_desktop( pDisplay ) )
pRet = desktop_strings[DESKTOP_GNOME];
-@@ -417,6 +445,8 @@ static const char* autodetect_plugin()
+@@ -417,6 +404,8 @@ static const char* autodetect_plugin()
pRet = "gtk";
else if( desktop == desktop_strings[DESKTOP_KDE] )
pRet = "kde";
@@ -98,7 +208,7 @@ index a104ce3..3c71b47 100644
{
// #i95296# use the much nicer looking gtk plugin
diff --git vcl/util/makefile.mk vcl/util/makefile.mk
-index 317ffba..217ce3e 100644
+index f41aae8..a842fa9 100644
--- vcl/util/makefile.mk
+++ vcl/util/makefile.mk
@@ -387,7 +387,7 @@ SHL5IMPLIB=ikde_plug_
More information about the ooo-build-commit
mailing list