From 5f6a1f5ae6a4edff2c0483995366d1ee578feacb Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Mon, 9 Jan 2017 16:40:26 +0100 Subject: [PATCH] fix(xkeyboard): Use separate throttle timers --- include/modules/xkeyboard.hpp | 4 +++- src/modules/xkeyboard.cpp | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/modules/xkeyboard.hpp b/include/modules/xkeyboard.hpp index d4534c86..9569ebc5 100644 --- a/include/modules/xkeyboard.hpp +++ b/include/modules/xkeyboard.hpp @@ -47,7 +47,9 @@ namespace modules { static constexpr const char* EVENT_SWITCH{"xkeyboard/switch"}; connection& m_connection; - event_timer m_xkbnotify{}; + event_timer m_xkb_newkb_notify{}; + event_timer m_xkb_state_notify{}; + event_timer m_xkb_indicator_notify{}; unique_ptr m_keyboard; label_t m_layout; diff --git a/src/modules/xkeyboard.cpp b/src/modules/xkeyboard.cpp index d1e8a875..a26be190 100644 --- a/src/modules/xkeyboard.cpp +++ b/src/modules/xkeyboard.cpp @@ -172,7 +172,7 @@ namespace modules { * Handler for XCB_XKB_NEW_KEYBOARD_NOTIFY events */ void xkeyboard_module::handle(const evt::xkb_new_keyboard_notify& evt) { - if (evt->changed & XCB_XKB_NKN_DETAIL_KEYCODES && m_xkbnotify.allow(evt->time)) { + if (evt->changed & XCB_XKB_NKN_DETAIL_KEYCODES && m_xkb_newkb_notify.allow(evt->time)) { query_keyboard(); update(); } @@ -182,7 +182,7 @@ namespace modules { * Handler for XCB_XKB_STATE_NOTIFY events */ void xkeyboard_module::handle(const evt::xkb_state_notify& evt) { - if (m_keyboard && evt->changed & XCB_XKB_STATE_PART_GROUP_STATE && m_xkbnotify.allow(evt->time)) { + if (m_keyboard && evt->changed & XCB_XKB_STATE_PART_GROUP_STATE && m_xkb_state_notify.allow(evt->time)) { m_keyboard->current(evt->group); update(); } @@ -192,7 +192,7 @@ namespace modules { * Handler for XCB_XKB_INDICATOR_STATE_NOTIFY events */ void xkeyboard_module::handle(const evt::xkb_indicator_state_notify& evt) { - if (m_xkbnotify.allow(evt->time) && m_keyboard) { + if (m_keyboard && m_xkb_indicator_notify.allow(evt->time)) { m_keyboard->set(m_connection.xkb().get_state(XCB_XKB_ID_USE_CORE_KBD)->lockedMods); update(); }