Respect GDK_SCALE and GDK_DPI_SCALE when calculating scale factor

Desktop / Chromium - thomasanderson [chromium.org] - 16 June 2017 17:08 EDT

This CL is a followup to [1] which used 'gdk-window-scaling-factor' and 'gdk-unscaled-dpi' to calculate the scaling factor. I intentially avoided using the GdkScreen API for this since the required functions were added in version 3.9.10, and opted to get the settings directly. This doesn't work all the time though, because GTK allows overriding these settings with the GDK_SCALE and GDK_DPI_SCALE environment
variables (but only when using the X11 backend).

This CL makes the change to use those functions, at the cost of bumping the required GTK dep from 3.3.16 to 3.9.10 (the oldest distro we support, Trusty, has 3.10.8).

As a bonus, GdkScreen has a separate scale factor per monitor, so we can finally stop using the global scale factor for all monitors.

[1] https://codereview.chromium.org/2899943002/

BUG=730757,732440 R=erg@chromium.org,thestig@chromium.org CC=oshima@chromium.org

Review-Url: https://codereview.chromium.org/2937623006 Cr-Commit-Position: refs/heads/master@{#480167}

b50cab3 Respect GDK_SCALE and GDK_DPI_SCALE when calculating scale factor
chrome/browser/ui/libgtkui/gtk_ui.cc | 47 ++++--------------------------------
1 file changed, 5 insertions(+), 42 deletions(-)

Upstream: git.chromium.org


  • Share