X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8166ab4343099511fbd6f013fbeb9afc87c69a25..e2dd624761180dccdb2a542623964c8cd4fdb721:/include/wx/unix/utilsx11.h diff --git a/include/wx/unix/utilsx11.h b/include/wx/unix/utilsx11.h index 10c1f57f76..cf6e1dddd1 100644 --- a/include/wx/unix/utilsx11.h +++ b/include/wx/unix/utilsx11.h @@ -1,12 +1,13 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/unix/utilsx11.h // Purpose: Miscellaneous X11 functions -// Author: Mattia Barbon, Vaclav Slavik +// Author: Mattia Barbon, Vaclav Slavik, Vadim Zeitlin // Modified by: // Created: 25.03.02 // RCS-ID: $Id$ -// Copyright: (c) wxWindows team -// Licence: wxWindows license +// Copyright: (c) wxWidgets team +// (c) 2010 Vadim Zeitlin +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_UNIX_UTILSX11_H_ @@ -15,7 +16,9 @@ #include "wx/defs.h" #include "wx/gdicmn.h" -// NB: Content of this header is for wxWindows' private use! It is not +#include + +// NB: Content of this header is for wxWidgets' private use! It is not // part of public API and may be modified or even disappear in the future! #if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__) @@ -24,6 +27,10 @@ typedef void WXDisplay; typedef void* WXWindow; #endif +typedef unsigned long WXKeySym; + +int wxCharCodeXToWX(WXKeySym keySym); +WXKeySym wxCharCodeWXToX(int id); class wxIconBundle; @@ -46,8 +53,27 @@ void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow, WXWindow window, bool show, wxRect *origSize, wxX11FullScreenMethod method); -#endif - // __WXMOTIF__, __WXGTK__, __WXX11__ -#endif - // _WX_UNIX_UTILSX11_H_ +// Class wrapping X11 Display: it opens it in ctor and closes it in dtor. +class wxX11Display +{ +public: + wxX11Display() { m_dpy = XOpenDisplay(NULL); } + ~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); } + + operator Display *() const { return m_dpy; } + + // Using DefaultRootWindow() with an object of wxX11Display class doesn't + // compile because it is a macro which tries to cast wxX11Display so + // provide a convenient helper. + Window DefaultRoot() const { return DefaultRootWindow(m_dpy); } + +private: + Display *m_dpy; + + wxDECLARE_NO_COPY_CLASS(wxX11Display); +}; + +#endif // __WXMOTIF__, __WXGTK__, __WXX11__ + +#endif // _WX_UNIX_UTILSX11_H_