xref: /aoo41x/main/vcl/inc/unx/saldisp.hxx (revision 6c89fb3e)
1*161f4cd1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*161f4cd1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*161f4cd1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*161f4cd1SAndrew Rist  * distributed with this work for additional information
6*161f4cd1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*161f4cd1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*161f4cd1SAndrew Rist  * "License"); you may not use this file except in compliance
9*161f4cd1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*161f4cd1SAndrew Rist  *
11*161f4cd1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*161f4cd1SAndrew Rist  *
13*161f4cd1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*161f4cd1SAndrew Rist  * software distributed under the License is distributed on an
15*161f4cd1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*161f4cd1SAndrew Rist  * KIND, either express or implied.  See the License for the
17*161f4cd1SAndrew Rist  * specific language governing permissions and limitations
18*161f4cd1SAndrew Rist  * under the License.
19*161f4cd1SAndrew Rist  *
20*161f4cd1SAndrew Rist  *************************************************************/
21*161f4cd1SAndrew Rist 
22*161f4cd1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_SALDISP_HXX
25cdf0e10cSrcweir #define _SV_SALDISP_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // -=-= exports =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
28cdf0e10cSrcweir class	SalDisplay;
29cdf0e10cSrcweir class	SalColormap;
30cdf0e10cSrcweir class	SalVisual;
31cdf0e10cSrcweir class	SalXLib;
32cdf0e10cSrcweir 
33cdf0e10cSrcweir // -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
34cdf0e10cSrcweir #include <unx/salunx.h>
35cdf0e10cSrcweir #include <vcl/salgtype.hxx>
36cdf0e10cSrcweir #ifndef _SV_PTRSTYLE_HXX
37cdf0e10cSrcweir #include <vcl/ptrstyle.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <sal/types.h>
40cdf0e10cSrcweir #ifndef _OSL_MUTEX_H
41cdf0e10cSrcweir #include <osl/mutex.h>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include <vector>
44cdf0e10cSrcweir #include <list>
45cdf0e10cSrcweir #include <hash_map>
46cdf0e10cSrcweir #include <tools/gen.hxx>
47cdf0e10cSrcweir #include <salwtype.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <vclpluginapi.h>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
52cdf0e10cSrcweir class	BitmapPalette;
53cdf0e10cSrcweir class	SalFrame;
54cdf0e10cSrcweir class	ColorMask;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir namespace vcl_sal { class WMAdaptor; }
57cdf0e10cSrcweir class DtIntegrator;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir // -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
60cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_SetPos				0x00000001
61cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_Screen				0x00000002
62cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_Parent_Pixmap_None	0x00000004
63cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_ClientPos			0x00000008
64cdf0e10cSrcweir #define	PROPERTY_SUPPORT_XSetClipMask			0x00000010	// for bitmap ops.
65cdf0e10cSrcweir #define	PROPERTY_SUPPORT_3ButtonMouse			0x00000020
66cdf0e10cSrcweir 
67cdf0e10cSrcweir #define PROPERTY_BUG_XA_FAMILY_NAME_nil			0x00001000
68cdf0e10cSrcweir #define PROPERTY_BUG_XCopyArea_GXxor			0x00002000	// from window
69cdf0e10cSrcweir #define PROPERTY_BUG_Stipple					0x00004000	// 0/1 inverted
70cdf0e10cSrcweir #define PROPERTY_BUG_Tile                       0x00008000  // Recreate the
71cdf0e10cSrcweir                                             // dither brush each time
72cdf0e10cSrcweir #define PROPERTY_BUG_FillPolygon_Tile           0x00010000  // always Toggle Fillstyle
73cdf0e10cSrcweir #define PROPERTY_BUG_DrawLine			        0x00020000  // a DrawLine is one point to short
74cdf0e10cSrcweir #define PROPERTY_BUG_CopyPlane_RevertBWPixel	0x00040000  // revert fg and bg for xcopyplane
75cdf0e10cSrcweir #define PROPERTY_BUG_CopyArea_OnlySmallSlices	0x00080000
76cdf0e10cSrcweir #define PROPERTY_BUG_Bitmap_Bit_Order			0x00100000
77cdf0e10cSrcweir 
78cdf0e10cSrcweir #define	PROPERTY_FEATURE_Maximize				0x01000000
79cdf0e10cSrcweir #define PROPERTY_FEATURE_SharedMemory           0x02000000
80cdf0e10cSrcweir #define PROPERTY_FEATURE_TrustedSolaris         0x04000000
81cdf0e10cSrcweir 
82cdf0e10cSrcweir #define	PROPERTY_DEFAULT						0x00000FCB
83cdf0e10cSrcweir 
84cdf0e10cSrcweir // ------------------------------------------------------------------------
85cdf0e10cSrcweir // server vendor
86cdf0e10cSrcweir 
87cdf0e10cSrcweir typedef enum  {
88cdf0e10cSrcweir 	vendor_none = 0,
89cdf0e10cSrcweir 	vendor_attachmate,
90cdf0e10cSrcweir 	vendor_excursion,
91cdf0e10cSrcweir 	vendor_hp,
92cdf0e10cSrcweir 	vendor_hummingbird,
93cdf0e10cSrcweir 	vendor_ibm,
94cdf0e10cSrcweir 	vendor_sco,
95cdf0e10cSrcweir 	vendor_sgi,
96cdf0e10cSrcweir 	vendor_sun,
97cdf0e10cSrcweir 	vendor_xfree,
98cdf0e10cSrcweir 	vendor_xinside,
99cdf0e10cSrcweir 	vendor_xprinter,
100cdf0e10cSrcweir 	vendor_unknown
101cdf0e10cSrcweir } srv_vendor_t;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir extern "C" srv_vendor_t sal_GetServerVendor( Display *p_display );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir // -=-= SalWM =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
106cdf0e10cSrcweir enum SalWM { olwm,		// Open Look
107cdf0e10cSrcweir 			 mwm, 		// Motif
108cdf0e10cSrcweir 			 kwm,		// KDE Desktop Environment
109cdf0e10cSrcweir 			 FourDwm,	// SGI
110cdf0e10cSrcweir 			 vuewm,		// HP
111cdf0e10cSrcweir 			 dtwm,		// CDE
112cdf0e10cSrcweir 			 winmgr,	// Oracle NC
113cdf0e10cSrcweir 			 twm,
114cdf0e10cSrcweir 			 fvwm,		// ...
115cdf0e10cSrcweir 			 pmwm,		// SCO
116cdf0e10cSrcweir              otherwm };
117cdf0e10cSrcweir 
118cdf0e10cSrcweir // -=-= SalRGB -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
119cdf0e10cSrcweir // MSB/Bigendian Sicht (SalColor == RGB, r=0xFF0000, g=0xFF00, b=0xFF)
120cdf0e10cSrcweir 
121cdf0e10cSrcweir enum SalRGB { RGB,  RBG,
122cdf0e10cSrcweir 			  GBR,  GRB,
123cdf0e10cSrcweir 			  BGR,  BRG,
124cdf0e10cSrcweir 			  RGBA,	RBGA,
125cdf0e10cSrcweir 			  GBRA, GRBA,
126cdf0e10cSrcweir 			  BGRA, BRGA,
127cdf0e10cSrcweir               otherSalRGB };
128cdf0e10cSrcweir 
129cdf0e10cSrcweir // -=-= SalVisual =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
130cdf0e10cSrcweir class SalVisual : public XVisualInfo
131cdf0e10cSrcweir {
132cdf0e10cSrcweir     SalRGB			eRGBMode_;
133cdf0e10cSrcweir     int				nRedShift_;
134cdf0e10cSrcweir     int				nGreenShift_;
135cdf0e10cSrcweir     int				nBlueShift_;
136cdf0e10cSrcweir     int				nRedBits_;
137cdf0e10cSrcweir     int				nGreenBits_;
138cdf0e10cSrcweir     int				nBlueBits_;
139cdf0e10cSrcweir public:
140cdf0e10cSrcweir                             SalVisual();
141cdf0e10cSrcweir 							~SalVisual();
142cdf0e10cSrcweir 							SalVisual( const XVisualInfo* pXVI );
143cdf0e10cSrcweir 
GetVisualId() const144cdf0e10cSrcweir 	inline	VisualID		GetVisualId() const { return visualid; }
GetVisual() const145cdf0e10cSrcweir 	inline	Visual		   *GetVisual() const { return visual; }
GetClass() const146cdf0e10cSrcweir 	inline	int				GetClass() const { return c_class; }
GetDepth() const147cdf0e10cSrcweir 	inline	int				GetDepth() const { return depth; }
GetMode() const148cdf0e10cSrcweir 	inline  SalRGB			GetMode() const { return eRGBMode_; }
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 			Pixel			GetTCPixel( SalColor nColor ) const;
151cdf0e10cSrcweir 			SalColor		GetTCColor( Pixel nPixel ) const;
152cdf0e10cSrcweir             sal_Bool			Convert( int &n0, int &n1, int &n2, int &n3 ); // 32bit
153cdf0e10cSrcweir          	sal_Bool			Convert( int &n0, int &n1, int &n2 ); // 24bit
154cdf0e10cSrcweir };
155cdf0e10cSrcweir 
156cdf0e10cSrcweir // -=-= SalColormap =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
157cdf0e10cSrcweir class SalColormap
158cdf0e10cSrcweir {
159cdf0e10cSrcweir     const SalDisplay*       m_pDisplay;
160cdf0e10cSrcweir     Colormap                m_hColormap;
161cdf0e10cSrcweir     std::vector<SalColor>   m_aPalette;			// Pseudocolor
162cdf0e10cSrcweir     SalVisual               m_aVisual;
163cdf0e10cSrcweir     std::vector<sal_uInt16>     m_aLookupTable;		// Pseudocolor: 12bit reduction
164cdf0e10cSrcweir     Pixel                   m_nWhitePixel;
165cdf0e10cSrcweir     Pixel                   m_nBlackPixel;
166cdf0e10cSrcweir     Pixel                   m_nUsed;			// Pseudocolor
167cdf0e10cSrcweir     int                     m_nScreen;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     void			GetPalette();
170cdf0e10cSrcweir     void			GetLookupTable();
171cdf0e10cSrcweir public:
172cdf0e10cSrcweir     SalColormap( const SalDisplay*  pSalDisplay,
173cdf0e10cSrcweir                  Colormap           hColormap,
174cdf0e10cSrcweir                  int                nScreen );
175cdf0e10cSrcweir     SalColormap( const BitmapPalette &rpPalette );
176cdf0e10cSrcweir     SalColormap( sal_uInt16             nDepth );
177cdf0e10cSrcweir     SalColormap();
178cdf0e10cSrcweir 	~SalColormap();
179cdf0e10cSrcweir 
GetXColormap() const180cdf0e10cSrcweir 	inline	Colormap		    GetXColormap() const { return m_hColormap; }
GetDisplay() const181cdf0e10cSrcweir 	inline	const SalDisplay*   GetDisplay() const { return m_pDisplay; }
182cdf0e10cSrcweir 	inline	Display*            GetXDisplay() const;
GetVisual() const183cdf0e10cSrcweir 	inline	const SalVisual&    GetVisual() const { return m_aVisual; }
GetXVisual() const184cdf0e10cSrcweir 	inline	Visual*             GetXVisual() const { return m_aVisual.GetVisual(); }
GetWhitePixel() const185cdf0e10cSrcweir 	inline	Pixel			    GetWhitePixel() const { return m_nWhitePixel; }
GetBlackPixel() const186cdf0e10cSrcweir 	inline	Pixel			    GetBlackPixel() const { return m_nBlackPixel; }
GetUsed() const187cdf0e10cSrcweir 	inline	Pixel			    GetUsed() const { return m_nUsed; }
GetClass() const188cdf0e10cSrcweir 	inline	int				    GetClass() const { return m_aVisual.GetClass(); }
GetScreenNumber() const189cdf0e10cSrcweir     inline  int                 GetScreenNumber() const { return m_nScreen; }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     sal_Bool			GetXPixels( XColor  &rColor,
192cdf0e10cSrcweir                                 int      r,
193cdf0e10cSrcweir                                 int      g,
194cdf0e10cSrcweir                                 int      b ) const;
195cdf0e10cSrcweir 	inline	sal_Bool			GetXPixel( XColor  &rColor,
196cdf0e10cSrcweir 									   int      r,
197cdf0e10cSrcweir 									   int      g,
198cdf0e10cSrcweir 									   int      b ) const;
199cdf0e10cSrcweir     Pixel			GetPixel( SalColor nColor ) const;
200cdf0e10cSrcweir     SalColor		GetColor( Pixel nPixel ) const;
201cdf0e10cSrcweir     void			SetPalette( const BitmapPalette &rPalette );
202cdf0e10cSrcweir };
203cdf0e10cSrcweir 
204cdf0e10cSrcweir // -=-= SalXLib =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
205cdf0e10cSrcweir typedef int(*YieldFunc)(int fd, void* data);
206cdf0e10cSrcweir 
207cdf0e10cSrcweir class VCLPLUG_GEN_PUBLIC SalXLib
208cdf0e10cSrcweir {
209cdf0e10cSrcweir protected:
210cdf0e10cSrcweir     timeval			m_aTimeout;
211cdf0e10cSrcweir     sal_uLong           m_nTimeoutMS;
212cdf0e10cSrcweir 	int             m_pTimeoutFDS[2];
213cdf0e10cSrcweir 
214cdf0e10cSrcweir     bool			m_bHaveSystemChildFrames;
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     int				nFDs_;
217cdf0e10cSrcweir     fd_set	        aReadFDS_;
218cdf0e10cSrcweir     fd_set	        aExceptionFDS_;
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     struct XErrorStackEntry
222cdf0e10cSrcweir     {
223cdf0e10cSrcweir         bool            m_bIgnore;
224cdf0e10cSrcweir         bool            m_bWas;
225cdf0e10cSrcweir         unsigned int    m_nLastErrorRequest;
226cdf0e10cSrcweir         XErrorHandler   m_aHandler;
227cdf0e10cSrcweir     };
228cdf0e10cSrcweir     std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
229cdf0e10cSrcweir     XIOErrorHandler m_aOrigXIOErrorHandler;
230cdf0e10cSrcweir public:
231cdf0e10cSrcweir     SalXLib();
232cdf0e10cSrcweir     virtual			~SalXLib();
233cdf0e10cSrcweir     virtual void		Init();
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     virtual void		Yield( bool bWait, bool bHandleAllCurrentEvents );
236cdf0e10cSrcweir     virtual void        Wakeup();
237cdf0e10cSrcweir     virtual void		PostUserEvent();
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     virtual void    Insert( int fd, void* data,
240cdf0e10cSrcweir                             YieldFunc	pending,
241cdf0e10cSrcweir                             YieldFunc	queued,
242cdf0e10cSrcweir                             YieldFunc	handle );
243cdf0e10cSrcweir     virtual void    Remove( int fd );
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     void			XError( Display *pDisp, XErrorEvent *pEvent );
HasXErrorOccured() const246cdf0e10cSrcweir     bool            HasXErrorOccured() const { return m_aXErrorHandlerStack.back().m_bWas; }
GetLastXErrorRequestCode() const247cdf0e10cSrcweir     unsigned int    GetLastXErrorRequestCode() const { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; }
ResetXErrorOccured()248cdf0e10cSrcweir     void            ResetXErrorOccured() { m_aXErrorHandlerStack.back().m_bWas = false; }
249cdf0e10cSrcweir     void PushXErrorLevel( bool bIgnore );
250cdf0e10cSrcweir     void PopXErrorLevel();
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	virtual void			StartTimer( sal_uLong nMS );
253cdf0e10cSrcweir 	virtual void			StopTimer();
254cdf0e10cSrcweir 
255cdf0e10cSrcweir     bool            CheckTimeout( bool bExecuteTimers = true );
256cdf0e10cSrcweir 
setHaveSystemChildFrame()257cdf0e10cSrcweir     void			setHaveSystemChildFrame()
258cdf0e10cSrcweir     { m_bHaveSystemChildFrames = true; }
getHaveSystemChildFrame() const259cdf0e10cSrcweir     bool            getHaveSystemChildFrame() const
260cdf0e10cSrcweir     { return m_bHaveSystemChildFrames; }
261cdf0e10cSrcweir };
262cdf0e10cSrcweir 
263cdf0e10cSrcweir // -=-= SalDisplay -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
264cdf0e10cSrcweir 
265cdf0e10cSrcweir class SalI18N_InputMethod;
266cdf0e10cSrcweir class SalI18N_KeyboardExtension;
267cdf0e10cSrcweir class AttributeProvider;
268cdf0e10cSrcweir class SalUnicodeConverter;
269cdf0e10cSrcweir class SalConverterCache;
270cdf0e10cSrcweir 
271cdf0e10cSrcweir extern "C" {
272cdf0e10cSrcweir     struct SnDisplay;
273cdf0e10cSrcweir     struct SnLauncheeContext;
274cdf0e10cSrcweir     typedef Bool(*X_if_predicate)(Display*,XEvent*,XPointer);
275cdf0e10cSrcweir }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir class VCLPLUG_GEN_PUBLIC SalDisplay
278cdf0e10cSrcweir {
279cdf0e10cSrcweir public:
280cdf0e10cSrcweir     struct RenderEntry
281cdf0e10cSrcweir     {
282cdf0e10cSrcweir         Pixmap      m_aPixmap;
283cdf0e10cSrcweir         Picture     m_aPicture;
284cdf0e10cSrcweir 
RenderEntrySalDisplay::RenderEntry285cdf0e10cSrcweir         RenderEntry() : m_aPixmap( 0 ), m_aPicture( 0 ) {}
286cdf0e10cSrcweir     };
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     typedef std::hash_map<int,RenderEntry> RenderEntryMap;
289cdf0e10cSrcweir 
290cdf0e10cSrcweir     struct ScreenData
291cdf0e10cSrcweir     {
292cdf0e10cSrcweir         bool                m_bInit;
293cdf0e10cSrcweir 
294cdf0e10cSrcweir         XLIB_Window         m_aRoot;
295cdf0e10cSrcweir         XLIB_Window         m_aRefWindow;
296cdf0e10cSrcweir         Size                m_aSize;
297cdf0e10cSrcweir         SalVisual           m_aVisual;
298cdf0e10cSrcweir         SalColormap         m_aColormap;
299cdf0e10cSrcweir         GC				    m_aMonoGC;
300cdf0e10cSrcweir         GC				    m_aCopyGC;
301cdf0e10cSrcweir         GC				    m_aAndInvertedGC;
302cdf0e10cSrcweir         GC				    m_aAndGC;
303cdf0e10cSrcweir         GC				    m_aOrGC;
304cdf0e10cSrcweir         GC			        m_aStippleGC;
305cdf0e10cSrcweir         Pixmap			    m_hInvert50;
306cdf0e10cSrcweir         mutable RenderEntryMap m_aRenderData;
307cdf0e10cSrcweir 
ScreenDataSalDisplay::ScreenData308cdf0e10cSrcweir         ScreenData() :
309cdf0e10cSrcweir         m_bInit( false ),
310cdf0e10cSrcweir         m_aRoot( None ),
311cdf0e10cSrcweir         m_aRefWindow( None ),
312cdf0e10cSrcweir         m_aMonoGC( None ),
313cdf0e10cSrcweir         m_aCopyGC( None ),
314cdf0e10cSrcweir         m_aAndInvertedGC( None ),
315cdf0e10cSrcweir         m_aAndGC( None ),
316cdf0e10cSrcweir         m_aOrGC( None ),
317cdf0e10cSrcweir         m_aStippleGC( None ),
318cdf0e10cSrcweir         m_hInvert50( None ),
319cdf0e10cSrcweir         m_aRenderData( 1 )
320cdf0e10cSrcweir         {}
321cdf0e10cSrcweir     };
322cdf0e10cSrcweir // -=-= UserEvent =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
323cdf0e10cSrcweir     struct SalUserEvent
324cdf0e10cSrcweir     {
325cdf0e10cSrcweir         SalFrame*		m_pFrame;
326cdf0e10cSrcweir         void*			m_pData;
327cdf0e10cSrcweir         sal_uInt16			m_nEvent;
328cdf0e10cSrcweir 
SalUserEventSalDisplay::SalUserEvent329cdf0e10cSrcweir         SalUserEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT )
330cdf0e10cSrcweir                 : m_pFrame( pFrame ),
331cdf0e10cSrcweir                   m_pData( pData ),
332cdf0e10cSrcweir                   m_nEvent( nEvent )
333cdf0e10cSrcweir         {}
334cdf0e10cSrcweir     };
335cdf0e10cSrcweir 
336cdf0e10cSrcweir protected:
337cdf0e10cSrcweir     SalXLib		   *pXLib_;
338cdf0e10cSrcweir     SalI18N_InputMethod			*mpInputMethod;
339cdf0e10cSrcweir     SalI18N_KeyboardExtension	*mpKbdExtension;
340cdf0e10cSrcweir 
341cdf0e10cSrcweir     AttributeProvider 			*mpFactory;
342cdf0e10cSrcweir 
343cdf0e10cSrcweir     Display		   *pDisp_;				// X Display
344cdf0e10cSrcweir     int				m_nDefaultScreen;			// XDefaultScreen
345cdf0e10cSrcweir     std::vector< ScreenData >    m_aScreens;
346cdf0e10cSrcweir     ScreenData      m_aInvalidScreenData;
347cdf0e10cSrcweir     Pair			aResolution_;		// [dpi]
348cdf0e10cSrcweir     bool			mbExactResolution;
349cdf0e10cSrcweir     sal_uLong			nMaxRequestSize_;	// [byte]
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     srv_vendor_t	meServerVendor;
352cdf0e10cSrcweir     SalWM			eWindowManager_;
353cdf0e10cSrcweir     sal_uLong			nProperties_;		// PROPERTY_SUPPORT, BUG, FEATURE
354cdf0e10cSrcweir     sal_Bool			bLocal_;			// Server==Client? Init
355cdf0e10cSrcweir     // in SalDisplay::IsLocal()
356cdf0e10cSrcweir     sal_Bool			mbLocalIsValid;		// bLocal_ is valid ?
357cdf0e10cSrcweir     // until x bytes
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     oslMutex        hEventGuard_;
360cdf0e10cSrcweir     std::list< SalUserEvent > m_aUserEvents;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir     XLIB_Cursor		aPointerCache_[POINTER_COUNT];
363cdf0e10cSrcweir     SalFrame*		m_pCapture;
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     // Keyboard
366cdf0e10cSrcweir     sal_Bool			bNumLockFromXS_;	// Num Lock handled by X Server
367cdf0e10cSrcweir     int				nNumLockIndex_;		// modifier index in modmap
368cdf0e10cSrcweir     int				nNumLockMask_;		// keyevent state mask for
369cdf0e10cSrcweir     KeySym			nShiftKeySym_;		// first shift modifier
370cdf0e10cSrcweir     KeySym			nCtrlKeySym_;		// first control modifier
371cdf0e10cSrcweir     KeySym			nMod1KeySym_;		// first mod1 modifier
372cdf0e10cSrcweir     ByteString		m_aKeyboardName;
373cdf0e10cSrcweir 
374cdf0e10cSrcweir     vcl_sal::WMAdaptor*	m_pWMAdaptor;
375cdf0e10cSrcweir     DtIntegrator*       m_pDtIntegrator;
376cdf0e10cSrcweir 
377cdf0e10cSrcweir     bool			m_bXinerama;
378cdf0e10cSrcweir     std::vector< Rectangle > m_aXineramaScreens;
379cdf0e10cSrcweir     std::list<SalFrame*> m_aFrames;
380cdf0e10cSrcweir     std::list<SalObject*> m_aSalObjects;
381cdf0e10cSrcweir 
382cdf0e10cSrcweir     bool            m_bUseRandRWrapper; // don't use randr on gtk, use gdk signals there
383cdf0e10cSrcweir 
384cdf0e10cSrcweir     mutable XLIB_Time  m_nLastUserEventTime; // mutable because changed on first access
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     virtual long	Dispatch( XEvent *pEvent ) = 0;
387cdf0e10cSrcweir     void			InitXinerama();
388cdf0e10cSrcweir     void            InitRandR( XLIB_Window aRoot ) const;
389cdf0e10cSrcweir     void            DeInitRandR();
390cdf0e10cSrcweir     int             processRandREvent( XEvent* );
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     void			doDestruct();
393cdf0e10cSrcweir     int             addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight );
394cdf0e10cSrcweir public:
395cdf0e10cSrcweir 	static	SalDisplay	   *GetSalDisplay( Display* display );
396cdf0e10cSrcweir 	static	sal_Bool			BestVisual( Display     *pDisp,
397cdf0e10cSrcweir 										int          nScreen,
398cdf0e10cSrcweir 										XVisualInfo &rVI );
399cdf0e10cSrcweir 
400cdf0e10cSrcweir 							SalDisplay( Display* pDisp );
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     virtual ~SalDisplay();
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 
405cdf0e10cSrcweir     virtual void			registerFrame( SalFrame* pFrame );
406cdf0e10cSrcweir     virtual void			deregisterFrame( SalFrame* pFrame );
setHaveSystemChildFrame() const407cdf0e10cSrcweir     void					setHaveSystemChildFrame() const
408cdf0e10cSrcweir     { pXLib_->setHaveSystemChildFrame(); }
getHaveSystemChildFrame() const409cdf0e10cSrcweir     bool                    getHaveSystemChildFrame() const
410cdf0e10cSrcweir     { return pXLib_->getHaveSystemChildFrame(); }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir     void			Init();
413cdf0e10cSrcweir 
414cdf0e10cSrcweir     void			SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT );
415cdf0e10cSrcweir     void            CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent );
416cdf0e10cSrcweir     bool			DispatchInternalEvent();
417cdf0e10cSrcweir     void			PrintInfo() const;
418cdf0e10cSrcweir 
419cdf0e10cSrcweir     void			PrintEvent( const ByteString &rComment,
420cdf0e10cSrcweir                                 XEvent       *pEvent ) const;
421cdf0e10cSrcweir 
422cdf0e10cSrcweir     void			Beep() const;
423cdf0e10cSrcweir 
424cdf0e10cSrcweir     void			ModifierMapping();
425cdf0e10cSrcweir     String			GetKeyNameFromKeySym( KeySym keysym ) const;
426cdf0e10cSrcweir     XubString		GetKeyName( sal_uInt16 nKeyCode ) const;
427cdf0e10cSrcweir     sal_uInt16			GetKeyCode( KeySym keysym, char*pcPrintable ) const;
428cdf0e10cSrcweir     KeySym			GetKeySym( XKeyEvent      *pEvent,
429cdf0e10cSrcweir                                unsigned char  *pPrintable,
430cdf0e10cSrcweir                                int			  *pLen,
431cdf0e10cSrcweir                                KeySym         *pUnmodifiedKeySym,
432cdf0e10cSrcweir                                Status         *pStatus,
433cdf0e10cSrcweir                                XIC = NULL ) const;
434cdf0e10cSrcweir 
435cdf0e10cSrcweir     XLIB_Cursor		GetPointer( int ePointerStyle );
436cdf0e10cSrcweir     virtual int	CaptureMouse( SalFrame *pCapture );
437cdf0e10cSrcweir 
438cdf0e10cSrcweir     sal_Bool			IsLocal();
439cdf0e10cSrcweir 
440cdf0e10cSrcweir     void			Remove( XEvent   *pEvent );
441cdf0e10cSrcweir 
442cdf0e10cSrcweir     virtual void          initScreen( int nScreen ) const;
getDataForScreen(int nScreen) const443cdf0e10cSrcweir     const ScreenData&     getDataForScreen( int nScreen ) const
444cdf0e10cSrcweir     {
445cdf0e10cSrcweir         if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) )
446cdf0e10cSrcweir             return m_aInvalidScreenData;
447cdf0e10cSrcweir         if( ! m_aScreens[nScreen].m_bInit )
448cdf0e10cSrcweir             initScreen( nScreen );
449cdf0e10cSrcweir         return m_aScreens[nScreen];
450cdf0e10cSrcweir     }
451cdf0e10cSrcweir 
GetDrawable(int nScreen) const452cdf0e10cSrcweir 	XLIB_Window		GetDrawable( int nScreen ) const { return getDataForScreen( nScreen ).m_aRefWindow; }
GetDisplay() const453cdf0e10cSrcweir 	Display		   *GetDisplay() const { return pDisp_; }
GetDefaultScreenNumber() const454cdf0e10cSrcweir 	int				GetDefaultScreenNumber() const { return m_nDefaultScreen; }
GetDefaultMonitorNumber() const455cdf0e10cSrcweir 	virtual int		GetDefaultMonitorNumber() const { return 0; }
GetScreenSize(int nScreen) const456cdf0e10cSrcweir     const Size&     GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; }
GetServerVendor() const457cdf0e10cSrcweir 	srv_vendor_t	GetServerVendor() const { return meServerVendor; }
SetServerVendor()458cdf0e10cSrcweir 	void			SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); }
IsDisplay() const459cdf0e10cSrcweir 	sal_Bool			IsDisplay() const { return !!pXLib_; }
GetMonoGC(int nScreen) const460cdf0e10cSrcweir 	GC				GetMonoGC( int nScreen ) const { return getDataForScreen(nScreen).m_aMonoGC; }
GetCopyGC(int nScreen) const461cdf0e10cSrcweir 	GC				GetCopyGC( int nScreen ) const { return getDataForScreen(nScreen).m_aCopyGC; }
GetAndInvertedGC(int nScreen) const462cdf0e10cSrcweir 	GC				GetAndInvertedGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndInvertedGC; }
GetAndGC(int nScreen) const463cdf0e10cSrcweir 	GC				GetAndGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndGC; }
GetOrGC(int nScreen) const464cdf0e10cSrcweir 	GC				GetOrGC( int nScreen ) const { return getDataForScreen(nScreen).m_aOrGC; }
GetStippleGC(int nScreen) const465cdf0e10cSrcweir 	GC				GetStippleGC( int nScreen ) const { return getDataForScreen(nScreen).m_aStippleGC; }
466cdf0e10cSrcweir 	GC				GetGC( sal_uInt16 nDepth, int nScreen ) const;
GetInvert50(int nScreen) const467cdf0e10cSrcweir 	Pixmap			GetInvert50( int nScreen ) const { return getDataForScreen(nScreen).m_hInvert50; }
GetColormap(int nScreen) const468cdf0e10cSrcweir 	const SalColormap&    GetColormap( int nScreen ) const { return getDataForScreen(nScreen).m_aColormap; }
GetVisual(int nScreen) const469cdf0e10cSrcweir 	const SalVisual&      GetVisual( int nScreen ) const { return getDataForScreen(nScreen).m_aVisual; }
GetRenderEntries(int nScreen) const470cdf0e10cSrcweir 	RenderEntryMap&       GetRenderEntries( int nScreen ) const { return getDataForScreen(nScreen).m_aRenderData; }
GetResolution() const471cdf0e10cSrcweir 	const Pair	   &GetResolution() const { return aResolution_; }
GetExactResolution() const472cdf0e10cSrcweir     bool			GetExactResolution() const { return mbExactResolution; }
GetProperties() const473cdf0e10cSrcweir 	sal_uLong			GetProperties() const { return nProperties_; }
GetMaxRequestSize() const474cdf0e10cSrcweir 	sal_uLong			GetMaxRequestSize() const { return nMaxRequestSize_; }
475cdf0e10cSrcweir     XLIB_Time       GetLastUserEventTime( bool bAlwaysReget = false ) const;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir     bool            XIfEventWithTimeout( XEvent*, XPointer, X_if_predicate, long i_nTimeout = 1000 ) const;
478cdf0e10cSrcweir 
MouseCaptured(const SalFrame * pFrameData) const479cdf0e10cSrcweir 	sal_Bool			MouseCaptured( const SalFrame *pFrameData ) const
480cdf0e10cSrcweir     { return m_pCapture == pFrameData; }
GetCaptureFrame() const481cdf0e10cSrcweir     SalFrame*	GetCaptureFrame() const
482cdf0e10cSrcweir     { return m_pCapture; }
GetXLib() const483cdf0e10cSrcweir 	SalXLib*         GetXLib() const { return pXLib_; }
484cdf0e10cSrcweir 
GetInputMethod() const485cdf0e10cSrcweir 	SalI18N_InputMethod*			GetInputMethod()  const { return mpInputMethod;  }
GetKbdExtension() const486cdf0e10cSrcweir 	SalI18N_KeyboardExtension* 	GetKbdExtension() const { return mpKbdExtension; }
SetInputMethod(SalI18N_InputMethod * pInputMethod)487cdf0e10cSrcweir 	void 			SetInputMethod( SalI18N_InputMethod *pInputMethod )
488cdf0e10cSrcweir     { mpInputMethod = pInputMethod; }
SetKbdExtension(SalI18N_KeyboardExtension * pKbdExtension)489cdf0e10cSrcweir 	void			SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension)
490cdf0e10cSrcweir     { mpKbdExtension = pKbdExtension; }
491cdf0e10cSrcweir 	const char*	GetKeyboardName( sal_Bool bRefresh = sal_False );
getWMAdaptor() const492cdf0e10cSrcweir     ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; }
getDtIntegrator() const493cdf0e10cSrcweir     DtIntegrator* getDtIntegrator() const { return m_pDtIntegrator; }
IsXinerama() const494cdf0e10cSrcweir     bool			IsXinerama() const { return m_bXinerama; }
GetXineramaScreens() const495cdf0e10cSrcweir     const std::vector< Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; }
GetRootWindow(int nScreen) const496cdf0e10cSrcweir     XLIB_Window     GetRootWindow( int nScreen ) const
497cdf0e10cSrcweir     { return getDataForScreen( nScreen ).m_aRoot; }
GetScreenData()498cdf0e10cSrcweir     const std::vector< ScreenData >& GetScreenData()
499cdf0e10cSrcweir     { return m_aScreens; }
GetScreenCount() const500cdf0e10cSrcweir     int GetScreenCount() const { return static_cast<int>(m_aScreens.size()); }
501cdf0e10cSrcweir 
getFrames() const502cdf0e10cSrcweir     const std::list< SalFrame* >& getFrames() const
503cdf0e10cSrcweir     { return m_aFrames; }
504cdf0e10cSrcweir 
IsNumLockFromXS() const505cdf0e10cSrcweir     sal_Bool            IsNumLockFromXS() const { return bNumLockFromXS_; }
506cdf0e10cSrcweir 
getSalObjects()507cdf0e10cSrcweir     std::list< SalObject* >& getSalObjects() { return m_aSalObjects; }
508cdf0e10cSrcweir };
509cdf0e10cSrcweir 
510cdf0e10cSrcweir // -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
511cdf0e10cSrcweir 
GetGC(sal_uInt16 nDepth,int nScreen) const512cdf0e10cSrcweir inline GC SalDisplay::GetGC( sal_uInt16 nDepth, int nScreen ) const
513cdf0e10cSrcweir { return 1 == nDepth
514cdf0e10cSrcweir 	     ? GetMonoGC( nScreen )
515cdf0e10cSrcweir 	     : getDataForScreen(nScreen).m_aVisual.GetDepth() == nDepth
516cdf0e10cSrcweir 	       ? GetCopyGC( nScreen )
517cdf0e10cSrcweir 	       : None; }
518cdf0e10cSrcweir 
GetXDisplay() const519cdf0e10cSrcweir inline	Display	*SalColormap::GetXDisplay() const
520cdf0e10cSrcweir { return m_pDisplay->GetDisplay(); }
521cdf0e10cSrcweir 
522cdf0e10cSrcweir class VCLPLUG_GEN_PUBLIC SalX11Display : public SalDisplay
523cdf0e10cSrcweir {
524cdf0e10cSrcweir public:
525cdf0e10cSrcweir 		     SalX11Display( Display* pDisp );
526cdf0e10cSrcweir     virtual ~SalX11Display();
527cdf0e10cSrcweir 
528cdf0e10cSrcweir     virtual long		Dispatch( XEvent *pEvent );
529cdf0e10cSrcweir     virtual void		Yield();
530cdf0e10cSrcweir 
531cdf0e10cSrcweir     sal_Bool	 IsEvent();
532cdf0e10cSrcweir };
533cdf0e10cSrcweir 
534cdf0e10cSrcweir /*----------------------------------------------------------
535cdf0e10cSrcweir  keep track of correct size of the initial window
536cdf0e10cSrcweir  */
537cdf0e10cSrcweir // get foreign key names
538cdf0e10cSrcweir namespace vcl_sal {
539cdf0e10cSrcweir 	String getKeysymReplacementName(
540cdf0e10cSrcweir 		const char* pKeyboard,
541cdf0e10cSrcweir 		KeySym nSymbol );
542cdf0e10cSrcweir }
543cdf0e10cSrcweir 
544cdf0e10cSrcweir 
545cdf0e10cSrcweir #endif // _SV_SALDISP_HXX
546