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