Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/frame/custom_frame_view_ash.h" | 9 #include "ash/common/frame/custom_frame_view_ash.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1294 if (resizer_) | 1294 if (resizer_) |
| 1295 return; | 1295 return; |
| 1296 | 1296 |
| 1297 aura::Window* window = GetDragWindow(); | 1297 aura::Window* window = GetDragWindow(); |
| 1298 if (!window || window->HasCapture()) | 1298 if (!window || window->HasCapture()) |
| 1299 return; | 1299 return; |
| 1300 | 1300 |
| 1301 if (bounds_mode_ == BoundsMode::SHELL) { | 1301 if (bounds_mode_ == BoundsMode::SHELL) { |
| 1302 // Set the cursor before calling CreateWindowResizer(), as that will | 1302 // Set the cursor before calling CreateWindowResizer(), as that will |
| 1303 // eventually call LockCursor() and prevent the cursor from changing. | 1303 // eventually call LockCursor() and prevent the cursor from changing. |
| 1304 aura::client::CursorClient* cursor_client = | 1304 if (auto* cursor_client = |
|
reveman
2017/03/28 07:25:15
nit: this is a change in behavior (we asserted the
Dominik Laskowski
2017/03/30 01:01:18
Restored. The DCHECK is technically correct, since
| |
| 1305 aura::client::GetCursorClient(window->GetRootWindow()); | 1305 aura::client::GetCursorClient(window->GetRootWindow())) { |
| 1306 DCHECK(cursor_client); | 1306 switch (component) { |
| 1307 | 1307 case HTCAPTION: |
| 1308 switch (component) { | 1308 cursor_client->SetCursor(ui::kCursorPointer); |
| 1309 case HTCAPTION: | 1309 break; |
| 1310 cursor_client->SetCursor(ui::kCursorPointer); | 1310 case HTTOP: |
| 1311 break; | 1311 cursor_client->SetCursor(ui::kCursorNorthResize); |
| 1312 case HTTOP: | 1312 break; |
| 1313 cursor_client->SetCursor(ui::kCursorNorthResize); | 1313 case HTTOPRIGHT: |
| 1314 break; | 1314 cursor_client->SetCursor(ui::kCursorNorthEastResize); |
| 1315 case HTTOPRIGHT: | 1315 break; |
| 1316 cursor_client->SetCursor(ui::kCursorNorthEastResize); | 1316 case HTRIGHT: |
| 1317 break; | 1317 cursor_client->SetCursor(ui::kCursorEastResize); |
| 1318 case HTRIGHT: | 1318 break; |
| 1319 cursor_client->SetCursor(ui::kCursorEastResize); | 1319 case HTBOTTOMRIGHT: |
| 1320 break; | 1320 cursor_client->SetCursor(ui::kCursorSouthEastResize); |
| 1321 case HTBOTTOMRIGHT: | 1321 break; |
| 1322 cursor_client->SetCursor(ui::kCursorSouthEastResize); | 1322 case HTBOTTOM: |
| 1323 break; | 1323 cursor_client->SetCursor(ui::kCursorSouthResize); |
| 1324 case HTBOTTOM: | 1324 break; |
| 1325 cursor_client->SetCursor(ui::kCursorSouthResize); | 1325 case HTBOTTOMLEFT: |
| 1326 break; | 1326 cursor_client->SetCursor(ui::kCursorSouthWestResize); |
| 1327 case HTBOTTOMLEFT: | 1327 break; |
| 1328 cursor_client->SetCursor(ui::kCursorSouthWestResize); | 1328 case HTLEFT: |
| 1329 break; | 1329 cursor_client->SetCursor(ui::kCursorWestResize); |
| 1330 case HTLEFT: | 1330 break; |
| 1331 cursor_client->SetCursor(ui::kCursorWestResize); | 1331 case HTTOPLEFT: |
| 1332 break; | 1332 cursor_client->SetCursor(ui::kCursorNorthWestResize); |
| 1333 case HTTOPLEFT: | 1333 break; |
| 1334 cursor_client->SetCursor(ui::kCursorNorthWestResize); | 1334 default: |
| 1335 break; | 1335 NOTREACHED(); |
| 1336 default: | 1336 break; |
| 1337 NOTREACHED(); | 1337 } |
| 1338 break; | |
| 1339 } | 1338 } |
| 1340 | 1339 |
| 1341 resizer_ = ash::CreateWindowResizer(ash::WmWindow::Get(window), | 1340 resizer_ = ash::CreateWindowResizer(ash::WmWindow::Get(window), |
| 1342 GetMouseLocation(), component, | 1341 GetMouseLocation(), component, |
| 1343 aura::client::WINDOW_MOVE_SOURCE_MOUSE); | 1342 aura::client::WINDOW_MOVE_SOURCE_MOUSE); |
| 1344 if (!resizer_) | 1343 if (!resizer_) |
| 1345 return; | 1344 return; |
| 1346 | 1345 |
| 1347 // Apply pending origin offsets and resize direction before starting a | 1346 // Apply pending origin offsets and resize direction before starting a |
| 1348 // new resize operation. These can still be pending if the client has | 1347 // new resize operation. These can still be pending if the client has |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1698 gfx::Point ShellSurface::GetMouseLocation() const { | 1697 gfx::Point ShellSurface::GetMouseLocation() const { |
| 1699 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1698 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
| 1700 gfx::Point location = | 1699 gfx::Point location = |
| 1701 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1700 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 1702 aura::Window::ConvertPointToTarget( | 1701 aura::Window::ConvertPointToTarget( |
| 1703 root_window, widget_->GetNativeWindow()->parent(), &location); | 1702 root_window, widget_->GetNativeWindow()->parent(), &location); |
| 1704 return location; | 1703 return location; |
| 1705 } | 1704 } |
| 1706 | 1705 |
| 1707 } // namespace exo | 1706 } // namespace exo |
| OLD | NEW |