summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-04-21 12:50:31 +0100
committerVaxry <vaxry@vaxry.net>2024-04-21 12:50:37 +0100
commit4dc07c4378e0fad735fb0efc96d6200739d5cae1 (patch)
treecbbe0ff4ad74705158f87061b93b89d72ebffdb0 /src/managers/KeybindManager.cpp
parent8ca28dd510f9aaf1cdf28d1e22a568f57319d0ce (diff)
keybinds: clear repeat source on mouse inputs
fixes #5671
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 39ede5d4..34e2f85b 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -335,14 +335,14 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
.submapAtPress = m_szCurrentSelectedSubmap,
};
+ if (m_pActiveKeybindEventSource) {
+ wl_event_source_remove(m_pActiveKeybindEventSource);
+ m_pActiveKeybindEventSource = nullptr;
+ m_pActiveKeybind = nullptr;
+ }
+
bool suppressEvent = false;
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
- // clean repeat
- if (m_pActiveKeybindEventSource) {
- wl_event_source_remove(m_pActiveKeybindEventSource);
- m_pActiveKeybindEventSource = nullptr;
- m_pActiveKeybind = nullptr;
- }
m_dPressedKeys.push_back(KEY);
@@ -353,12 +353,6 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
m_dPressedKeys.back().sent = !suppressEvent;
} else { // key release
- // clean repeat
- if (m_pActiveKeybindEventSource) {
- wl_event_source_remove(m_pActiveKeybindEventSource);
- m_pActiveKeybindEventSource = nullptr;
- m_pActiveKeybind = nullptr;
- }
bool foundInPressedKeys = false;
for (auto it = m_dPressedKeys.begin(); it != m_dPressedKeys.end();) {
@@ -396,6 +390,12 @@ bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) {
m_tScrollTimer.reset();
+ if (m_pActiveKeybindEventSource) {
+ wl_event_source_remove(m_pActiveKeybindEventSource);
+ m_pActiveKeybindEventSource = nullptr;
+ m_pActiveKeybind = nullptr;
+ }
+
bool found = false;
if (e->source == WL_POINTER_AXIS_SOURCE_WHEEL && e->orientation == WL_POINTER_AXIS_VERTICAL_SCROLL) {
if (e->delta < 0)
@@ -433,6 +433,12 @@ bool CKeybindManager::onMouseEvent(wlr_pointer_button_event* e) {
.modmaskAtPressTime = MODS,
};
+ if (m_pActiveKeybindEventSource) {
+ wl_event_source_remove(m_pActiveKeybindEventSource);
+ m_pActiveKeybindEventSource = nullptr;
+ m_pActiveKeybind = nullptr;
+ }
+
if (e->state == WL_POINTER_BUTTON_STATE_PRESSED) {
m_dPressedKeys.push_back(KEY);