Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
tacaswell merged 2 commits intomatplotlib:mainfromQuLogic:gtk4-fractional
Jul 24, 2025

Conversation

@QuLogic
Copy link
Member

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

scale=surface.get_scale()
else:
scale=self.get_scale_factor()
ifscaleisnotNoneandself._set_device_pixel_ratio(scale):
Copy link
Member

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.

Copy link
Member

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).

Copy link
Member

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?

Copy link
MemberAuthor

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.
@github-actionsgithub-actionsbot added the Documentation: examplesfiles in galleries/examples labelJul 24, 2025
@QuLogic
Copy link
MemberAuthor

Also pushed a fix for these warnings from the GTK4 examples:

matplotlib/galleries/examples/user_interfaces/embedding_in_gtk4_sgskip.py:42: DeprecationWarning: Gtk.Widget.show is deprecated  win.show()matplotlib/galleries/examples/user_interfaces/embedding_in_gtk4_panzoom_sgskip.py:47: DeprecationWarning: Gtk.Widget.show is deprecated  win.show()

@tacaswelltacaswell added this to thev3.10.4 milestoneJul 24, 2025
@tacaswelltacaswell merged commit3444f0f intomatplotlib:mainJul 24, 2025
39 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJul 24, 2025
@QuLogicQuLogic deleted the gtk4-fractional branchJuly 24, 2025 18:37
ksunden added a commit that referenced this pull requestJul 25, 2025
…344-on-v3.10.xBackport PR#30344 on branch v3.10.x (Support fractional HiDPI in GTK4 backend)
@ksundenksunden mentioned this pull requestAug 7, 2025
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tacaswelltacaswelltacaswell left review comments

@timhoffmtimhoffmtimhoffm approved these changes

Assignees

No one assigned

Labels

Documentation: examplesfiles in galleries/examplesGUI: gtk

Projects

None yet

Milestone

v3.10.5

Development

Successfully merging this pull request may close these issues.

3 participants

@QuLogic@tacaswell@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp