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/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 event->ConvertLocationToTarget(static_cast<Window*>(this), target); | 346 event->ConvertLocationToTarget(static_cast<Window*>(this), target); |
347 ProcessEvent(target, event); | 347 ProcessEvent(target, event); |
348 return event->handled(); | 348 return event->handled(); |
349 } | 349 } |
350 | 350 |
351 return false; | 351 return false; |
352 } | 352 } |
353 | 353 |
354 void RootWindow::OnWindowDestroying(Window* window) { | 354 void RootWindow::OnWindowDestroying(Window* window) { |
355 DispatchMouseExitToHidingWindow(window); | 355 DispatchMouseExitToHidingWindow(window); |
356 OnWindowHidden(window, WINDOW_DESTROYED, NULL); | 356 OnWindowHidden(window, WINDOW_DESTROYED); |
357 | 357 |
358 if (window->IsVisible() && | 358 if (window->IsVisible() && |
359 window->ContainsPointInRoot(GetLastMouseLocationInRoot())) { | 359 window->ContainsPointInRoot(GetLastMouseLocationInRoot())) { |
360 PostMouseMoveEventAfterWindowChange(); | 360 PostMouseMoveEventAfterWindowChange(); |
361 } | 361 } |
362 } | 362 } |
363 | 363 |
364 void RootWindow::OnWindowBoundsChanged(Window* window, | 364 void RootWindow::OnWindowBoundsChanged(Window* window, |
365 bool contained_mouse_point) { | 365 bool contained_mouse_point) { |
366 if (contained_mouse_point || | 366 if (contained_mouse_point || |
(...skipping 15 matching lines...) Expand all Loading... |
382 ui::MouseEvent event(ui::ET_MOUSE_EXITED, | 382 ui::MouseEvent event(ui::ET_MOUSE_EXITED, |
383 last_mouse_location, | 383 last_mouse_location, |
384 last_mouse_location, | 384 last_mouse_location, |
385 ui::EF_NONE); | 385 ui::EF_NONE); |
386 DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED); | 386 DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 void RootWindow::OnWindowVisibilityChanged(Window* window, bool is_visible) { | 390 void RootWindow::OnWindowVisibilityChanged(Window* window, bool is_visible) { |
391 if (!is_visible) | 391 if (!is_visible) |
392 OnWindowHidden(window, WINDOW_HIDDEN, NULL); | 392 OnWindowHidden(window, WINDOW_HIDDEN); |
393 | 393 |
394 if (window->ContainsPointInRoot(GetLastMouseLocationInRoot())) | 394 if (window->ContainsPointInRoot(GetLastMouseLocationInRoot())) |
395 PostMouseMoveEventAfterWindowChange(); | 395 PostMouseMoveEventAfterWindowChange(); |
396 } | 396 } |
397 | 397 |
398 void RootWindow::OnWindowTransformed(Window* window, bool contained_mouse) { | 398 void RootWindow::OnWindowTransformed(Window* window, bool contained_mouse) { |
399 if (contained_mouse || | 399 if (contained_mouse || |
400 (window->IsVisible() && | 400 (window->IsVisible() && |
401 window->ContainsPointInRoot(GetLastMouseLocationInRoot()))) { | 401 window->ContainsPointInRoot(GetLastMouseLocationInRoot()))) { |
402 PostMouseMoveEventAfterWindowChange(); | 402 PostMouseMoveEventAfterWindowChange(); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 } | 781 } |
782 event_dispatch_target_ = old_target; | 782 event_dispatch_target_ = old_target; |
783 return handled; | 783 return handled; |
784 } | 784 } |
785 | 785 |
786 void RootWindow::OnWindowRemovedFromRootWindow(Window* detached, | 786 void RootWindow::OnWindowRemovedFromRootWindow(Window* detached, |
787 RootWindow* new_root) { | 787 RootWindow* new_root) { |
788 DCHECK(aura::client::GetCaptureWindow(this) != this); | 788 DCHECK(aura::client::GetCaptureWindow(this) != this); |
789 | 789 |
790 DispatchMouseExitToHidingWindow(detached); | 790 DispatchMouseExitToHidingWindow(detached); |
791 OnWindowHidden(detached, new_root ? WINDOW_MOVING : WINDOW_HIDDEN, new_root); | 791 OnWindowHidden(detached, new_root ? WINDOW_MOVING : WINDOW_HIDDEN); |
792 | 792 |
793 if (detached->IsVisible() && | 793 if (detached->IsVisible() && |
794 detached->ContainsPointInRoot(GetLastMouseLocationInRoot())) { | 794 detached->ContainsPointInRoot(GetLastMouseLocationInRoot())) { |
795 PostMouseMoveEventAfterWindowChange(); | 795 PostMouseMoveEventAfterWindowChange(); |
796 } | 796 } |
797 } | 797 } |
798 | 798 |
799 void RootWindow::OnWindowHidden(Window* invisible, | 799 void RootWindow::OnWindowHidden(Window* invisible, WindowHiddenReason reason) { |
800 WindowHiddenReason reason, | |
801 RootWindow* new_root) { | |
802 // TODO(beng): This should be removed once FocusController is turned on. | 800 // TODO(beng): This should be removed once FocusController is turned on. |
803 if (client::GetFocusClient(this)) { | 801 if (client::GetFocusClient(this)) { |
804 client::GetFocusClient(this)->OnWindowHiddenInRootWindow( | 802 client::GetFocusClient(this)->OnWindowHiddenInRootWindow( |
805 invisible, this, reason == WINDOW_DESTROYED); | 803 invisible, this, reason == WINDOW_DESTROYED); |
806 } | 804 } |
807 | 805 |
808 // Do not clear the capture, and the |event_dispatch_target_| if the | 806 // Do not clear the capture, and the |event_dispatch_target_| if the |
809 // window is moving across root windows, because the target itself | 807 // window is moving across root windows, because the target itself |
810 // is actually still visible and clearing them stops further event | 808 // is actually still visible and clearing them stops further event |
811 // processing, which can cause unexpected behaviors. See | 809 // processing, which can cause unexpected behaviors. See |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 } | 1203 } |
1206 | 1204 |
1207 gfx::Transform RootWindow::GetInverseRootTransform() const { | 1205 gfx::Transform RootWindow::GetInverseRootTransform() const { |
1208 float scale = ui::GetDeviceScaleFactor(layer()); | 1206 float scale = ui::GetDeviceScaleFactor(layer()); |
1209 gfx::Transform transform; | 1207 gfx::Transform transform; |
1210 transform.Scale(1.0f / scale, 1.0f / scale); | 1208 transform.Scale(1.0f / scale, 1.0f / scale); |
1211 return transformer_->GetInverseTransform() * transform; | 1209 return transformer_->GetInverseTransform() * transform; |
1212 } | 1210 } |
1213 | 1211 |
1214 } // namespace aura | 1212 } // namespace aura |
OLD | NEW |