Lugdunum  0.1.0
WindowImplX11.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <lug/Math/Vector.hpp>
4 #include <lug/Window/Window.hpp> // I include Window.hpp before Xlib because Xlib is dumb
5 #include <X11/Xlib.h>
6 
7 namespace lug {
8 namespace Window {
9 namespace priv {
10 
11 class LUG_WINDOW_API WindowImpl {
12 public:
13  WindowImpl(Window*);
14  ~WindowImpl() = default;
15 
16  WindowImpl(const WindowImpl&) = delete;
17  WindowImpl(WindowImpl&&) = delete;
18  WindowImpl& operator=(const WindowImpl&) = delete;
19  WindowImpl& operator=(WindowImpl&&) = delete;
20 
21  bool init(const Window::InitInfo& initInfo);
22  void close();
23 
24  bool pollEvent(lug::Window::Event& event);
25  void setKeyRepeat(bool state);
26  void setMouseCursorVisible(bool visible);
27  void setMousePos(const Math::Vec2i& mousePosition);
28 
29  Display* getDisplay() const;
30  ::Window getWindow() const;
31 
32 private:
33  void setWindowDecorations(Style style);
34  bool shouldIgnoreRepeated(XEvent& xEvent);
35 
36 private:
37  Window* _parent{nullptr};
38 
39  Display* _display{nullptr};
40  ::Window _window{0};
41 
44  Atom _wmHints;
45 
46  Cursor _hiddenCursor{0};
47 
48  bool _keyRepeat{true};
49 };
50 
51 } // namespace priv
52 } // namespace Window
53 } // namespace lug
Represents an event.
Definition: Event.hpp:89
Class for window.
Definition: Window.hpp:59
#define LUG_WINDOW_API
Definition: Export.hpp:11
void close(Handle handle)
Definition: Library.inl:48