@@ -51,12 +51,8 @@ namespace {
5151 ::ioctl (fd, UI_SET_RELBIT, REL_X);
5252 ::ioctl (fd, UI_SET_RELBIT, REL_Y);
5353 ::ioctl (fd, UI_SET_RELBIT, REL_Z);
54- ::ioctl (fd, UI_SET_RELBIT, REL_WHEEL);
55- ::ioctl (fd, UI_SET_RELBIT, REL_HWHEEL);
56- #if defined(REL_WHEEL_HI_RES)
5754 ::ioctl (fd, UI_SET_RELBIT, REL_WHEEL_HI_RES);
5855 ::ioctl (fd, UI_SET_RELBIT, REL_HWHEEL_HI_RES);
59- #endif
6056
6157 // add absolute axes which are commonly found on keyboards
6258 ::ioctl (fd, UI_SET_EVBIT, EV_ABS);
@@ -142,8 +138,18 @@ class VirtualDeviceImpl {
142138 }
143139
144140 bool send_key_event (const KeyEvent& event) {
145- return send_event (EV_KEY, *event.key , get_key_event_value (event)) &&
146- send_event (EV_SYN, SYN_REPORT, 0 );
141+ if (is_mouse_wheel (event.key )) {
142+ const auto value = (event.value ?
143+ static_cast <int16_t >(event.value ) :
144+ event.key == Key::WheelDown ? -120 : 120 );
145+ if (!send_event (EV_REL, REL_WHEEL_HI_RES, value))
146+ return false ;
147+ }
148+ else {
149+ if (!send_event (EV_KEY, *event.key , get_key_event_value (event)))
150+ return false ;
151+ }
152+ return send_event (EV_SYN, SYN_REPORT, 0 );
147153 }
148154};
149155
0 commit comments