utilsx11.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. // Copyright: (c) wxWidgets team
  8. // (c) 2010 Vadim Zeitlin
  9. // Licence: wxWindows licence
  10. /////////////////////////////////////////////////////////////////////////////
  11. #ifndef _WX_UNIX_UTILSX11_H_
  12. #define _WX_UNIX_UTILSX11_H_
  13. #include "wx/defs.h"
  14. #include "wx/gdicmn.h"
  15. #include <X11/Xlib.h>
  16. // NB: Content of this header is for wxWidgets' private use! It is not
  17. // part of public API and may be modified or even disappear in the future!
  18. #if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)
  19. #if defined(__WXGTK__)
  20. typedef void WXDisplay;
  21. typedef void* WXWindow;
  22. #endif
  23. typedef unsigned long WXKeySym;
  24. int wxCharCodeXToWX(WXKeySym keySym);
  25. WXKeySym wxCharCodeWXToX(int id);
  26. class wxIconBundle;
  27. void wxSetIconsX11( WXDisplay* display, WXWindow window,
  28. const wxIconBundle& ib );
  29. enum wxX11FullScreenMethod
  30. {
  31. wxX11_FS_AUTODETECT = 0,
  32. wxX11_FS_WMSPEC,
  33. wxX11_FS_KDE,
  34. wxX11_FS_GENERIC
  35. };
  36. wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
  37. WXWindow rootWindow);
  38. void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
  39. WXWindow window, bool show, wxRect *origSize,
  40. wxX11FullScreenMethod method);
  41. // Class wrapping X11 Display: it opens it in ctor and closes it in dtor.
  42. class wxX11Display
  43. {
  44. public:
  45. wxX11Display() { m_dpy = XOpenDisplay(NULL); }
  46. ~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }
  47. operator Display *() const { return m_dpy; }
  48. // Using DefaultRootWindow() with an object of wxX11Display class doesn't
  49. // compile because it is a macro which tries to cast wxX11Display so
  50. // provide a convenient helper.
  51. Window DefaultRoot() const { return DefaultRootWindow(m_dpy); }
  52. private:
  53. Display *m_dpy;
  54. wxDECLARE_NO_COPY_CLASS(wxX11Display);
  55. };
  56. #endif // __WXMOTIF__, __WXGTK__, __WXX11__
  57. #endif // _WX_UNIX_UTILSX11_H_