Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SV_SALDATA_HXX
21 : #define _SV_SALDATA_HXX
22 :
23 : #include <unx/salunx.h>
24 : #include <vcl/salgtype.hxx>
25 : #include <unx/salstd.hxx>
26 : #include <salframe.hxx>
27 : #include <unx/salinst.h>
28 : #include <generic/gendata.hxx>
29 : #include <osl/module.h>
30 : #include <vclpluginapi.h>
31 :
32 : // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
33 : class SalXLib;
34 : class SalDisplay;
35 : class SalPrinter;
36 :
37 : // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
38 :
39 : #if defined LINUX || defined NETBSD || defined AIX || \
40 : defined FREEBSD || defined OPENBSD || defined DRAGONFLY || \
41 : defined ANDROID
42 : #include <pthread.h>
43 : #else
44 : typedef unsigned int pthread_t;
45 : #endif
46 :
47 : // -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
48 : class VCLPLUG_GEN_PUBLIC X11SalData : public SalGenericData
49 : {
50 : static int XErrorHdl( Display*, XErrorEvent* );
51 : static int XIOErrorHdl( Display* );
52 :
53 : struct XErrorStackEntry
54 : {
55 : bool m_bIgnore;
56 : bool m_bWas;
57 : unsigned int m_nLastErrorRequest;
58 : XErrorHandler m_aHandler;
59 : };
60 : std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
61 : XIOErrorHandler m_aOrigXIOErrorHandler;
62 :
63 : protected:
64 : SalXLib *pXLib_;
65 :
66 : public:
67 : X11SalData( SalGenericDataType t, SalInstance *pInstance );
68 : virtual ~X11SalData();
69 :
70 : virtual void Init();
71 : virtual void Dispose();
72 :
73 : virtual void initNWF();
74 : virtual void deInitNWF();
75 :
76 : SalDisplay* GetX11Display() const { return GetSalDisplay(); }
77 : void DeleteDisplay(); // for shutdown
78 :
79 0 : inline SalXLib* GetLib() const { return pXLib_; }
80 :
81 : void StartTimer( sal_uLong nMS );
82 : inline void StopTimer();
83 : void Timeout() const;
84 :
85 : // X errors
86 : virtual void ErrorTrapPush();
87 : virtual bool ErrorTrapPop( bool bIgnoreError );
88 : void XError( Display *pDisp, XErrorEvent *pEvent );
89 0 : bool HasXErrorOccurred() const
90 0 : { return m_aXErrorHandlerStack.back().m_bWas; }
91 : unsigned int GetLastXErrorRequestCode() const
92 : { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; }
93 0 : void ResetXErrorOccurred()
94 0 : { m_aXErrorHandlerStack.back().m_bWas = false; }
95 : void PushXErrorLevel( bool bIgnore );
96 : void PopXErrorLevel();
97 : };
98 :
99 : X11SalData* GetX11SalData();
100 :
101 : #endif // _SV_SALDATA_HXX
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|