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>
This commit is contained in:
parent
a5d692582d
commit
c77e943ce2
@ -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++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user