Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: ash/host/ash_window_tree_host.cc

Issue 657603002: ash: ozone: apply transformation to events outside the root window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change visibility of TranslateLocatedEvent() Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/host/ash_window_tree_host.h ('k') | ash/host/ash_window_tree_host_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/host/ash_window_tree_host.h"
6
7 #include "ui/aura/client/screen_position_client.h"
8 #include "ui/aura/window_tree_host.h"
9 #include "ui/events/event.h"
10 #include "ui/gfx/rect.h"
11
12 namespace ash {
13
14 void AshWindowTreeHost::TranslateLocatedEvent(ui::LocatedEvent* event) {
15 if (!event->IsTouchEvent()) {
Daniel Erat 2014/12/03 14:44:17 nit: how about changing this to: if (event->IsT
llandwerlin-old 2014/12/03 15:57:11 Done.
16 aura::WindowTreeHost* wth = AsWindowTreeHost();
17 aura::Window* root_window = wth->window();
18 aura::client::ScreenPositionClient* screen_position_client =
19 aura::client::GetScreenPositionClient(root_window);
20 gfx::Rect local(wth->GetBounds().size());
21 local.Inset(GetHostInsets());
22
23 if (screen_position_client && !local.Contains(event->location())) {
24 gfx::Point location(event->location());
25 // In order to get the correct point in screen coordinates
26 // during passive grab, we first need to find on which host window
27 // the mouse is on, and find out the screen coordinates on that
28 // host window, then convert it back to this host window's coordinate.
29 screen_position_client->ConvertHostPointToScreen(root_window, &location);
30 screen_position_client->ConvertPointFromScreen(root_window, &location);
31 wth->ConvertPointToHost(&location);
32 event->set_location(location);
33 event->set_root_location(location);
34 }
35 }
36 }
37
38 } // namespace ash
OLDNEW
« no previous file with comments | « ash/host/ash_window_tree_host.h ('k') | ash/host/ash_window_tree_host_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698