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