summaryrefslogtreecommitdiff
path: root/src/xcb_xkb.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-01-27 22:06:49 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-01-27 22:06:49 +0100
commit06950aab233de6a2f47293d59575bb42f6131660 (patch)
tree62f6eed4a6d35414f656d22b9ac7420849018a11 /src/xcb_xkb.hh
parent1ef9c463f1efc1adfb62e42ab3dd17e8c6394373 (diff)
Complete rewrite using C++ and with shared state support
Diffstat (limited to 'src/xcb_xkb.hh')
-rw-r--r--src/xcb_xkb.hh30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/xcb_xkb.hh b/src/xcb_xkb.hh
new file mode 100644
index 0000000..7bb3681
--- /dev/null
+++ b/src/xcb_xkb.hh
@@ -0,0 +1,30 @@
+#ifndef XCB_XKB_HH
+#define XCB_XKB_HH
+
+#include <memory>
+#include <string>
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+
+namespace xcb {
+
+class Keyboard {
+public:
+ virtual ~Keyboard() = default;
+
+ virtual bool handle_event(xcb_connection_t* conn,
+ xcb_generic_event_t* event) = 0;
+
+ virtual std::string get_utf8(xcb_key_press_event_t* event) = 0;
+
+ static std::unique_ptr<Keyboard> create(xcb_connection_t* conn);
+
+protected:
+ Keyboard() = default;
+ Keyboard(Keyboard const&) = delete;
+ Keyboard& operator=(Keyboard const&) = delete;
+};
+
+} // namespace xcb
+
+#endif // XCB_XKB_HH