Add XKB interface for x11

This commit is contained in:
James Grogan 2022-11-17 11:28:18 +00:00
parent 7ad237edc1
commit cf9bace272
15 changed files with 232 additions and 31 deletions

View file

@ -1,14 +1,29 @@
#pragma once
#include "Keyboard.h"
#include <xcb/xcb.h>
#include <xkbcommon/xkbcommon.h>
struct xcb_xkb_state_notify_event_t;
class XcbKeyboard : public Keyboard
{
public:
XcbKeyboard();
XcbKeyboard(xcb_connection_t* connection);
static std::unique_ptr<XcbKeyboard> Create();
static std::unique_ptr<XcbKeyboard> Create(xcb_connection_t* connection);
std::string GetKeyString(KeyCode keyCode) override;
std::string getKeyString(KeyCode keyCode) override;
void updateState(xcb_xkb_state_notify_event_t *state);
private:
void getKeyMap();
xcb_connection_t* mConnection{nullptr};
xkb_state* mXkbState{nullptr};
xkb_context* mXkbContext{nullptr};
xkb_keymap* mXkbKeymap{nullptr};
};
using XcbKeyboardUPtr = std::unique_ptr<XcbKeyboard>;