diff options
| author | vaxerski <vaxry@vaxry.net> | 2023-12-24 13:20:31 +0100 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2023-12-24 13:20:31 +0100 |
| commit | ff75f991a50d9e82bb4ee4cacace551225ef2038 (patch) | |
| tree | 732c94a9c368a0ffd884be51ccbc263d4e3537db /src/Compositor.cpp | |
| parent | f013acc6eec60bb2db499aeb009176f932ea3624 (diff) | |
compositor: don't block focus if there is no keyboard
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 6d892127..4ea83e89 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1032,20 +1032,17 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) { return; } - const auto KEYBOARD = wlr_seat_get_keyboard(m_sSeat.seat); - - if (!KEYBOARD) - return; - - uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP] = {0}; // TODO: maybe send valid, non-keybind codes? - wlr_seat_keyboard_notify_enter(m_sSeat.seat, pSurface, keycodes, 0, &KEYBOARD->modifiers); - - wlr_seat_keyboard_focus_change_event event = { - .seat = m_sSeat.seat, - .old_surface = m_pLastFocus, - .new_surface = pSurface, - }; - wl_signal_emit_mutable(&m_sSeat.seat->keyboard_state.events.focus_change, &event); + if (const auto KEYBOARD = wlr_seat_get_keyboard(m_sSeat.seat); KEYBOARD) { + uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP] = {0}; // TODO: maybe send valid, non-keybind codes? + wlr_seat_keyboard_notify_enter(m_sSeat.seat, pSurface, keycodes, 0, &KEYBOARD->modifiers); + + wlr_seat_keyboard_focus_change_event event = { + .seat = m_sSeat.seat, + .old_surface = m_pLastFocus, + .new_surface = pSurface, + }; + wl_signal_emit_mutable(&m_sSeat.seat->keyboard_state.events.focus_change, &event); + } if (pWindowOwner) Debug::log(LOG, "Set keyboard focus to surface {:x}, with {}", (uintptr_t)pSurface, pWindowOwner); |
