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 INCLUDED_VCL_INC_UNX_SALDATA_HXX
21 : #define INCLUDED_VCL_INC_UNX_SALDATA_HXX
22 :
23 : #include <prex.h>
24 : #include <postx.h>
25 :
26 : #include <unx/saldisp.hxx>
27 : #include <unx/salunx.h>
28 : #include <vcl/salgtype.hxx>
29 : #include <salframe.hxx>
30 : #include <unx/salinst.h>
31 : #include <generic/gendata.hxx>
32 : #include <osl/module.h>
33 : #include <vclpluginapi.h>
34 :
35 : class SalXLib;
36 : class SalDisplay;
37 : class SalPrinter;
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 : class VCLPLUG_GEN_PUBLIC X11SalData : public SalGenericData
48 : {
49 : struct XErrorStackEntry
50 : {
51 : bool m_bIgnore;
52 : bool m_bWas;
53 : unsigned int m_nLastErrorRequest;
54 : XErrorHandler m_aHandler;
55 : };
56 : std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
57 : XIOErrorHandler m_aOrigXIOErrorHandler;
58 :
59 : protected:
60 : SalXLib *pXLib_;
61 :
62 : public:
63 : X11SalData( SalGenericDataType t, SalInstance *pInstance );
64 : virtual ~X11SalData();
65 :
66 : virtual void Init();
67 : virtual void Dispose() SAL_OVERRIDE;
68 :
69 : virtual void initNWF();
70 : virtual void deInitNWF();
71 :
72 : SalDisplay* GetX11Display() const
73 : { return vcl_sal::getSalDisplay(this); }
74 : void DeleteDisplay(); // for shutdown
75 :
76 0 : inline SalXLib* GetLib() const { return pXLib_; }
77 :
78 : void StartTimer( sal_uLong nMS );
79 : inline void StopTimer();
80 : static void Timeout( bool idle );
81 :
82 : // X errors
83 : virtual void ErrorTrapPush() SAL_OVERRIDE;
84 : virtual bool ErrorTrapPop( bool bIgnoreError ) SAL_OVERRIDE;
85 : void XError( Display *pDisp, XErrorEvent *pEvent );
86 0 : bool HasXErrorOccurred() const
87 0 : { return m_aXErrorHandlerStack.back().m_bWas; }
88 : unsigned int GetLastXErrorRequestCode() const
89 : { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; }
90 0 : void ResetXErrorOccurred()
91 0 : { m_aXErrorHandlerStack.back().m_bWas = false; }
92 : void PushXErrorLevel( bool bIgnore );
93 : void PopXErrorLevel();
94 : };
95 :
96 : X11SalData* GetX11SalData();
97 :
98 : #endif // INCLUDED_VCL_INC_UNX_SALDATA_HXX
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|