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

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

Issue 2963033002: Linux UI: Dynamically respond to changes in the scale factor (Closed)
Patch Set: Call OnHostResizedInPixels() when scale factor changes Created 3 years, 6 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 1414ba2b760f7f74b9b46760140480fd749f78c3..33c7a1c1b4b71dc1261fee545f580ec9021f7a1a 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
@@ -165,13 +165,16 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
has_pointer_focus_(false),
modal_dialog_counter_(0),
close_widget_factory_(this),
- weak_factory_(this) {}
+ weak_factory_(this) {
+ display::Screen::GetScreen()->AddObserver(this);
+}
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
window()->ClearProperty(kHostForRootWindow);
wm::SetWindowMoveClient(window(), NULL);
desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
DestroyDispatcher();
+ display::Screen::GetScreen()->RemoveObserver(this);
}
// static
@@ -1289,6 +1292,26 @@ void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) {
// the same tap-to-click disabling here that chromeos does.
}
+////////////////////////////////////////////////////////////////////////////////
+// DesktopWindowTreeHostX11, display::DisplayObserver implementation:
+
+void DesktopWindowTreeHostX11::OnDisplayAdded(
+ const display::Display& new_display) {}
+
+void DesktopWindowTreeHostX11::OnDisplayRemoved(
+ const display::Display& old_display) {}
+
+void DesktopWindowTreeHostX11::OnDisplayMetricsChanged(
+ const display::Display& display,
+ uint32_t changed_metrics) {
+ if ((changed_metrics & DISPLAY_METRIC_DEVICE_SCALE_FACTOR) &&
+ display::Screen::GetScreen()->GetDisplayNearestWindow(window()).id() ==
+ display.id()) {
+ OnHostResizedInPixels(bounds_in_pixels_.size());
+ ResetWindowRegion();
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// DesktopWindowTreeHostX11, private:

Powered by Google App Engine
This is Rietveld 408576698