summaryrefslogtreecommitdiff
path: root/src/managers/input
diff options
context:
space:
mode:
authorDarksome <dev@darkso.me>2022-06-20 22:47:28 +0300
committerDarksome <dev@darkso.me>2022-06-20 22:47:28 +0300
commit8f62f6d4b0dbf18f1857e13831638a7d3615aeee (patch)
treea4d4f07e7bc4f86b6366da8016265ce783c13ca7 /src/managers/input
parentf5f531562bdd2e935017b5400bd3b4ae5f89b54b (diff)
Add workspace switching with mouse wheel
Diffstat (limited to 'src/managers/input')
-rw-r--r--src/managers/input/InputManager.cpp18
-rw-r--r--src/managers/input/InputManager.hpp1
2 files changed, 19 insertions, 0 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 003535f7..fefc4047 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -230,6 +230,24 @@ void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
}
+void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
+ const auto PKEYBOARD = wlr_seat_get_keyboard(g_pCompositor->m_sSeat.seat);
+
+ if (wlr_keyboard_get_modifiers(PKEYBOARD) == (uint32_t)g_pConfigManager->getInt("general:main_mod_internal") &&
+ e->source == WLR_AXIS_SOURCE_WHEEL && e->orientation == WLR_AXIS_ORIENTATION_VERTICAL) {
+
+ if (e->delta > 0) {
+ g_pKeybindManager->m_mDispatchers["workspace"]("-1");
+ } else {
+ g_pKeybindManager->m_mDispatchers["workspace"]("+1");
+ }
+
+ return;
+ }
+
+ wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, e->time_msec, e->orientation, e->delta, e->delta_discrete, e->source);
+}
+
Vector2D CInputManager::getMouseCoordsInternal() {
return Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y);
}
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index 18d9857e..7a3601bc 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -11,6 +11,7 @@ public:
void onMouseMoved(wlr_pointer_motion_event*);
void onMouseWarp(wlr_pointer_motion_absolute_event*);
void onMouseButton(wlr_pointer_button_event*);
+ void onMouseWheel(wlr_pointer_axis_event*);
void onKeyboardKey(wlr_keyboard_key_event*, SKeyboard*);
void onKeyboardMod(void*, SKeyboard*);