]> git.saurik.com Git - wxWidgets.git/blob - include/wx/unix/utilsx11.h
Extract X11 Display wrapper class in a private header.
[wxWidgets.git] / include / wx / unix / utilsx11.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/utilsx11.h
3 // Purpose: Miscellaneous X11 functions
4 // Author: Mattia Barbon, Vaclav Slavik, Vadim Zeitlin
5 // Modified by:
6 // Created: 25.03.02
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWidgets team
9 // (c) 2010 Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_UNIX_UTILSX11_H_
14 #define _WX_UNIX_UTILSX11_H_
15
16 #include "wx/defs.h"
17 #include "wx/gdicmn.h"
18
19 #include <X11/Xlib.h>
20
21 // NB: Content of this header is for wxWidgets' private use! It is not
22 // part of public API and may be modified or even disappear in the future!
23
24 #if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)
25
26 #if defined(__WXGTK__)
27 typedef void WXDisplay;
28 typedef void* WXWindow;
29 #endif
30
31 class wxIconBundle;
32
33 void wxSetIconsX11( WXDisplay* display, WXWindow window,
34 const wxIconBundle& ib );
35
36
37 enum wxX11FullScreenMethod
38 {
39 wxX11_FS_AUTODETECT = 0,
40 wxX11_FS_WMSPEC,
41 wxX11_FS_KDE,
42 wxX11_FS_GENERIC
43 };
44
45 wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
46 WXWindow rootWindow);
47
48 void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
49 WXWindow window, bool show, wxRect *origSize,
50 wxX11FullScreenMethod method);
51
52
53 // Class wrapping X11 Display: it opens it in ctor and closes it in dtor.
54 class wxX11Display
55 {
56 public:
57 wxX11Display() { m_dpy = XOpenDisplay(NULL); }
58 ~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }
59
60 operator Display *() const { return m_dpy; }
61
62 // Using DefaultRootWindow() with an object of wxX11Display class doesn't
63 // compile because it is a macro which tries to cast wxX11Display so
64 // provide a convenient helper.
65 Window DefaultRoot() const { return DefaultRootWindow(m_dpy); }
66
67 private:
68 Display *m_dpy;
69
70 wxDECLARE_NO_COPY_CLASS(wxX11Display);
71 };
72
73 #endif // __WXMOTIF__, __WXGTK__, __WXX11__
74
75 #endif // _WX_UNIX_UTILSX11_H_