mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 00:25:57 +01:00
seat: discrete round away from zero + high res scrolling (#6317)
* Discrete scrolling round away from zero e.deltaDiscrete can be multiples of 30 instead of the usual 120 causing the rounded value to be 0 when too small causing erratic scrolling. * Send value120 alongside discrete Fixes sensitivity issues for clients that support value120 axis events
This commit is contained in:
parent
5517cc506b
commit
d0a224a491
3 changed files with 11 additions and 5 deletions
|
@ -290,7 +290,7 @@ void CSeatManager::sendPointerFrame(WP<CWLSeatResource> pResource) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSeatManager::sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double value, int32_t discrete, wl_pointer_axis_source source,
|
void CSeatManager::sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double value, int32_t discrete, int32_t value120, wl_pointer_axis_source source,
|
||||||
wl_pointer_axis_relative_direction relative) {
|
wl_pointer_axis_relative_direction relative) {
|
||||||
if (!state.pointerFocusResource)
|
if (!state.pointerFocusResource)
|
||||||
return;
|
return;
|
||||||
|
@ -303,8 +303,10 @@ void CSeatManager::sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double
|
||||||
p->sendAxisSource(source);
|
p->sendAxisSource(source);
|
||||||
p->sendAxisRelativeDirection(axis, relative);
|
p->sendAxisRelativeDirection(axis, relative);
|
||||||
|
|
||||||
if (source == 0)
|
if (source == 0) {
|
||||||
|
p->sendAxisValue120(axis, value120);
|
||||||
p->sendAxisDiscrete(axis, discrete);
|
p->sendAxisDiscrete(axis, discrete);
|
||||||
|
}
|
||||||
|
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
p->sendAxisStop(timeMs, axis);
|
p->sendAxisStop(timeMs, axis);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <wayland-server-protocol.h>
|
#include <wayland-server-protocol.h>
|
||||||
#include "../helpers/WLListener.hpp"
|
#include "../helpers/WLListener.hpp"
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
|
@ -65,7 +66,8 @@ class CSeatManager {
|
||||||
void sendPointerButton(uint32_t timeMs, uint32_t key, wl_pointer_button_state state);
|
void sendPointerButton(uint32_t timeMs, uint32_t key, wl_pointer_button_state state);
|
||||||
void sendPointerFrame();
|
void sendPointerFrame();
|
||||||
void sendPointerFrame(WP<CWLSeatResource> pResource);
|
void sendPointerFrame(WP<CWLSeatResource> pResource);
|
||||||
void sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double value, int32_t discrete, wl_pointer_axis_source source, wl_pointer_axis_relative_direction relative);
|
void sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double value, int32_t discrete, int32_t value120, wl_pointer_axis_source source,
|
||||||
|
wl_pointer_axis_relative_direction relative);
|
||||||
|
|
||||||
void sendTouchDown(wlr_surface* surf, uint32_t timeMs, int32_t id, const Vector2D& local);
|
void sendTouchDown(wlr_surface* surf, uint32_t timeMs, int32_t id, const Vector2D& local);
|
||||||
void sendTouchUp(uint32_t timeMs, int32_t id);
|
void sendTouchUp(uint32_t timeMs, int32_t id);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "InputManager.hpp"
|
#include "InputManager.hpp"
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "wlr/types/wlr_switch.h"
|
#include "wlr/types/wlr_switch.h"
|
||||||
|
#include <cstdint>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
#include "../../desktop/Window.hpp"
|
#include "../../desktop/Window.hpp"
|
||||||
|
@ -782,8 +783,9 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
double deltaDiscrete = factor * e.deltaDiscrete / std::abs(e.deltaDiscrete);
|
||||||
g_pSeatManager->sendPointerAxis(e.timeMs, e.axis, factor * e.delta, std::round(factor * e.deltaDiscrete / 120), e.source, WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL);
|
g_pSeatManager->sendPointerAxis(e.timeMs, e.axis, factor * e.delta, deltaDiscrete > 0 ? std::ceil(deltaDiscrete) : std::floor(deltaDiscrete),
|
||||||
|
std::round(factor * e.deltaDiscrete), e.source, WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CInputManager::getMouseCoordsInternal() {
|
Vector2D CInputManager::getMouseCoordsInternal() {
|
||||||
|
|
Loading…
Reference in a new issue