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 23 24 #ifndef _SV_SALDATA_HXX 25 #define _SV_SALDATA_HXX 26 27 // -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 28 #include <signal.h> 29 #include <unx/salstd.hxx> 30 #include <salframe.hxx> 31 #include <unx/salinst.h> 32 #include <saldatabasic.hxx> 33 #ifndef _OSL_MODULE_H 34 #include <osl/module.h> 35 #endif 36 #include <vclpluginapi.h> 37 38 // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 39 class SalXLib; 40 class SalDisplay; 41 class SalPrinter; 42 43 // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 44 45 DECLARE_LIST( SalDisplays, SalDisplay* ) 46 47 #if defined SCO || defined LINUX || defined NETBSD || defined AIX || defined HPUX || defined FREEBSD 48 #include <pthread.h> 49 #else 50 typedef unsigned int pthread_t; 51 #endif 52 53 // -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 54 class VCLPLUG_GEN_PUBLIC X11SalData : public SalData 55 { 56 protected: 57 sal_Bool bNoExceptions_; 58 SalXLib *pXLib_; 59 SalDisplay *m_pSalDisplay; 60 pthread_t hMainThread_; 61 rtl::OUString maLocalHostName; 62 rtl::OUString maUnicodeAccumulator; 63 64 public: 65 X11SalData(); 66 virtual ~X11SalData(); 67 68 virtual void Init(); 69 virtual void initNWF(); 70 virtual void deInitNWF(); 71 72 inline void XError( Display *pDisplay, XErrorEvent *pEvent ) const; 73 74 SalDisplay* GetDisplay() const 75 { return m_pSalDisplay; } 76 void SetSalDisplay( SalDisplay* pDisplay ) 77 { m_pSalDisplay = pDisplay; } 78 79 void DeleteDisplay(); // for shutdown 80 81 inline SalXLib* GetLib() const { return pXLib_; } 82 inline pthread_t GetMainThread() const { return hMainThread_; } 83 84 void StartTimer( sal_uLong nMS ); 85 inline void StopTimer(); 86 void Timeout() const; 87 88 const rtl::OUString& GetLocalHostName() const 89 { return maLocalHostName; } 90 rtl::OUString& GetUnicodeAccumulator() { return maUnicodeAccumulator; } 91 92 static int XErrorHdl( Display*, XErrorEvent* ); 93 static int XIOErrorHdl( Display* ); 94 95 // set helper functions to set class and res name in W_CLASS hint 96 static const char* getFrameResName(); 97 static const char* getFrameClassName(); 98 static rtl::OString getFrameResName( SalExtStyle nStyle ); 99 100 }; 101 102 inline X11SalData* GetX11SalData() 103 { return (X11SalData*)ImplGetSVData()->mpSalData; } 104 105 106 #ifdef _SV_SALDISP_HXX 107 inline void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) const 108 { pXLib_->XError( pDisplay, pEvent ); } 109 #endif 110 111 class YieldMutexReleaser 112 { 113 sal_uLong m_nYieldCount; 114 public: 115 inline YieldMutexReleaser(); 116 inline ~YieldMutexReleaser(); 117 }; 118 119 inline YieldMutexReleaser::YieldMutexReleaser() 120 { 121 m_nYieldCount = GetSalData()->m_pInstance->ReleaseYieldMutex(); 122 } 123 124 inline YieldMutexReleaser::~YieldMutexReleaser() 125 { 126 GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount ); 127 } 128 129 #endif // _SV_SALDATA_HXX 130 131