New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 701036 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

mus: Fix WS LocatedEvent targeting

Project Member Reported by kylec...@chromium.org, Mar 13 2017

Issue description

There are a few different problems with WS event targeting.

In PlatformDisplayDefault::UpdateEventRootLocation() we change |root_location| in LocatedEvents to be offset by the screen origin, so basically in screen coordinates. |root_location| is later used to disambiguate what display the point is on. This mixes pixel and DIP coordinates which would produce incorrect results when using two monitors and at least one of them is HDPI.

https://cs.chromium.org/chromium/src/services/ui/ws/platform_display_default.cc?dr=C&q=PlatformDisplayDefault::UpdateEventRootLocation&l=165

In WindowManagerState::GetRootWindowContaining() the |root_location| gets used. There is again a mix of pixel and DIP assumptions here. This gets called from a couple of different places, including using a stored cursor location, so either this needs to work properly with screen coordinates or we need to always store the display id + display coordinates.

https://cs.chromium.org/chromium/src/services/ui/ws/window_manager_state.cc?q=WindowManagerState::GetRootWindowContaining&dr=CSs&l=628
 
Status: Started (was: Assigned)
Project Member

Comment 2 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0

commit 0fb00abce4d3e56ef50a1e6fc1eee947d97036f0
Author: riajiang <riajiang@chromium.org>
Date: Fri May 26 21:20:38 2017

Keep root_location to be in pixels and display coordinates in WS.

We convert event root_location to be in screen coordinates which
mixed pixels and dip in PlatformDisplayDefault::UpdateEventRootLocation().
Then in WindowManagerState::GetRootWindowContaining(), we expect
root_location to be in screen coordinates to find the display that
event is on and mixed pixels and dip again. As root_location should
always be in pixels in window server, changing it to skip the
conversion in PlatformDisplayDefault::UpdateEventRootLocation() so
root_location remains in pixels and display coordinates after that;
and in WindowManagerState::GetRootWindowContaining(), using display
id and display coordinates to get the root_location in screen
coordinates and find the display (not actually updating root_location
to screen coordinates). mouse_pointer_last_location is also in pixels
and display coordinates now as a result as it is the same as event
root_location.

TODO: make sure this works with drag-and-drop once mouse warp is
functional with mushroom.

BUG= 701036 
TEST= mus_ws_unittests
      manual with two displays, one of which is hi-dpi
      ./out/oxygen/chrome --user-data-dir=/tmp/chrome --mus
      --screen-config=1600x900,1600x900^300/i

Review-Url: https://codereview.chromium.org/2778943005
Cr-Commit-Position: refs/heads/master@{#475133}

[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/cursor_location_manager.cc
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/cursor_location_manager.h
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/display_manager.cc
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/event_dispatcher.cc
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/event_dispatcher.h
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/event_dispatcher_delegate.h
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/event_dispatcher_unittest.cc
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/platform_display_default.cc
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/platform_display_default.h
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/test_utils.h
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/window_manager_state.cc
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/window_manager_state.h
[modify] https://crrev.com/0fb00abce4d3e56ef50a1e6fc1eee947d97036f0/services/ui/ws/window_manager_state_unittest.cc

Comment 3 by varkha@chromium.org, Aug 15 2017

Cc: gklassen@chromium.org
Is there more work here as part of working on hit-testing component bug 752380?

Comment 4 by varkha@chromium.org, Aug 15 2017

Labels: event-targeting
Summary: mus: Fix WS LocatedEvent targeting (was: mus: Fix WS LocatedEvent targetting)

Comment 5 by varkha@chromium.org, Aug 15 2017

Components: Internals>MUS
Labels: -event-targeting
Status: Fixed (was: Started)
This is fixed. Kept this open to check if this works with drag-and-drop once mouse warping is wired up for mushroom but I guess we'll just file separate bugs for that. And this is not specific for the new event-targeting.

Comment 7 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)
Components: -Internals>MUS Internals>Services>WindowService

Sign in to add a comment