Skip to content

feat: add scale factor to window opened event#3279

Merged
hecrj merged 1 commit intoiced-rs:masterfrom
edwloef:window-opened-scale-factor
Mar 14, 2026
Merged

feat: add scale factor to window opened event#3279
hecrj merged 1 commit intoiced-rs:masterfrom
edwloef:window-opened-scale-factor

Conversation

@edwloef
Copy link
Contributor

@edwloef edwloef commented Mar 12, 2026

... and remove one small helper on Window that wasn't consistently used anyways.

This makes it possible to immediately know the system scale factor of a window, in contrast to only after it changes once. With some (only slightly messy) math and only a little bit of flashing on scale factor change, this makes it possible to control the physical size of windows from Iced.

@edwloef edwloef force-pushed the window-opened-scale-factor branch from e9805ed to 05d16d9 Compare March 12, 2026 18:01
@hecrj
Copy link
Member

hecrj commented Mar 12, 2026

This is fine but, in my experience, the initial scale factor can be wrong often.

In Hyprland at least, the initial scale factor is always 1 and it's only after the opening animation finishes that the proper scale factor event is received.

@edwloef
Copy link
Contributor Author

edwloef commented Mar 12, 2026

Interesting. I've only tested this on Sway, where it works properly. Does Hyprland fire a Rescaled event when the "real" scale factor kicks in?

@hecrj hecrj added this to the 0.15 milestone Mar 14, 2026
@hecrj hecrj added feature New feature or request shell addition labels Mar 14, 2026
@hecrj
Copy link
Member

hecrj commented Mar 14, 2026

Does Hyprland fire a Rescaled event when the "real" scale factor kicks in?

Yes, but it takes a second; so if view relies on it there can be flashing. The text example is affected, for instance.

@hecrj hecrj merged commit 54020d7 into iced-rs:master Mar 14, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition feature New feature or request shell

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants