-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Support fractional HiDPI in GTK4 backend #30344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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