Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1401 Id window_id, | 1401 Id window_id, |
| 1402 const gfx::Rect& transit_bounds_in_pixels) { | 1402 const gfx::Rect& transit_bounds_in_pixels) { |
| 1403 WindowMus* window = GetWindowByServerId(window_id); | 1403 WindowMus* window = GetWindowByServerId(window_id); |
| 1404 bool result = false; | 1404 bool result = false; |
| 1405 if (window) { | 1405 if (window) { |
| 1406 float device_scale_factor = ScaleFactorForDisplay(window->GetWindow()); | 1406 float device_scale_factor = ScaleFactorForDisplay(window->GetWindow()); |
| 1407 DCHECK(window_manager_delegate_); | 1407 DCHECK(window_manager_delegate_); |
| 1408 gfx::Rect transit_bounds_in_dip = | 1408 gfx::Rect transit_bounds_in_dip = |
| 1409 gfx::ConvertRectToDIP(device_scale_factor, transit_bounds_in_pixels); | 1409 gfx::ConvertRectToDIP(device_scale_factor, transit_bounds_in_pixels); |
| 1410 gfx::Rect bounds_in_dip = transit_bounds_in_dip; | 1410 gfx::Rect bounds_in_dip = transit_bounds_in_dip; |
| 1411 // TODO: this needs to trigger scheduling a bounds change on |window|. | 1411 window_manager_delegate_->OnWmSetBounds(window->GetWindow(), |
| 1412 result = window_manager_delegate_->OnWmSetBounds(window->GetWindow(), | 1412 &bounds_in_dip); |
| 1413 &bounds_in_dip); | |
| 1414 if (result) { | |
| 1415 // If the resulting bounds differ return false. Returning false ensures | |
| 1416 // the client applies the bounds we set below. | |
| 1417 result = bounds_in_dip == transit_bounds_in_dip; | |
| 1418 window->SetBoundsFromServer(bounds_in_dip); | |
| 1419 } | |
| 1420 } else { | 1413 } else { |
| 1421 DVLOG(1) << "Unknown window passed to WmSetBounds()."; | 1414 DVLOG(1) << "Unknown window passed to WmSetBounds()."; |
| 1422 } | 1415 } |
| 1423 if (window_manager_internal_client_) | 1416 if (window_manager_internal_client_) |
| 1424 window_manager_internal_client_->WmResponse(change_id, result); | 1417 window_manager_internal_client_->WmResponse(change_id, result); |
|
sadrul
2017/03/27 17:06:16
Maybe the WM does not need to ack the bounds chang
Fady Samuel
2017/03/27 17:11:42
Right now the window server, and client generate i
sky
2017/03/27 17:14:56
Things will get out of order if you do that. I agr
Fady Samuel
2017/03/27 18:15:36
Done.
| |
| 1425 } | 1418 } |
| 1426 | 1419 |
| 1427 void WindowTreeClient::WmSetProperty( | 1420 void WindowTreeClient::WmSetProperty( |
| 1428 uint32_t change_id, | 1421 uint32_t change_id, |
| 1429 Id window_id, | 1422 Id window_id, |
| 1430 const std::string& name, | 1423 const std::string& name, |
| 1431 const base::Optional<std::vector<uint8_t>>& transit_data) { | 1424 const base::Optional<std::vector<uint8_t>>& transit_data) { |
| 1432 WindowMus* window = GetWindowByServerId(window_id); | 1425 WindowMus* window = GetWindowByServerId(window_id); |
| 1433 bool result = false; | 1426 bool result = false; |
| 1434 if (window) { | 1427 if (window) { |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1915 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1908 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1916 this, capture_synchronizer_.get(), window)); | 1909 this, capture_synchronizer_.get(), window)); |
| 1917 } | 1910 } |
| 1918 | 1911 |
| 1919 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1912 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1920 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1913 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1921 this, focus_synchronizer_.get(), window)); | 1914 this, focus_synchronizer_.get(), window)); |
| 1922 } | 1915 } |
| 1923 | 1916 |
| 1924 } // namespace aura | 1917 } // namespace aura |
| OLD | NEW |