handle keys and focus

This commit is contained in:
vaxerski
2022-03-18 23:06:45 +01:00
parent 5811d968bf
commit dbf566c78a
4 changed files with 28 additions and 7 deletions

View File

@@ -89,10 +89,26 @@ void CInputManager::newMouse(wlr_input_device* mouse) {
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
}
void CInputManager::onKeyboardKey(wlr_event_keyboard_key* event) {
void CInputManager::onKeyboardKey(wlr_event_keyboard_key* e, SKeyboard* pKeyboard) {
const auto KEYCODE = e->keycode + 8; // Because to xkbcommon it's +8 from libinput
const xkb_keysym_t* keysyms;
int syms = xkb_state_key_get_syms(pKeyboard->keyboard->keyboard->xkb_state, KEYCODE, &keysyms);
const auto MODS = wlr_keyboard_get_modifiers(pKeyboard->keyboard->keyboard);
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat);
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
// TODO: keybinds
}
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, pKeyboard->keyboard);
wlr_seat_keyboard_notify_key(g_pCompositor->m_sWLRSeat, e->time_msec, e->keycode, e->state);
}
void CInputManager::onKeyboardMod(void* data) {
void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) {
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, pKeyboard->keyboard);
wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sWLRSeat, &pKeyboard->keyboard->keyboard->modifiers);
}

View File

@@ -10,8 +10,8 @@ public:
void onMouseMoved(wlr_event_pointer_motion*);
void onMouseWarp(wlr_event_pointer_motion_absolute*);
void onMouseButton(wlr_event_pointer_button*);
void onKeyboardKey(wlr_event_keyboard_key*);
void onKeyboardMod(void*);
void onKeyboardKey(wlr_event_keyboard_key*, SKeyboard*);
void onKeyboardMod(void*, SKeyboard*);
void newKeyboard(wlr_input_device*);
void newMouse(wlr_input_device*);