mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 02:20:30 +01:00
pad: switch the REL_WHEEL direction to match dials with scroll wheels
REL_WHEEL sends -1 for "down" and +1 for "up", so let's make sure we keep that correct here too. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1021>
This commit is contained in:
parent
436bb5cc56
commit
6fee92c959
2 changed files with 13 additions and 4 deletions
|
|
@ -111,7 +111,7 @@ pad_process_relative(struct pad_dispatch *pad,
|
|||
break;
|
||||
case REL_WHEEL:
|
||||
if (!pad->dials.has_hires_dial) {
|
||||
pad->dials.dial1 = e->value * 120;
|
||||
pad->dials.dial1 = -1 * e->value * 120;
|
||||
pad->changed_axes |= PAD_AXIS_DIAL1;
|
||||
pad_set_status(pad, PAD_AXES_UPDATED);
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ pad_process_relative(struct pad_dispatch *pad,
|
|||
}
|
||||
break;
|
||||
case REL_WHEEL_HI_RES:
|
||||
pad->dials.dial1 = e->value;
|
||||
pad->dials.dial1 = -1 * e->value;
|
||||
pad->changed_axes |= PAD_AXIS_DIAL1;
|
||||
pad_set_status(pad, PAD_AXES_UPDATED);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -526,7 +526,16 @@ START_TEST(pad_dial_low_res)
|
|||
struct libinput_event_tablet_pad *pev = litest_is_pad_dial_event(ev, 0);
|
||||
|
||||
double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev);
|
||||
ck_assert_double_eq(v120, 120.0 * direction);
|
||||
switch (code) {
|
||||
case REL_WHEEL: /* inverted */
|
||||
ck_assert_double_eq(v120, -120.0 * direction);
|
||||
break;
|
||||
case REL_DIAL:
|
||||
ck_assert_double_eq(v120, 120.0 * direction);
|
||||
break;
|
||||
default:
|
||||
ck_abort();
|
||||
}
|
||||
libinput_event_destroy(ev);
|
||||
}
|
||||
}
|
||||
|
|
@ -556,7 +565,7 @@ START_TEST(pad_dial_hi_res)
|
|||
struct libinput_event_tablet_pad *pev = litest_is_pad_dial_event(ev, 0);
|
||||
|
||||
double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev);
|
||||
ck_assert_double_eq(v120, increment);
|
||||
ck_assert_double_eq(v120, -increment); /* REL_WHEEL is inverted */
|
||||
libinput_event_destroy(ev);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue