| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/host/ash_window_tree_host.h" | 5 #include "ash/host/ash_window_tree_host.h" |
| 6 | 6 |
| 7 #include "ash/host/ash_window_tree_host_init_params.h" | 7 #include "ash/host/ash_window_tree_host_init_params.h" |
| 8 #include "ash/host/ash_window_tree_host_unified.h" | 8 #include "ash/host/ash_window_tree_host_unified.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 AshWindowTreeHost::AshWindowTreeHost() : input_method_handler_(nullptr) {} | 32 AshWindowTreeHost::AshWindowTreeHost() : input_method_handler_(nullptr) {} |
| 33 | 33 |
| 34 void AshWindowTreeHost::TranslateLocatedEvent(ui::LocatedEvent* event) { | 34 void AshWindowTreeHost::TranslateLocatedEvent(ui::LocatedEvent* event) { |
| 35 if (event->IsTouchEvent()) | 35 if (event->IsTouchEvent()) |
| 36 return; | 36 return; |
| 37 | 37 |
| 38 aura::WindowTreeHost* wth = AsWindowTreeHost(); | 38 aura::WindowTreeHost* wth = AsWindowTreeHost(); |
| 39 aura::Window* root_window = wth->window(); | 39 aura::Window* root_window = wth->window(); |
| 40 aura::client::ScreenPositionClient* screen_position_client = | 40 aura::client::ScreenPositionClient* screen_position_client = |
| 41 aura::client::GetScreenPositionClient(root_window); | 41 aura::client::GetScreenPositionClient(root_window); |
| 42 gfx::Rect local(wth->GetBounds().size()); | 42 gfx::Rect local(wth->GetBoundsInPixels().size()); |
| 43 local.Inset(GetHostInsets()); | 43 local.Inset(GetHostInsets()); |
| 44 | 44 |
| 45 if (screen_position_client && !local.Contains(event->location())) { | 45 if (screen_position_client && !local.Contains(event->location())) { |
| 46 gfx::Point location(event->location()); | 46 gfx::Point location(event->location()); |
| 47 // In order to get the correct point in screen coordinates | 47 // In order to get the correct point in screen coordinates |
| 48 // during passive grab, we first need to find on which host window | 48 // during passive grab, we first need to find on which host window |
| 49 // the mouse is on, and find out the screen coordinates on that | 49 // the mouse is on, and find out the screen coordinates on that |
| 50 // host window, then convert it back to this host window's coordinate. | 50 // host window, then convert it back to this host window's coordinate. |
| 51 screen_position_client->ConvertHostPointToScreen(root_window, &location); | 51 screen_position_client->ConvertHostPointToScreen(root_window, &location); |
| 52 screen_position_client->ConvertPointFromScreen(root_window, &location); | 52 screen_position_client->ConvertPointFromScreen(root_window, &location); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 #error Unsupported platform. | 74 #error Unsupported platform. |
| 75 #endif | 75 #endif |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 void AshWindowTreeHost::SetFactory(const Factory& factory) { | 79 void AshWindowTreeHost::SetFactory(const Factory& factory) { |
| 80 creation_factory.Get() = factory; | 80 creation_factory.Get() = factory; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace ash | 83 } // namespace ash |
| OLD | NEW |