summaryrefslogtreecommitdiff
path: root/src/managers/input
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-10-21 14:52:43 +0100
committerVaxry <vaxry@vaxry.net>2023-10-21 14:52:43 +0100
commita61eb7694df25a75f45502ed64b1536fda370c1d (patch)
tree30c48c414cec95598c50bed092ee35c19f3e28a2 /src/managers/input
parentc6233a790fed3d9a3100e16a73143700846928a2 (diff)
hooksystem: add callbackinfo struct and cancellable events
Diffstat (limited to 'src/managers/input')
-rw-r--r--src/managers/input/InputManager.cpp10
-rw-r--r--src/managers/input/InputMethodRelay.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index ab5be4bc..1d8b5135 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -97,11 +97,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (MOUSECOORDSFLOORED == m_vLastCursorPosFloored && !refocus)
return;
+ EMIT_HOOK_EVENT_CANCELLABLE("mouseMove", MOUSECOORDSFLOORED);
+
if (time)
g_pCompositor->notifyIdleActivity();
- EMIT_HOOK_EVENT("mouseMove", MOUSECOORDSFLOORED);
-
m_vLastCursorPosFloored = MOUSECOORDSFLOORED;
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
@@ -422,9 +422,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
}
void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
- g_pCompositor->notifyIdleActivity();
+ EMIT_HOOK_EVENT_CANCELLABLE("mouseButton", e);
- EMIT_HOOK_EVENT("mouseButton", e);
+ g_pCompositor->notifyIdleActivity();
m_tmrLastCursorMovement.reset();
@@ -1580,7 +1580,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
eBorderIconDirection direction = BORDERICON_NONE;
wlr_box 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 (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow)) {
direction = BORDERICON_NONE;
diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp
index 58ad2a2d..4af17096 100644
--- a/src/managers/input/InputMethodRelay.cpp
+++ b/src/managers/input/InputMethodRelay.cpp
@@ -3,7 +3,7 @@
#include "../../Compositor.hpp"
CInputMethodRelay::CInputMethodRelay() {
- g_pHookSystem->hookDynamic("keyboardFocus", [&](void* self, std::any param) { onKeyboardFocus(std::any_cast<wlr_surface*>(param)); });
+ g_pHookSystem->hookDynamic("keyboardFocus", [&](void* self, SCallbackInfo& info, std::any param) { onKeyboardFocus(std::any_cast<wlr_surface*>(param)); });
}
void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {