[mutter] backends/native: Handle triple resolution mouse wheels better
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] backends/native: Handle triple resolution mouse wheels better
- Date: Wed, 17 Feb 2021 22:22:57 +0000 (UTC)
commit c77e943ce21b3bca4f1284a576537ada8e6a2375
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Thu Feb 11 12:33:26 2021 +0100
backends/native: Handle triple resolution mouse wheels better
When a remote desktop user emits a virtual smooth scrolling event, a
smooth scroll event, that is not emulated, is emitted and on occasion
a discrete scroll event, that is emulated, is emitted.
As base for the discrete scrolling event, the smooth scrolling steps
are accumulated.
When the accumulated smooth scrolling steps surpass the
DISCRETE_SCROLL_STEP, the discrete scrolling event is emitted.
Currently, mutter uses for DISCRETE_SCROLL_STEP the value 10, which is
a terrible value to work with, especially for high resolution mouse
wheels.
When a triple resolution mouse wheel is used, each scrolling step will
have the value 3 1/3.
Three of such events won't however surpass the DISCRETE_SCROLL_STEP.
To fix this situation, add DBL_EPSILON to the calculation step, when
checking for the discrete scroll event to ensure that 3 smooth scroll
events, with each having the value 3 1/3, emit a discrete scrolling
event.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1727>
src/backends/native/meta-seat-impl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index 25608e436d..b2c5e63e5f 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -818,8 +818,10 @@ check_notify_discrete_scroll (MetaSeatImpl *seat_impl,
{
int i, n_xscrolls, n_yscrolls;
- n_xscrolls = floor (fabs (seat_impl->accum_scroll_dx) / DISCRETE_SCROLL_STEP);
- n_yscrolls = floor (fabs (seat_impl->accum_scroll_dy) / DISCRETE_SCROLL_STEP);
+ n_xscrolls = floor ((fabs (seat_impl->accum_scroll_dx) + DBL_EPSILON) /
+ DISCRETE_SCROLL_STEP);
+ n_yscrolls = floor ((fabs (seat_impl->accum_scroll_dy) + DBL_EPSILON) /
+ DISCRETE_SCROLL_STEP);
for (i = 0; i < n_xscrolls; i++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]