Commit 8536e2e3 authored by Antonio Gomes's avatar Antonio Gomes Committed by Chromium LUCI CQ

[ozone/wayland] Convert WaylandCursorPosition to operate in DIP

... instead of pixels.

It happens today that WaylandCursorPosition stores the last mouse
position in pixels, instead of DIP.

In lacros, this position is queried by the call to
`display::Screen::GetScreen()->GetCursorScreenPoint()` in
`ImmersiveFullscreenController::UpdateLocatedEventRevealedLock()`,
for instance by hovering the mouse cursor over the upper display
boundary in immersive fullscreen mode, so that the tabstrip slides
down.
When a high DPI display is used, the mismatch occurs.

This CL changes WaylandCursorPosition to store the last mouse cursor
position in DIP, instead of pixels.

BUG=1153998, 1113900
R=msisov@igalia.com

Change-Id: Id37ee61de4d22b8ffd190b403df91fd87e198007
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2569775Reviewed-by: default avatarMaksim Sisov (GMT+2) <msisov@igalia.com>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#833294}
parent 489943cb
...@@ -305,6 +305,7 @@ uint32_t WaylandWindow::DispatchEvent(const PlatformEvent& native_event) { ...@@ -305,6 +305,7 @@ uint32_t WaylandWindow::DispatchEvent(const PlatformEvent& native_event) {
// Wayland sends locations in DIP so they need to be translated to // Wayland sends locations in DIP so they need to be translated to
// physical pixels. // physical pixels.
UpdateCursorPositionFromEvent(Event::Clone(*event));
event->AsLocatedEvent()->set_location_f(gfx::ScalePoint( event->AsLocatedEvent()->set_location_f(gfx::ScalePoint(
event->AsLocatedEvent()->location_f(), buffer_scale(), buffer_scale())); event->AsLocatedEvent()->location_f(), buffer_scale(), buffer_scale()));
...@@ -500,10 +501,6 @@ bool WaylandWindow::IsActive() const { ...@@ -500,10 +501,6 @@ bool WaylandWindow::IsActive() const {
uint32_t WaylandWindow::DispatchEventToDelegate( uint32_t WaylandWindow::DispatchEventToDelegate(
const PlatformEvent& native_event) { const PlatformEvent& native_event) {
auto* event = static_cast<Event*>(native_event);
if (event->IsLocatedEvent())
UpdateCursorPositionFromEvent(Event::Clone(*event));
bool handled = DispatchEventFromNativeUiEvent( bool handled = DispatchEventFromNativeUiEvent(
native_event, base::BindOnce(&PlatformWindowDelegate::DispatchEvent, native_event, base::BindOnce(&PlatformWindowDelegate::DispatchEvent,
base::Unretained(delegate_))); base::Unretained(delegate_)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment