vbox6: enable mouse wheel reporting

This commit is contained in:
Christian Helmuth 2021-09-09 13:28:23 +02:00 committed by Norman Feske
parent 4a87fcc4cf
commit 5c82045170

View File

@ -126,18 +126,22 @@ void Input_adapter::Mouse::handle_input_event(Input::Event const &ev)
ev.handle_absolute_motion([&] (int ax, int ay) {
_abs_pos = Point(ax, ay); });
int wheel_x = 0, wheel_y = 0;
ev.handle_wheel([&] (int x, int y) { wheel_x = -x; wheel_y = -y; });
unsigned const mouse_button_bits = curr_mouse_button_bits();
bool const abs_pos_changed = (old_abs_pos != _abs_pos);
bool const buttons_changed = (old_mouse_button_bits != mouse_button_bits);
bool const wheel_changed = (wheel_x || wheel_y);
if (abs_pos_changed || buttons_changed) {
if (abs_pos_changed || buttons_changed || wheel_changed) {
if (_absolute) {
_imouse->PutMouseEventAbsolute(_abs_pos.x(), _abs_pos.y(), 0, 0, mouse_button_bits);
_imouse->PutMouseEventAbsolute(_abs_pos.x(), _abs_pos.y(), wheel_y, wheel_x, mouse_button_bits);
} else {
Point const rel = _abs_pos - old_abs_pos;
_imouse->PutMouseEvent(rel.x(), rel.y(), 0, 0, mouse_button_bits);
_imouse->PutMouseEvent(rel.x(), rel.y(), wheel_y, wheel_x, mouse_button_bits);
}
}
}