BsLinuxPlatform.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include <X11/X.h>
  5. #include <X11/Xlib.h>
  6. #include "Platform/BsPlatform.h"
  7. namespace bs
  8. {
  9. class LinuxWindow;
  10. /** @addtogroup Platform-Internal
  11. * @{
  12. */
  13. /**
  14. * Contains various Linux specific platform functionality;
  15. */
  16. class BS_CORE_EXPORT LinuxPlatform : public Platform
  17. {
  18. public:
  19. /** Returns the active X11 display. */
  20. static ::Display* getXDisplay();
  21. /** Returns the main X11 window. Caller must ensure the main window has been created. */
  22. static ::Window getMainXWindow();
  23. /** Locks access to the X11 system, not allowing any other thread to access it. Must be used for every X11 access. */
  24. static void lockX();
  25. /** Unlocks access to the X11 system. Must follow every call to lockX(). */
  26. static void unlockX();
  27. /** Notifies the system that a new window was created. */
  28. static void _registerWindow(::Window xWindow, LinuxWindow* window);
  29. /** Notifies the system that a window is about to be destroyed. */
  30. static void _unregisterWindow(::Window xWindow);
  31. /** Generates a X11 Pixmap from the provided pixel data. */
  32. static Pixmap createPixmap(const PixelData& data);
  33. };
  34. /** @} */
  35. }
  36. // Undefine conflicting defines from X.h
  37. #undef None
  38. #undef Success
  39. #undef Convex
  40. #undef Bool