xref: /trunk/main/vcl/inc/unx/gtk/gtkdata.hxx (revision 161f4cd1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _VCL_GTKDATA_HXX
25 #define _VCL_GTKDATA_HXX
26 
27 #include <tools/prex.h>
28 #include <gdk/gdk.h>
29 #include <gdk/gdkx.h>
30 #include <gtk/gtk.h>
31 #include <tools/postx.h>
32 
33 #include <unx/saldisp.hxx>
34 #include <unx/saldata.hxx>
35 #include <vcl/ptrstyle.hxx>
36 
37 #include <list>
38 
39 class GtkData : public X11SalData
40 {
41 public:
GtkData()42     GtkData() {}
43     virtual ~GtkData();
44 
45     virtual void Init();
46 
47     virtual void initNWF();
48     virtual void deInitNWF();
49 };
50 
51 class GtkSalFrame;
52 
53 class GtkSalDisplay : public SalDisplay
54 {
55     GdkDisplay*						m_pGdkDisplay;
56 	GdkCursor                      *m_aCursors[ POINTER_COUNT ];
57     bool                            m_bStartupCompleted;
58     std::vector< int >              m_aXineramaScreenIndexMap;
59 
60 	GdkCursor* getFromXPM( const char *pBitmap, const char *pMask,
61 						   int nWidth, int nHeight, int nXHot, int nYHot );
62 public:
63 			 GtkSalDisplay( GdkDisplay* pDisplay );
64     virtual ~GtkSalDisplay();
65 
GetGdkDisplay() const66     GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; }
67 
68     virtual void deregisterFrame( SalFrame* pFrame );
69 	GdkCursor *getCursor( PointerStyle ePointerStyle );
70 	virtual int CaptureMouse( SalFrame* pFrame );
71     virtual long Dispatch( XEvent *pEvent );
72     virtual void initScreen( int nScreen ) const;
73 
74     virtual int GetDefaultMonitorNumber() const;
75 
76     static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event,
77                                            GdkEvent* event,
78                                            gpointer data );
HasMoreEvents()79 	inline bool HasMoreEvents()     { return m_aUserEvents.size() > 1; }
EventGuardAcquire()80 	inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); }
EventGuardRelease()81 	inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); }
startupNotificationCompleted()82     void startupNotificationCompleted() { m_bStartupCompleted = true; }
83 
84     void screenSizeChanged( GdkScreen* );
85     void monitorsChanged( GdkScreen* );
86 };
87 
88 
89 #endif // _VCL_GTKDATA_HXX
90