Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / inc / unx / saldata.hxx
blob1cd83a908dda9896ceecab9890696d0595ba7047
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_UNX_SALDATA_HXX
21 #define INCLUDED_VCL_INC_UNX_SALDATA_HXX
23 #include <prex.h>
24 #include <postx.h>
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>
35 class SalXLib;
36 class SalDisplay;
37 class SalPrinter;
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
47 class VCLPLUG_GEN_PUBLIC X11SalData : public SalGenericData
49 struct XErrorStackEntry
51 bool m_bIgnore;
52 bool m_bWas;
53 unsigned int m_nLastErrorRequest;
54 XErrorHandler m_aHandler;
56 std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
57 XIOErrorHandler m_aOrigXIOErrorHandler;
59 protected:
60 SalXLib *pXLib_;
62 public:
63 X11SalData( SalGenericDataType t, SalInstance *pInstance );
64 virtual ~X11SalData();
66 virtual void Init();
67 virtual void Dispose() SAL_OVERRIDE;
69 virtual void initNWF();
70 virtual void deInitNWF();
72 SalDisplay* GetX11Display() const
73 { return vcl_sal::getSalDisplay(this); }
74 void DeleteDisplay(); // for shutdown
76 inline SalXLib* GetLib() const { return pXLib_; }
78 void StartTimer( sal_uLong nMS );
79 inline void StopTimer();
80 static void Timeout( bool idle );
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 bool HasXErrorOccurred() const
87 { return m_aXErrorHandlerStack.back().m_bWas; }
88 unsigned int GetLastXErrorRequestCode() const
89 { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; }
90 void ResetXErrorOccurred()
91 { m_aXErrorHandlerStack.back().m_bWas = false; }
92 void PushXErrorLevel( bool bIgnore );
93 void PopXErrorLevel();
96 X11SalData* GetX11SalData();
98 #endif // INCLUDED_VCL_INC_UNX_SALDATA_HXX
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */