wayland ui scaling: keep font scale as a separate field in DisplayConfig This is part of the set of changes required to support Desktop Environment's "Large Text" accessibility setting in Chromium's Wayland backend. It actually can also be triggered by other system tools, such as, Gnome Tweaks app as well as gsettings command line tool in Gnome ecosystem. Design doc: https://docs.google.com/document/d/16kwPm_S0dmxe4kSgKY0_PA7aFvkFcftx6AMzNqT8Nfg This CL starts by adapting LinuxUi's DisplayConfig data struct to store and expose the font scale value separately, because, unlike ozone/x11 the wayland backend needs to keep it separate from the surface's scale values. Refer to the DD for further details and rationale. For now, only GtkUi with GTK4 is supported. Additional support for GTK3 seems technically possible though will be done in a separate CL, if possible. R=sky, thomasanderson Bug: 40856031, 41486578 Change-Id: I9704c269ccffac103ab9f79d02e87368b9379160 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5834921 Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Nick Yamane <nickdiego@igalia.com> Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> Cr-Commit-Position: refs/heads/main@{#1353682}
diff --git a/ui/display/types/display_config.h b/ui/display/types/display_config.h index 14457ee..d2b66e4 100644 --- a/ui/display/types/display_config.h +++ b/ui/display/types/display_config.h
@@ -21,10 +21,12 @@ std::vector<DisplayGeometry> display_geometries; float primary_scale = 1.0f; + float font_scale = 1.0f; bool operator==(const DisplayConfig& other) const { return display_geometries == other.display_geometries && - primary_scale == other.primary_scale; + primary_scale == other.primary_scale && + font_scale == other.font_scale; } };
diff --git a/ui/gtk/gtk_ui.cc b/ui/gtk/gtk_ui.cc index 1d41088..d215ab07 100644 --- a/ui/gtk/gtk_ui.cc +++ b/ui/gtk/gtk_ui.cc
@@ -1021,6 +1021,7 @@ } config.primary_scale = std::max(1, gdk_monitor_get_scale_factor(primary)) * font_scale; + config.font_scale = font_scale; config.display_geometries.reserve(monitors.size()); for (GdkMonitor* monitor : monitors) { GdkRectangle geometry;