1// LAF OS Library
2// Copyright (C) 2020-2022 Igara Studio S.A.
3// Copyright (C) 2016-2018 David Capello
4//
5// This file is released under the terms of the MIT license.
6// Read LICENSE.txt for more information.
7
8#ifndef OS_X11_X11_INCLUDED
9#define OS_X11_X11_INCLUDED
10#pragma once
11
12#include "base/debug.h"
13#include "gfx/color_space.h" // Include here avoid error with None
14#include "os/event_queue.h"
15
16#include <X11/Xlib.h>
17
18#include <memory>
19
20namespace os {
21
22class XInput;
23
24class X11 {
25 static X11* m_instance;
26public:
27 static X11* instance();
28
29 X11();
30 ~X11();
31
32 ::Display* display() const { return m_display; }
33 ::XIM xim() const { return m_xim; }
34 XInput* xinput();
35
36 std::string userDefinedTablet() { return m_userDefinedTablet; }
37 void setUserDefinedTablet(const std::string& str) {
38 m_userDefinedTablet = str;
39 }
40
41private:
42 ::Display* m_display;
43 ::XIM m_xim;
44 std::unique_ptr<XInput> m_xinput;
45 std::string m_userDefinedTablet;
46};
47
48// User-defined string to detect a stylys/pen because it looks like
49// Linux doesn't offer a flag/device type to detect them (?)
50void x11_set_user_defined_string_to_detect_stylus(const std::string& str);
51
52} // namespace os
53
54#endif
55