1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <QtGui/QApplication>
22 #include "KDEData.hxx"
23 #include "KDESalInstance.hxx"
25 #include <vclpluginapi.h>
27 #include <rtl/string.hxx>
28 #include <sal/log.hxx>
30 /// entry point for the KDE4 VCL plugin
32 VCLPLUG_KDE4_PUBLIC SalInstance
* create_SalInstance()
34 /* #i92121# workaround deadlocks in the X11 implementation
36 static const char* pNoXInitThreads
= getenv( "SAL_NO_XINITTHREADS" );
38 from now on we know that an X connection will be
39 established, so protect X against itself
41 if( ! ( pNoXInitThreads
&& *pNoXInitThreads
) )
43 #if QT_VERSION >= 0x040800
44 // let Qt call XInitThreads(), so that also Qt knows it's been used
45 // (otherwise QPixmap may warn about threads not being initialized)
46 QApplication::setAttribute( Qt::AA_X11InitThreads
);
49 // just in case somebody builds with old version and then upgrades Qt,
50 // otherwise this is a no-op
51 QApplication::setAttribute( static_cast< Qt::ApplicationAttribute
>( 10 ));
55 #if QT_VERSION < 0x050000
56 // Qt 4.x support needs >= 4.1.0
57 OString
aVersion( qVersion() );
58 SAL_INFO( "vcl.kde4", "qt version string is " << aVersion
);
60 sal_Int32 nIndex
= 0, nMajor
= 0, nMinor
= 0;
61 nMajor
= aVersion
.getToken( 0, '.', nIndex
).toInt32();
63 nMinor
= aVersion
.getToken( 0, '.', nIndex
).toInt32();
64 if( nMajor
!= 4 || nMinor
< 1 )
66 #if OSL_DEBUG_LEVEL > 1
69 nMicro
= aVersion
.getToken( 0, '.', nIndex
).toInt32();
70 SAL_INFO( "vcl.kde4", "unsuitable qt version " << nMajor
<< "." << nMinor
<< "." << nMicro
);
76 KDESalInstance
* pInstance
= new KDESalInstance( o3tl::make_unique
<SalYieldMutex
>() );
77 SAL_INFO( "vcl.kde4", "created KDESalInstance " << &pInstance
);
80 KDEData
*salData
= new KDEData( pInstance
);
83 pInstance
->SetLib(salData
->GetLib());
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */