| 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/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 // views::View overrides: | 73 // views::View overrides: |
| 74 virtual gfx::Size GetPreferredSize() OVERRIDE { | 74 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| 75 return gfx::Size(image_->width(), image_->height()); | 75 return gfx::Size(image_->width(), image_->height()); |
| 76 } | 76 } |
| 77 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 77 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
| 78 canvas->DrawImageInt(*image_, 0, 0); | 78 canvas->DrawImageInt(*image_, 0, 0); |
| 79 } | 79 } |
| 80 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { | 80 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { |
| 81 gfx::Point location(event.location()); | 81 gfx::Point location(gfx::ToFlooredPoint(event.location())); |
| 82 views::View::ConvertPointToScreen(this, &location); | 82 views::View::ConvertPointToScreen(this, &location); |
| 83 controller_->StartResize(location); | 83 controller_->StartResize(location); |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE { | 86 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE { |
| 87 gfx::Point location(event.location()); | 87 gfx::Point location(gfx::ToFlooredPoint(event.location())); |
| 88 views::View::ConvertPointToScreen(this, &location); | 88 views::View::ConvertPointToScreen(this, &location); |
| 89 controller_->Resize(location, event.flags()); | 89 controller_->Resize(location, event.flags()); |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE { | 92 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE { |
| 93 controller_->CompleteResize(); | 93 controller_->CompleteResize(); |
| 94 } | 94 } |
| 95 virtual void OnMouseCaptureLost() OVERRIDE { | 95 virtual void OnMouseCaptureLost() OVERRIDE { |
| 96 controller_->CancelResize(); | 96 controller_->CancelResize(); |
| 97 } | 97 } |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 return false; | 534 return false; |
| 535 | 535 |
| 536 gfx::Point window_loc(location_in_screen); | 536 gfx::Point window_loc(location_in_screen); |
| 537 aura::Window::ConvertPointToTarget( | 537 aura::Window::ConvertPointToTarget( |
| 538 window->GetRootWindow(), window, &window_loc); | 538 window->GetRootWindow(), window, &window_loc); |
| 539 return window->ContainsPoint(window_loc) && | 539 return window->ContainsPoint(window_loc) && |
| 540 window->delegate()->GetNonClientComponent(window_loc) == component; | 540 window->delegate()->GetNonClientComponent(window_loc) == component; |
| 541 } | 541 } |
| 542 | 542 |
| 543 } // namespace ash | 543 } // namespace ash |
| OLD | NEW |