os_window_linux.h 1001 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2012-2014 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #pragma once
  6. #include "types.h"
  7. #include <X11/Xutil.h>
  8. #include <X11/Xatom.h>
  9. #include <X11/Xlib.h>
  10. #include <X11/XKBlib.h>
  11. namespace crown
  12. {
  13. void oswindow_set_window(Display* dpy, Window win);
  14. struct OsWindow
  15. {
  16. OsWindow();
  17. ~OsWindow();
  18. void show();
  19. void hide();
  20. void get_size(uint32_t& width, uint32_t& height);
  21. void get_position(uint32_t& x, uint32_t& y);
  22. void resize(uint32_t width, uint32_t height);
  23. void move(uint32_t x, uint32_t y);
  24. void minimize();
  25. void restore();
  26. bool is_resizable() const;
  27. void set_resizable(bool resizable);
  28. void show_cursor(bool show);
  29. void get_cursor_xy(int32_t& x, int32_t& y);
  30. void set_cursor_xy(int32_t x, int32_t y);
  31. char* title();
  32. void set_title(const char* title);
  33. public:
  34. uint32_t m_x;
  35. uint32_t m_y;
  36. uint32_t m_width;
  37. uint32_t m_height;
  38. bool m_resizable;
  39. };
  40. } // namespace crown