mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 15:25:59 +01:00
Add workspace switching with mouse wheel
This commit is contained in:
parent
f5f531562b
commit
8f62f6d4b0
3 changed files with 21 additions and 3 deletions
|
@ -49,9 +49,8 @@ void Events::listener_mouseButton(wl_listener* listener, void* data) {
|
|||
}
|
||||
|
||||
void Events::listener_mouseAxis(wl_listener* listener, void* data) {
|
||||
const auto E = (wlr_pointer_axis_event*)data;
|
||||
g_pInputManager->onMouseWheel((wlr_pointer_axis_event*)data);
|
||||
|
||||
wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, E->time_msec, E->orientation, E->delta, E->delta_discrete, E->source);
|
||||
}
|
||||
|
||||
void Events::listener_requestMouse(wl_listener* listener, void* data) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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*);
|
||||
|
||||
|
|
Loading…
Reference in a new issue