29 lines
664 B
C++
29 lines
664 B
C++
#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(xcb_connection_t* connection);
|
|
|
|
static std::unique_ptr<XcbKeyboard> Create(xcb_connection_t* connection);
|
|
|
|
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>;
|