Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| scale=surface.get_scale() | ||
| else: | ||
| scale=self.get_scale_factor() | ||
| ifscaleisnotNoneandself._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 beNone? 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 toself.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 ifnative orsurface 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 theresize 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 separateproperty on the backing surface due to it being a different type.
QuLogic commentedJul 24, 2025
Also pushed a fix for these warnings from the GTK4 examples: |
3444f0f intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
…344-on-v3.10.xBackport 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