1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: saldata.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SV_SALDATA_HXX
32 #define _SV_SALDATA_HXX
34 // -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
37 #include <vcl/salframe.hxx>
39 #include <vcl/saldatabasic.hxx>
41 #include <osl/module.h>
43 #include <vcl/dllapi.h>
45 // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
50 // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
52 DECLARE_LIST( SalDisplays
, SalDisplay
* )
54 #if defined SCO || defined LINUX || defined NETBSD || defined AIX || defined HPUX || defined FREEBSD
57 typedef unsigned int pthread_t
;
60 // -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
61 class VCL_DLLPUBLIC X11SalData
: public SalData
66 SalDisplay
*m_pSalDisplay
;
67 pthread_t hMainThread_
;
71 virtual ~X11SalData();
74 virtual void initNWF();
75 virtual void deInitNWF();
77 inline void XError( Display
*pDisplay
, XErrorEvent
*pEvent
) const;
79 SalDisplay
* GetDisplay() const
80 { return m_pSalDisplay
; }
81 void SetSalDisplay( SalDisplay
* pDisplay
)
82 { m_pSalDisplay
= pDisplay
; }
84 void DeleteDisplay(); // for shutdown
86 inline SalXLib
* GetLib() const { return pXLib_
; }
87 inline pthread_t
GetMainThread() const { return hMainThread_
; }
89 void StartTimer( ULONG nMS
);
90 inline void StopTimer();
93 static int XErrorHdl( Display
*, XErrorEvent
* );
94 static int XIOErrorHdl( Display
* );
96 // set helper functions to set class and res name in W_CLASS hint
97 static const char* getFrameResName();
98 static const char* getFrameClassName();
99 static rtl::OString
getFrameResName( SalExtStyle nStyle
);
103 inline X11SalData
* GetX11SalData()
104 { return (X11SalData
*)ImplGetSVData()->mpSalData
; }
107 #ifdef _SV_SALDISP_HXX
108 inline void X11SalData::XError( Display
*pDisplay
, XErrorEvent
*pEvent
) const
109 { pXLib_
->XError( pDisplay
, pEvent
); }
112 class YieldMutexReleaser
116 inline YieldMutexReleaser();
117 inline ~YieldMutexReleaser();
120 inline YieldMutexReleaser::YieldMutexReleaser()
122 m_nYieldCount
= GetSalData()->m_pInstance
->ReleaseYieldMutex();
125 inline YieldMutexReleaser::~YieldMutexReleaser()
127 GetSalData()->m_pInstance
->AcquireYieldMutex( m_nYieldCount
);
130 #endif // _SV_SALDATA_HXX