Re-implement max resolution test to handle fractional scaling (New) - #2635
Re-implement max resolution test to handle fractional scaling (New)#2635tomli380576 wants to merge 17 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2635 +/- ##
==========================================
- Coverage 59.83% 59.80% -0.03%
==========================================
Files 485 485
Lines 48736 48790 +54
Branches 8728 8743 +15
==========================================
+ Hits 29160 29179 +19
- Misses 18655 18694 +39
+ Partials 921 917 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the provider-side graphics_max_resolution job to determine “current vs maximum” monitor resolution via GNOME/Mutter’s DisplayConfig DBus API (to better handle fractional scaling), and adds convenience helpers to the Checkbox Support GNOME monitor DBus wrapper.
Changes:
- Replace the Gtk/Gdk-based resolution query in
graphics_max_resolution.pywith GNOME/Mutter DisplayConfig DBus state, and keep a sysfs cross-check. - Add
PhysicalMonitor.get_max_resolution()andPhysicalMonitor.get_current_mode()helpers tocheckbox_support.dbus.gnome_monitor. - Minor signature formatting tweak in
MonitorConfigGnome.cycle()(trailing comma).
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| providers/base/bin/graphics_max_resolution.py | Reworks max-resolution detection to use GNOME/Mutter DBus state + sysfs aggregation check. |
| checkbox-support/checkbox_support/dbus/gnome_monitor.py | Adds helpers for selecting max resolution and current mode from Mutter-reported physical monitor modes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if len(self.modes) == 0: | ||
| raise ValueError( | ||
| "Monitor {} doesn't have any supported modes!".format( | ||
| self.info.connector | ||
| ) | ||
| ) | ||
| for mode in self.modes: | ||
| if (mode.width, mode.height) >= (max_w, max_h): | ||
| max_w, max_h = mode.width, mode.height | ||
|
|
||
| if (max_w, max_h) == (0, 0): | ||
| raise RuntimeError("Unexpected max resolution of 0x0") | ||
|
|
||
| return max_w, max_h |
| def get_current_mode(self) -> "MutterDisplayMode | None": | ||
| # it' possible to return none | ||
| # if somehow all monitors are turned off | ||
| for mode in self.modes: | ||
| if mode.is_current: | ||
| return mode | ||
|
|
| def get_max_resolution(self) -> "tuple[int, int]": | ||
| """Get the maximum physcial resolution of this monitor |
Description
This PR re-implements the graphics_max_resolution test to handle fractional scaling that's now officially supported on 26.04.
Resolved issues
Originally the test case uses the display object returned by
Gdk.Display.get_default()to get the current application-level resolution and scaling. The scaling value returned by Gdk is always an integer which makes the test case unable to handle fractional scaling. The new implementation directly queries GNOME about the physical monitor dimensions instead so we can ignore scaling and wayland/x11 differences altogether.Documentation
This test does not work on 16.04, just like the original version. The new one doesn't work on 16.04 is because the dbus call used by MonitorConfigGnome is not present in unity. The old one doesn't work is because of this line
the
require_versionsmethod does not exist in 16.04's python3-gi binding.Tests
C3: