summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-11-30 18:44:58 +0000
committerVaxry <vaxry@vaxry.net>2023-11-30 18:45:12 +0000
commitb2f36231312427d65362521836484fddb6ff91f8 (patch)
tree9e385b9c17bad7d747000b9c3b079719b0c0a3f7 /src/managers/input/InputManager.cpp
parent5513eed64d46ef542a2dfaeb4a3229e1d195b02b (diff)
events: add keyPress and mouseAxis
fixes #4011 fixes #4008
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index be5d296e..fe7bb75b 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -688,7 +688,10 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
auto factor = (*PSCROLLFACTOR <= 0.f || e->source != WLR_AXIS_SOURCE_FINGER ? 1.f : *PSCROLLFACTOR);
- bool passEvent = g_pKeybindManager->onAxisEvent(e);
+ const auto EMAP = std::unordered_map<std::string, std::any>{{"event", e}};
+ EMIT_HOOK_EVENT_CANCELLABLE("mouseAxis", EMAP);
+
+ bool passEvent = g_pKeybindManager->onAxisEvent(e);
g_pCompositor->notifyIdleActivity();
@@ -1152,6 +1155,9 @@ void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboar
if (!pKeyboard->enabled)
return;
+ const auto EMAP = std::unordered_map<std::string, std::any>{{"keyboard", pKeyboard}, {"event", e}};
+ EMIT_HOOK_EVENT_CANCELLABLE("keyPress", EMAP);
+
static auto* const PDPMS = &g_pConfigManager->getConfigValuePtr("misc:key_press_enables_dpms")->intValue;
if (*PDPMS && !g_pCompositor->m_bDPMSStateON) {
// enable dpms
@@ -1645,7 +1651,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
CBox box = w->getWindowMainSurfaceBox();
eBorderIconDirection direction = BORDERICON_NONE;
CBox boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE),
- box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
+ box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
if (w->hasPopupAt(mouseCoords))
direction = BORDERICON_NONE;