Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nickdiego/82529dc19b9b7dcd3dbed72dac503930 to your computer and use it in GitHub Desktop.
Save nickdiego/82529dc19b9b7dcd3dbed72dac503930 to your computer and use it in GitHub Desktop.
Debugging per-surface scale init for non-toplevel surfaces
From f0439a6458e60daea0a2ea41979ac07b5008ce7d Mon Sep 17 00:00:00 2001
From: Nick Diego Yamane <[email protected]>
Date: Thu, 4 Jul 2024 19:49:10 -0300
Subject: [PATCH] wayland: debug per-surface scale init for non-toplevel
surfaces
Signed-off-by: Nick Diego Yamane <[email protected]>
---
ui/aura/window_tree_host_platform.cc | 7 +++++++
ui/ozone/platform/wayland/host/wayland_surface.cc | 2 ++
2 files changed, 9 insertions(+)
diff --git a/ui/aura/window_tree_host_platform.cc b/ui/aura/window_tree_host_platform.cc
index e2960a25ef37..ec16a0ac9580 100644
--- a/ui/aura/window_tree_host_platform.cc
+++ b/ui/aura/window_tree_host_platform.cc
@@ -260,6 +260,10 @@ void WindowTreeHostPlatform::OnBoundsChanged(const BoundsChange& change) {
auto weak_ref = GetWeakPtr();
auto new_size = GetBoundsInPixels().size();
bool size_changed = size_in_pixels_ != new_size;
+
+ VLOG(1) << __func__ << "' " << window()->GetName()
+ << "' curr_scale=" << current_scale << " new_scale=" << new_scale;
+
size_in_pixels_ = new_size;
if (change.origin_changed) {
OnHostMovedInPixels();
@@ -366,6 +370,9 @@ int64_t WindowTreeHostPlatform::OnStateUpdate(
}
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+ VLOG(1) << __func__ << "' " << window()->GetName()
+ << "' old=" << old.ToString() << " new=" << latest.ToString();
+
if (old.window_state != latest.window_state) {
OnWindowStateChanged(old.window_state, latest.window_state);
}
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.cc b/ui/ozone/platform/wayland/host/wayland_surface.cc
index c0e89f06711d..82f1a1fb58b6 100644
--- a/ui/ozone/platform/wayland/host/wayland_surface.cc
+++ b/ui/ozone/platform/wayland/host/wayland_surface.cc
@@ -106,6 +106,8 @@ WaylandSurface::WaylandSurface(WaylandConnection* connection,
// non-toplevel windows.
if (auto* parent = root_window_->GetXdgParentWindow()) {
preferred_scale_factor_ = parent->GetPreferredScaleFactor();
+ VLOG(1) << __func__ << " Inheriting parent pref scale="
+ << preferred_scale_factor_.value_or(1.f);
}
}
--
2.45.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment