1*9f62ea84SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9f62ea84SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9f62ea84SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9f62ea84SAndrew Rist * distributed with this work for additional information 6*9f62ea84SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9f62ea84SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9f62ea84SAndrew Rist * "License"); you may not use this file except in compliance 9*9f62ea84SAndrew Rist * with the License. You may obtain a copy of the License at 10*9f62ea84SAndrew Rist * 11*9f62ea84SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9f62ea84SAndrew Rist * 13*9f62ea84SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9f62ea84SAndrew Rist * software distributed under the License is distributed on an 15*9f62ea84SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9f62ea84SAndrew Rist * KIND, either express or implied. See the License for the 17*9f62ea84SAndrew Rist * specific language governing permissions and limitations 18*9f62ea84SAndrew Rist * under the License. 19*9f62ea84SAndrew Rist * 20*9f62ea84SAndrew Rist *************************************************************/ 21*9f62ea84SAndrew Rist 22*9f62ea84SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_vcl.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #define Region QtXRegion 28cdf0e10cSrcweir #include <QApplication> 29cdf0e10cSrcweir #undef Region 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "KDEData.hxx" 32cdf0e10cSrcweir #include "KDESalInstance.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include "vclpluginapi.h" 35cdf0e10cSrcweir 36cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 37cdf0e10cSrcweir #include <stdio.h> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <rtl/string.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir /// entry point for the KDE4 VCL plugin 43cdf0e10cSrcweir extern "C" { create_SalInstance(oslModule)44cdf0e10cSrcweir VCLPLUG_KDE4_PUBLIC SalInstance* create_SalInstance( oslModule ) 45cdf0e10cSrcweir { 46cdf0e10cSrcweir /* #i92121# workaround deadlocks in the X11 implementation 47cdf0e10cSrcweir */ 48cdf0e10cSrcweir static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); 49cdf0e10cSrcweir /* #i90094# 50cdf0e10cSrcweir from now on we know that an X connection will be 51cdf0e10cSrcweir established, so protect X against itself 52cdf0e10cSrcweir */ 53cdf0e10cSrcweir if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) 54cdf0e10cSrcweir XInitThreads(); 55cdf0e10cSrcweir 56cdf0e10cSrcweir #if QT_VERSION < 0x050000 57cdf0e10cSrcweir // Qt 4.x support needs >= 4.1.0 58cdf0e10cSrcweir rtl::OString aVersion( qVersion() ); 59cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 60cdf0e10cSrcweir fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() ); 61cdf0e10cSrcweir #endif 62cdf0e10cSrcweir sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0; 63cdf0e10cSrcweir nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32(); 64cdf0e10cSrcweir if( nIndex > 0 ) 65cdf0e10cSrcweir nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32(); 66cdf0e10cSrcweir if( nIndex > 0 ) 67cdf0e10cSrcweir nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32(); 68cdf0e10cSrcweir if( nMajor != 4 || nMinor < 1 ) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 71cdf0e10cSrcweir fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro ); 72cdf0e10cSrcweir #endif 73cdf0e10cSrcweir return NULL; 74cdf0e10cSrcweir } 75cdf0e10cSrcweir #endif 76cdf0e10cSrcweir 77cdf0e10cSrcweir KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() ); 78cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 79cdf0e10cSrcweir fprintf( stderr, "created KDESalInstance 0x%p\n", pInstance ); 80cdf0e10cSrcweir #endif 81cdf0e10cSrcweir 82cdf0e10cSrcweir // initialize SalData 83cdf0e10cSrcweir KDEData *salData = new KDEData(); 84cdf0e10cSrcweir SetSalData(salData); 85cdf0e10cSrcweir salData->m_pInstance = pInstance; 86cdf0e10cSrcweir salData->Init(); 87cdf0e10cSrcweir salData->initNWF(); 88cdf0e10cSrcweir 89cdf0e10cSrcweir return pInstance; 90cdf0e10cSrcweir } 91cdf0e10cSrcweir } 92