Support fractional HiDPI in GTK4 backend#30344
Conversation
| scale = surface.get_scale() | ||
| else: | ||
| scale = self.get_scale_factor() | ||
| if scale is not None and self._set_device_pixel_ratio(scale): |
There was a problem hiding this comment.
When can scale be None? I'd expect that this is rather a RuntimeError and should generally not happen.
There was a problem hiding this comment.
I suspect there is some funnyness with hidden / minimized / offscreen / not drawn yet windows in the _GTK_GE_4_12 branch where there may not be a defined scale yet (because they have not been put on the screen yet).
There was a problem hiding this comment.
Would it be better in that case to fall back to self.get_scale_factor() rather than doing nothing?
There was a problem hiding this comment.
I was trying to avoid issues if native or surface were not set yet, but it seems like this function only ends up being called after the widget is realized, so the window surface should always exist. The only other caller is the resize event, but that can obviously only happen with a window to resize...
So I guess I can just drop all the conditions, as I can't so far get it to fail.
Since GTK 4.12, fractional HiDPI is handled, but with a separate property on the backing surface due to it being a different type.
|
Also pushed a fix for these warnings from the GTK4 examples: |
…344-on-v3.10.x Backport PR #30344 on branch v3.10.x (Support fractional HiDPI in GTK4 backend)
PR summary
Since GTK 4.12, fractional HiDPI is handled, but with a separate property on the backing surface due to it being a different type.
PR checklist