Unreviewed changes
3 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: remoting/host/linux/gnome_desktop_resizer.cc
Insertions: 12, Deletions: 2.
@@ -93,8 +93,18 @@
int denominator;
};
-// Valid GNOME fractional scales with denominator <= 4 and numerator <= 7,
-// in the range [1.0, 4.0], sorted in ascending order.
+// Valid GNOME fractional scales in the range [1.0, 4.0], sorted in ascending
+// order.
+//
+// The scale list is filtered based on two constraints:
+// 1. Denominator <= 4: GNOME 49 only supports fractional scales with
+// denominators up to 4.
+// 2. Numerator <= 7: GNOME 49 does not restrict the numerator, but we cap it
+// at 7. When adjusting the physical resolution, we round it down to a
+// multiple of the numerator. Capping the numerator at 7 guarantees that
+// this rounding-down operation will never reduce the width or height by
+// more than 6 pixels, ensuring the resulting resolution remains a close
+// fit for the client's screen size.
constexpr auto kGnomeScales = std::to_array<GnomeScale>({
{1.0, 1, 1},
{5.0 / 4.0, 5, 4},
```
Change information
Commit message:
Support fractional scaling constraints in GnomeDesktopResizer
This CL updates GnomeDesktopResizer::GetSupportedResolutions to
support GNOME's fractional scaling constraints (introduced in
GNOME 49+).
Specifically, GNOME requires:
1. The logical dimensions to be integers. This means the physical
resolution width and height must be cleanly divisible by the
numerator of the fractional scale.
2. The logical area to be at least 600x600 (360,000 pixels).
To satisfy this, GetSupportedResolutions now:
- Identifies the requested scale factor from the preferred
resolution's DPI.
- Finds the closest matching GNOME-supported fractional scale
(denominator <= 4, numerator <= 7).
- Rounds the preferred physical dimensions down to the nearest
multiple of the numerator (using rounded_w and rounded_h).
- Verifies if the resulting logical area meets the 360,000-pixel
minimum.
- If not, falls back to the next smaller supported scale,
ultimately falling back to 1.0x if no other scale works.
- Uses pure integer math for precision and safety.
Additionally, this CL:
- Removes the legacy rounding-down-to-even-numbers logic in
ClientSession::NotifyClientResolution since WebRTC now handles
odd dimensions and it could interfere with GNOME's custom
rounding.
- Adds comprehensive unit tests in gnome_desktop_resizer_unittest.cc
to verify these behaviors.
TAG=agy
CONV=882ebc64-65bf-4d51-a547-0caf8a82fa9f
Bug: 431816005
Change-Id: I227f608f7f1a823ac193e54fba207c2799a585b3
Cr-Commit-Position: refs/heads/main@{#1653262}
Files:
- M remoting/host/client_session.cc
- M remoting/host/linux/gnome_desktop_resizer.cc
- M remoting/host/linux/gnome_desktop_resizer_unittest.cc
Change size: M
Delta: 3 files changed, 144 insertions(+), 19 deletions(-)
Branch: refs/heads/main
Submit Requirements:
Code-Review: +1 by Jamie Walch