mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibWeb: Refactor WebContentServer mouse input message to DevicePixel
This commit is contained in:
parent
1f171cb60b
commit
b73ae80d8b
11 changed files with 90 additions and 93 deletions
|
@ -337,25 +337,26 @@ void OutOfProcessWebView::process_next_input_event()
|
|||
}
|
||||
},
|
||||
[this](GUI::MouseEvent const& event) {
|
||||
auto screen_position = event.position() + (window()->position() + relative_position());
|
||||
auto position = to_content_position(event.position()).to_type<Web::DevicePixels>();
|
||||
auto screen_position = (event.position() + (window()->position() + relative_position())).to_type<Web::DevicePixels>();
|
||||
switch (event.type()) {
|
||||
case GUI::Event::Type::MouseDown:
|
||||
client().async_mouse_down(to_content_position(event.position()), screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
client().async_mouse_down(position, screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
break;
|
||||
case GUI::Event::Type::MouseUp:
|
||||
client().async_mouse_up(to_content_position(event.position()), screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
client().async_mouse_up(position, screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
break;
|
||||
case GUI::Event::Type::MouseMove:
|
||||
client().async_mouse_move(to_content_position(event.position()), screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
client().async_mouse_move(position, screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
break;
|
||||
case GUI::Event::Type::MouseWheel: {
|
||||
// FIXME: This wheel delta step size multiplier is used to remain the old scroll behaviour, in future use system step size.
|
||||
constexpr int scroll_step_size = 24;
|
||||
client().async_mouse_wheel(to_content_position(event.position()), screen_position, event.button(), event.buttons(), event.modifiers(), event.wheel_delta_x() * scroll_step_size, event.wheel_delta_y() * scroll_step_size);
|
||||
client().async_mouse_wheel(position, screen_position, event.button(), event.buttons(), event.modifiers(), event.wheel_delta_x() * scroll_step_size, event.wheel_delta_y() * scroll_step_size);
|
||||
break;
|
||||
}
|
||||
case GUI::Event::Type::MouseDoubleClick:
|
||||
client().async_doubleclick(to_content_position(event.position()), screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
client().async_doubleclick(position, screen_position, event.button(), event.buttons(), event.modifiers());
|
||||
break;
|
||||
default:
|
||||
dbgln("Unrecognized mouse event type in OOPWV input event queue: {}", event.type());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue