| 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 "ash/wm/workspace/multi_window_resize_controller.h" | 5 #include "ash/wm/workspace/multi_window_resize_controller.h" |
| 6 | 6 |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/window_animations.h" | 10 #include "ash/wm/window_animations.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 return false; | 542 return false; |
| 543 } | 543 } |
| 544 } | 544 } |
| 545 | 545 |
| 546 // Check whether |location_in_screen| is in the event target's resize region. | 546 // Check whether |location_in_screen| is in the event target's resize region. |
| 547 // This is tricky because a window's resize region can extend outside a | 547 // This is tricky because a window's resize region can extend outside a |
| 548 // window's bounds. | 548 // window's bounds. |
| 549 gfx::Point location_in_root(location_in_screen); | 549 gfx::Point location_in_root(location_in_screen); |
| 550 aura::Window* root = windows_.window1->GetRootWindow(); | 550 aura::Window* root = windows_.window1->GetRootWindow(); |
| 551 ::wm::ConvertPointFromScreen(root, &location_in_root); | 551 ::wm::ConvertPointFromScreen(root, &location_in_root); |
| 552 ui::MouseEvent test_event(ui::ET_MOUSE_MOVED, location_in_root, | 552 ui::MouseEvent test_event(ui::ET_MOUSE_MOVED, gfx::PointF(location_in_root), |
| 553 location_in_root, ui::EventTimeForNow(), | 553 gfx::PointF(location_in_root), |
| 554 ui::EF_NONE, ui::EF_NONE); | 554 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 555 ui::EventTarget* event_handler = static_cast<ui::EventTarget*>(root) | 555 ui::EventTarget* event_handler = static_cast<ui::EventTarget*>(root) |
| 556 ->GetEventTargeter() | 556 ->GetEventTargeter() |
| 557 ->FindTargetForEvent(root, &test_event); | 557 ->FindTargetForEvent(root, &test_event); |
| 558 if (event_handler == windows_.window1) { | 558 if (event_handler == windows_.window1) { |
| 559 return IsOverComponent( | 559 return IsOverComponent( |
| 560 windows_.window1, | 560 windows_.window1, |
| 561 location_in_screen, | 561 location_in_screen, |
| 562 windows_.direction == TOP_BOTTOM ? HTBOTTOM : HTRIGHT); | 562 windows_.direction == TOP_BOTTOM ? HTBOTTOM : HTRIGHT); |
| 563 } else if (event_handler == windows_.window2) { | 563 } else if (event_handler == windows_.window2) { |
| 564 return IsOverComponent( | 564 return IsOverComponent( |
| 565 windows_.window2, | 565 windows_.window2, |
| 566 location_in_screen, | 566 location_in_screen, |
| 567 windows_.direction == TOP_BOTTOM ? HTTOP : HTLEFT); | 567 windows_.direction == TOP_BOTTOM ? HTTOP : HTLEFT); |
| 568 } | 568 } |
| 569 return false; | 569 return false; |
| 570 } | 570 } |
| 571 | 571 |
| 572 bool MultiWindowResizeController::IsOverComponent( | 572 bool MultiWindowResizeController::IsOverComponent( |
| 573 aura::Window* window, | 573 aura::Window* window, |
| 574 const gfx::Point& location_in_screen, | 574 const gfx::Point& location_in_screen, |
| 575 int component) const { | 575 int component) const { |
| 576 gfx::Point window_loc(location_in_screen); | 576 gfx::Point window_loc(location_in_screen); |
| 577 ::wm::ConvertPointFromScreen(window, &window_loc); | 577 ::wm::ConvertPointFromScreen(window, &window_loc); |
| 578 return window->delegate()->GetNonClientComponent(window_loc) == component; | 578 return window->delegate()->GetNonClientComponent(window_loc) == component; |
| 579 } | 579 } |
| 580 | 580 |
| 581 } // namespace ash | 581 } // namespace ash |
| OLD | NEW |