Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: services/ui/ws/display.cc

Issue 2434923002: Handle modified displays in mustash. (Closed)
Patch Set: Fix PlatformScreenStub for tests. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/display.h ('k') | services/ui/ws/display_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/display.cc
diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc
index 19a73ca58a10ede66ad45cd1fed50f751841a2c5..f11f959aa50f8c5a9b92abd93162f39a2f22c028 100644
--- a/services/ui/ws/display.cc
+++ b/services/ui/ws/display.cc
@@ -99,11 +99,13 @@ mojom::WsDisplayPtr Display::ToWsDisplay() const {
display::Display Display::ToDisplay() const {
display::Display display(GetId());
- display.set_bounds(platform_display_->GetBounds());
- // TODO(sky): window manager needs an API to set the work area.
- display.set_work_area(display.bounds());
- display.set_device_scale_factor(platform_display_->GetDeviceScaleFactor());
- display.set_rotation(platform_display_->GetRotation());
+ const display::ViewportMetrics& metrics =
+ platform_display_->GetViewportMetrics();
+
+ display.set_bounds(metrics.bounds);
+ display.set_work_area(metrics.work_area);
+ display.set_device_scale_factor(metrics.device_scale_factor);
+ display.set_rotation(metrics.rotation);
display.set_touch_support(
display::Display::TouchSupport::TOUCH_SUPPORT_UNKNOWN);
@@ -116,10 +118,6 @@ void Display::SchedulePaint(const ServerWindow* window,
platform_display_->SchedulePaint(window, bounds);
}
-display::Display::Rotation Display::GetRotation() const {
- return platform_display_->GetRotation();
-}
-
gfx::Size Display::GetSize() const {
return platform_display_->GetBounds().size();
}
@@ -309,17 +307,15 @@ void Display::OnNativeCaptureLost() {
display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId);
}
-void Display::OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
- const ViewportMetrics& new_metrics) {
- if (!root_)
+void Display::OnViewportMetricsChanged(
+ const display::ViewportMetrics& new_metrics) {
+ if (!root_ || root_->bounds().size() == new_metrics.bounds.size())
return;
gfx::Rect new_bounds(new_metrics.bounds.size());
root_->SetBounds(new_bounds);
for (auto& pair : window_manager_display_root_map_)
pair.second->root()->SetBounds(new_bounds);
-
- display_manager()->OnDisplayUpdate(this);
}
bool Display::CanHaveActiveChildren(ServerWindow* window) const {
« no previous file with comments | « services/ui/ws/display.h ('k') | services/ui/ws/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698