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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 2207043002: SetDeviceScaleFactorForTest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetDeviceScaleFactorForTest Created 4 years, 4 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
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index aeadc78f2fe40a9863c39daa451852a86f78cf9f..d971acf8d5565c9bfcd07ba8ad2efe930f597a18 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -183,9 +183,11 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
urgency_hint_set_(false),
activatable_(true),
close_widget_factory_(this) {
+ display::Screen::GetScreen()->AddObserver(this);
}
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
+ display::Screen::GetScreen()->RemoveObserver(this);
window()->ClearProperty(kHostForRootWindow);
aura::client::SetWindowMoveClient(window(), NULL);
desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
@@ -2036,6 +2038,17 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
return ui::POST_DISPATCH_STOP_PROPAGATION;
}
+void DesktopWindowTreeHostX11::OnDisplayMetricsChanged(
+ const display::Display& display,
+ uint32_t changed_metrics) {
+ display::Screen* screen = display::Screen::GetScreen();
+ if ((changed_metrics & DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR) &&
+ screen->GetDisplayNearestWindow(window()).id() == display.id()) {
+ OnHostResized(bounds_in_pixels_.size());
+ ResetWindowRegion();
+ }
+}
+
void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) {
OnHostResized(size_in_pixels);
ResetWindowRegion();

Powered by Google App Engine
This is Rietveld 408576698