Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_SALDATA_HXX
30 : : #define _SV_SALDATA_HXX
31 : :
32 : : #include <unx/salunx.h>
33 : : #include <vcl/salgtype.hxx>
34 : : #include <unx/salstd.hxx>
35 : : #include <salframe.hxx>
36 : : #include <unx/salinst.h>
37 : : #include <generic/gendata.hxx>
38 : : #include <osl/module.h>
39 : : #include <vclpluginapi.h>
40 : :
41 : : // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
42 : : class SalXLib;
43 : : class SalDisplay;
44 : : class SalPrinter;
45 : :
46 : : // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
47 : :
48 : : #if defined LINUX || defined NETBSD || defined AIX || \
49 : : defined FREEBSD || defined OPENBSD || defined DRAGONFLY || \
50 : : defined ANDROID
51 : : #include <pthread.h>
52 : : #else
53 : : typedef unsigned int pthread_t;
54 : : #endif
55 : :
56 : : // -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
57 : : class VCLPLUG_GEN_PUBLIC X11SalData : public SalGenericData
58 : : {
59 : : static int XErrorHdl( Display*, XErrorEvent* );
60 : : static int XIOErrorHdl( Display* );
61 : :
62 : : struct XErrorStackEntry
63 : : {
64 : : bool m_bIgnore;
65 : : bool m_bWas;
66 : : unsigned int m_nLastErrorRequest;
67 : : XErrorHandler m_aHandler;
68 : : };
69 : : std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
70 : : XIOErrorHandler m_aOrigXIOErrorHandler;
71 : :
72 : : protected:
73 : : SalXLib *pXLib_;
74 : : pthread_t hMainThread_;
75 : :
76 : : public:
77 : : X11SalData( SalGenericDataType t, SalInstance *pInstance );
78 : : virtual ~X11SalData();
79 : :
80 : : virtual void Init();
81 : : virtual void Dispose();
82 : :
83 : : virtual void initNWF();
84 : : virtual void deInitNWF();
85 : :
86 : : SalDisplay* GetX11Display() const { return GetSalDisplay(); }
87 : : void DeleteDisplay(); // for shutdown
88 : :
89 : 0 : inline SalXLib* GetLib() const { return pXLib_; }
90 : : inline pthread_t GetMainThread() const { return hMainThread_; }
91 : :
92 : : void StartTimer( sal_uLong nMS );
93 : : inline void StopTimer();
94 : : void Timeout() const;
95 : :
96 : : // X errors
97 : : virtual void ErrorTrapPush();
98 : : virtual bool ErrorTrapPop( bool bIgnoreError );
99 : : void XError( Display *pDisp, XErrorEvent *pEvent );
100 : 0 : bool HasXErrorOccurred() const
101 : 0 : { return m_aXErrorHandlerStack.back().m_bWas; }
102 : : unsigned int GetLastXErrorRequestCode() const
103 : : { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; }
104 : 0 : void ResetXErrorOccurred()
105 : 0 : { m_aXErrorHandlerStack.back().m_bWas = false; }
106 : : void PushXErrorLevel( bool bIgnore );
107 : : void PopXErrorLevel();
108 : : };
109 : :
110 : : X11SalData* GetX11SalData();
111 : :
112 : : #endif // _SV_SALDATA_HXX
113 : :
114 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|