From 1eceae811f54a87c3c7de1d10202842db78c3f69 Mon Sep 17 00:00:00 2001 From: Darksome Date: Fri, 15 Jul 2022 21:54:05 +0300 Subject: Try mouse wheel configuration --- src/managers/KeybindManager.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/managers/KeybindManager.cpp') diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 60e4cdd6..4e00818e 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -82,10 +82,10 @@ uint32_t CKeybindManager::stringToModMask(std::string mods) { return modMask; } -bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t& key, const int& keycode) { +bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string& key, const xkb_keysym_t& keysym, const int& keycode) { bool found = false; - if (handleInternalKeybinds(key)) + if (handleInternalKeybinds(keysym)) return true; if (g_pCompositor->m_sSeat.exclusiveClient) @@ -95,13 +95,14 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap) continue; - - if (k.keycode != -1) { + if (!key.empty()) { + if (key != k.key) + continue; + } else if (k.keycode != -1) { if (keycode != k.keycode) continue; - } else { - if (key == 0) + if (keysym == 0) continue; // this is a keycode check run // oMg such performance hit!!11! @@ -110,7 +111,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t const auto KBKEYUPPER = xkb_keysym_to_upper(KBKEY); // small TODO: fix 0-9 keys and other modified ones with shift - if (key != KBKEY && key != KBKEYUPPER) + if (keysym != KBKEY && keysym != KBKEYUPPER) continue; } @@ -121,7 +122,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t Debug::log(ERR, "Inavlid handler in a keybind! (handler %s does not exist)", k.handler.c_str()); } else { // call the dispatcher - Debug::log(LOG, "Keybind triggered, calling dispatcher (%d, %d)", modmask, key); + Debug::log(LOG, "Keybind triggered, calling dispatcher (%d, %s)", modmask, key); DISPATCHER->second(k.arg); } -- cgit v1.2.3 From 08319dd1f5185e1938df86a0a0a61f06b30026f4 Mon Sep 17 00:00:00 2001 From: Darksome Date: Sat, 16 Jul 2022 15:34:13 +0300 Subject: Fix handleKeybinds debug log --- src/managers/KeybindManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/managers/KeybindManager.cpp') diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 4e00818e..3aecc3b6 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -122,7 +122,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string& Debug::log(ERR, "Inavlid handler in a keybind! (handler %s does not exist)", k.handler.c_str()); } else { // call the dispatcher - Debug::log(LOG, "Keybind triggered, calling dispatcher (%d, %s)", modmask, key); + Debug::log(LOG, "Keybind triggered, calling dispatcher (%d, %s, %d)", modmask, key, keysym); DISPATCHER->second(k.arg); } -- cgit v1.2.3 From ce508f1cdc5b504c16792eddb8b0a04b5dbba4d7 Mon Sep 17 00:00:00 2001 From: Darksome Date: Thu, 21 Jul 2022 19:48:34 +0300 Subject: Fix merge --- src/managers/KeybindManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/managers/KeybindManager.cpp') diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index cf820611..7fb4f2bd 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -169,7 +169,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string& if (pressed && k.release) { // suppress down event - m_kHeldBack = key; + m_kHeldBack = keysym; return true; } -- cgit v1.2.3 From d5ccca4fdbdf53eec011210f4bbbdb20049aa12e Mon Sep 17 00:00:00 2001 From: Darksome Date: Thu, 21 Jul 2022 20:31:38 +0300 Subject: Consider scroll as a 'pressed' key --- src/managers/KeybindManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/managers/KeybindManager.cpp') diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 7fb4f2bd..3f723565 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -119,9 +119,9 @@ bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) { bool found = false; if (e->source == WLR_AXIS_SOURCE_WHEEL && e->orientation == WLR_AXIS_ORIENTATION_VERTICAL) { if (e->delta < 0) { - found = g_pKeybindManager->handleKeybinds(MODS, "mouse_down", 0, 0, false, 0); + found = g_pKeybindManager->handleKeybinds(MODS, "mouse_down", 0, 0, true, 0); } else { - found = g_pKeybindManager->handleKeybinds(MODS, "mouse_up", 0, 0, false, 0); + found = g_pKeybindManager->handleKeybinds(MODS, "mouse_up", 0, 0, true, 0); } } -- cgit v1.2.3