OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/root_window.h" | 5 #include "ui/aura/root_window.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "ui/aura/client/activation_client.h" | |
15 #include "ui/aura/client/capture_client.h" | 14 #include "ui/aura/client/capture_client.h" |
16 #include "ui/aura/client/cursor_client.h" | 15 #include "ui/aura/client/cursor_client.h" |
17 #include "ui/aura/client/event_client.h" | 16 #include "ui/aura/client/event_client.h" |
18 #include "ui/aura/client/focus_client.h" | 17 #include "ui/aura/client/focus_client.h" |
19 #include "ui/aura/client/screen_position_client.h" | 18 #include "ui/aura/client/screen_position_client.h" |
20 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
21 #include "ui/aura/root_window_host.h" | 20 #include "ui/aura/root_window_host.h" |
22 #include "ui/aura/root_window_observer.h" | 21 #include "ui/aura/root_window_observer.h" |
23 #include "ui/aura/root_window_transformer.h" | 22 #include "ui/aura/root_window_transformer.h" |
24 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 DispatchMouseExitToHidingWindow(detached); | 698 DispatchMouseExitToHidingWindow(detached); |
700 OnWindowHidden(detached, new_root ? WINDOW_MOVING : WINDOW_HIDDEN); | 699 OnWindowHidden(detached, new_root ? WINDOW_MOVING : WINDOW_HIDDEN); |
701 | 700 |
702 if (detached->IsVisible() && | 701 if (detached->IsVisible() && |
703 detached->ContainsPointInRoot(GetLastMouseLocationInRoot())) { | 702 detached->ContainsPointInRoot(GetLastMouseLocationInRoot())) { |
704 PostMouseMoveEventAfterWindowChange(); | 703 PostMouseMoveEventAfterWindowChange(); |
705 } | 704 } |
706 } | 705 } |
707 | 706 |
708 void RootWindow::OnWindowHidden(Window* invisible, WindowHiddenReason reason) { | 707 void RootWindow::OnWindowHidden(Window* invisible, WindowHiddenReason reason) { |
709 // TODO(beng): This should be removed once FocusController is turned on. | |
710 if (client::GetFocusClient(this)) { | |
711 client::GetFocusClient(this)->OnWindowHiddenInRootWindow( | |
712 invisible, this, reason == WINDOW_DESTROYED); | |
713 } | |
714 | |
715 // Do not clear the capture, and the |event_dispatch_target_| if the | 708 // Do not clear the capture, and the |event_dispatch_target_| if the |
716 // window is moving across root windows, because the target itself | 709 // window is moving across root windows, because the target itself |
717 // is actually still visible and clearing them stops further event | 710 // is actually still visible and clearing them stops further event |
718 // processing, which can cause unexpected behaviors. See | 711 // processing, which can cause unexpected behaviors. See |
719 // crbug.com/157583 | 712 // crbug.com/157583 |
720 if (reason != WINDOW_MOVING) { | 713 if (reason != WINDOW_MOVING) { |
721 Window* capture_window = aura::client::GetCaptureWindow(this); | 714 Window* capture_window = aura::client::GetCaptureWindow(this); |
722 // If the ancestor of the capture window is hidden, | 715 // If the ancestor of the capture window is hidden, |
723 // release the capture. | 716 // release the capture. |
724 if (invisible->Contains(capture_window) && invisible != this) | 717 if (invisible->Contains(capture_window) && invisible != this) |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 } | 1171 } |
1179 | 1172 |
1180 gfx::Transform RootWindow::GetInverseRootTransform() const { | 1173 gfx::Transform RootWindow::GetInverseRootTransform() const { |
1181 float scale = ui::GetDeviceScaleFactor(layer()); | 1174 float scale = ui::GetDeviceScaleFactor(layer()); |
1182 gfx::Transform transform; | 1175 gfx::Transform transform; |
1183 transform.Scale(1.0f / scale, 1.0f / scale); | 1176 transform.Scale(1.0f / scale, 1.0f / scale); |
1184 return transformer_->GetInverseTransform() * transform; | 1177 return transformer_->GetInverseTransform() * transform; |
1185 } | 1178 } |
1186 | 1179 |
1187 } // namespace aura | 1180 } // namespace aura |
OLD | NEW |