Chromium Code Reviews| Index: services/ui/ws/platform_display_default.cc |
| diff --git a/services/ui/ws/platform_display_default.cc b/services/ui/ws/platform_display_default.cc |
| index ba50d304de71e5c49d5ddb1ad6b59cdc2821b125..41dbf48055ed235aaa9cef30b76bf6362a606835 100644 |
| --- a/services/ui/ws/platform_display_default.cc |
| +++ b/services/ui/ws/platform_display_default.cc |
| @@ -169,6 +169,11 @@ void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) { |
| } |
| void PlatformDisplayDefault::OnBoundsChanged(const gfx::Rect& new_bounds) { |
| + // Since we aren't resizing the Chrome OS display size, if the user resizes |
| + // the window or the WM doesn't honor the requested size then cursor |
| + // locations end up incorrect. |
| + window_height_offset_ = new_bounds.height() - metrics_.pixel_size.height(); |
| + |
| // We only care if the window size has changed. |
| if (new_bounds.size() == metrics_.pixel_size) |
| return; |
| @@ -181,8 +186,13 @@ void PlatformDisplayDefault::OnBoundsChanged(const gfx::Rect& new_bounds) { |
| void PlatformDisplayDefault::OnDamageRect(const gfx::Rect& damaged_region) {} |
| void PlatformDisplayDefault::DispatchEvent(ui::Event* event) { |
| - if (event->IsLocatedEvent()) |
| - UpdateEventRootLocation(event->AsLocatedEvent()); |
| + if (event->IsLocatedEvent()) { |
| + ui::LocatedEvent* located_event = event->AsLocatedEvent(); |
| + gfx::PointF location = located_event->location_f(); |
| + location.Offset(0, -window_height_offset_); |
| + located_event->set_location_f(location); |
| + UpdateEventRootLocation(located_event); |
|
tonikitoo
2017/01/13 17:07:14
driven-by comment: maybe moving moving this offset
|
| + } |
| if (event->IsScrollEvent()) { |
| // TODO(moshayedi): crbug.com/602859. Dispatch scroll events as |