Expose monitor physical size as `MonitorHandleProvider` method
Add support for querying the physical size of a monitor (in millimeters) via a new physical_size() method on the MonitorHandleProvider trait. Currently X11, Wayland, Windows, MacOS backends are updated. Other platforms are either don't support this functionality or it is hard to implement it. If no implementation possible, method will simply return None.
Resolves #3858 and partially resolves #4187.
- [x] Tested on all platforms changed: I manually tested on Linux, MacOS, and Windows, other platforms return
None. - [x] Added an entry to the
changelogmodule if knowledge of this change could be valuable to users - [x] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
- [ ] Created or updated an example program if it would help users understand this functionality
The CI failure is due to typos in files from previous commits.
Thanks for the PR!
CI fail seems unrelated to PR.
Couple of notes after testing different platforms:
- Wayland and MacOS swaps values when original orientation is changed by 90 or 270 degrees. Since we don't expose display orientation yet, I decided to adjust implementation for other systems to match this behavior.
- Wayland returns only centimeter precision. It seems that to change it, contribution to libdisplay-info is needed, as smithay uses this library.
- Previous implementation for windows returned incorrect values on resolution change. Thanks to @madsmtm comment this problem is now fixed.
Relevant comments were added to the documentation.