Skip to content

wayland: Add support for fractional scaling#2369

Closed
mahkoh wants to merge 1 commit intorust-windowing:masterfrom
mahkoh:fractional-scaling
Closed

wayland: Add support for fractional scaling#2369
mahkoh wants to merge 1 commit intorust-windowing:masterfrom
mahkoh:fractional-scaling

Conversation

@mahkoh
Copy link
Copy Markdown
Contributor

@mahkoh mahkoh commented Jul 9, 2022

  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

Depends on https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/143

@mahkoh mahkoh marked this pull request as draft July 9, 2022 14:38
@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jul 9, 2022

PS: I've noticed that winit never destroys any wayland surfaces. I've kept it that way with the new objects I've added.

@kchibisov
Copy link
Copy Markdown
Member

@mahkoh winit should destroy the surface via sctk iirc, unless sctk changed that?

I don't see anything wrong in destroying those, but there might be a reason why it's that way.

In general, unless the protocol will be accepted there won't be any action on that PR.

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jul 9, 2022

@mahkoh winit should destroy the surface via sctk iirc, unless sctk changed that?

I don't believe this applies to the wl_surface itself.

@kchibisov
Copy link
Copy Markdown
Member

I don't believe this applies to the wl_surface itself.

Ah, I think it doesn't destroy it in the Window, since it's basically a handle, yeah, should do that, would you send a patch against master or I should do so?

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jul 9, 2022

Please go ahead. I'll add destructor calls for the new objects I've added in this PR.

@kchibisov
Copy link
Copy Markdown
Member

@mahkoh it's being dropped here https://github.com/Smithay/client-toolkit/blob/f03c4b7dea89648dbcba43de80eb14687e0e9da8/src/shell/xdg.rs#L139, so no need for winit to drop it explicitly as well.

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jul 9, 2022

self.surface refers to an xdg_surface not to a wl_surface.

@kchibisov
Copy link
Copy Markdown
Member

Hm, you're right. I've confused the place, but as well as the surface that is being dropped by sctk, since the one it's dropping is invisible one for decorations. So yeah, we should drop this surface in winit.

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jul 9, 2022

Keep in mind that the wl_surface must be destroyed after the xdg_surface. Otherwise a protocol error occurs.

@kchibisov kchibisov added C - waiting on author Waiting for a response or another PR DS - wayland Affects the Wayland backend, or generally free Unix platforms labels Jul 10, 2022
@kchibisov
Copy link
Copy Markdown
Member

@mahkoh In general I have a question, how that will work with client side decorations winit is drawing and sctk frame integrations? I think they should be aware of that change somehow?

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jul 14, 2022

They continue to be rendered at integer scales (usually the fractional scale rounded up.) In my tests I did not see any problems with that.

@kchibisov
Copy link
Copy Markdown
Member

I mean, they should likely scale font if they do font rendering to account for that? That's not the with default sctk decorations, but it's the case with adwaita frame.

In general I'd not take any action further here, unless the protocol get merged and sctk get a release...

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jul 14, 2022

I mean, they should likely scale font if they do font rendering to account for that?

Yes, they scale the font at the next integer scale.

2022-07-14.21-36-48.mp4

In general I'd not take any action further here, unless the protocol get merged and sctk get a release...

This has nothing to do with sctk. It provides a strict improvement for the content of the window while leaving the frame unchanged.

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Aug 4, 2022

There will be at least one breaking change in the protocol: The scale type has been changed from fixed to uint with a denominator of 120. I will try to adapt this PR soon.

@mahkoh mahkoh force-pushed the fractional-scaling branch from 3b1bd04 to 8c542d1 Compare November 12, 2022 14:29
@kchibisov
Copy link
Copy Markdown
Member

@mahkoh I'd assume stabilization is soon™

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Nov 12, 2022

Incidentally working on rebasing this right now.

@mahkoh mahkoh force-pushed the fractional-scaling branch from 8c542d1 to 926a150 Compare November 12, 2022 15:20
@mahkoh mahkoh marked this pull request as ready for review November 23, 2022 19:09
@mahkoh mahkoh requested a review from kchibisov as a code owner November 23, 2022 19:09
@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Nov 23, 2022

The protocol has been accepted.

@kchibisov
Copy link
Copy Markdown
Member

@mahkoh I'd wait until the sway merges their stuff wrt fractional scaling so I'd have easier time testing it. Given that implementation isn't in wlroots yet it may take some time, but we're not in the rush anyway.

For now just schedule it for winit 0.28.

@kchibisov kchibisov added this to the Version 0.28 milestone Nov 26, 2022
@mahkoh mahkoh force-pushed the fractional-scaling branch from 926a150 to 49fc3fb Compare November 30, 2022 10:49
@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Nov 30, 2022

Updated with the final protocol text. The SDL implementation has been merged: libsdl-org/SDL#5906

What is the timeline for 0.28?

@mahkoh mahkoh force-pushed the fractional-scaling branch from 49fc3fb to d6cde05 Compare November 30, 2022 10:58
@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Nov 30, 2022

Added the missing destroy calls for the add-on objects. See #2369 (comment)

@kchibisov
Copy link
Copy Markdown
Member

What is the timeline for 0.28?

There's no timeline.

I'd basically wait for sway to get fractional scaling, if it won't and we'll be doing 0.28 I'll go back to it.

@oxalica
Copy link
Copy Markdown
Contributor

oxalica commented Jan 14, 2023

I'd basically wait for sway to get fractional scaling, if it won't and we'll be doing 0.28 I'll go back to it.

Note that KDE/kwin has already merged the implementation of fractional scaling and it would be available since the next release (5.27). I hope we can get it in soon.

@kchibisov kchibisov mentioned this pull request Jan 17, 2023
11 tasks
Copy link
Copy Markdown
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested it, just reviewed based on the protocols specification.

libc = "0.2.64"

[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.build-dependencies]
wayland-scanner = "0.29.4"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update wayland crates to point to 0.29.5 versions?

documentation = "https://docs.rs/winit"
categories = ["gui"]
rust-version = "1.60.0"
rust-version = "1.61.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly forced the bump? Do we really need it?

@kchibisov
Copy link
Copy Markdown
Member

@mahkoh I could finish this PR myself given that everything is more of a codestyle rant. Just let me know (though I'd push anyway in-before release).

@mahkoh
Copy link
Copy Markdown
Contributor Author

mahkoh commented Jan 19, 2023

Sorry I'm busy with work at the moment. If you could finish it that would be great.

@kchibisov
Copy link
Copy Markdown
Member

Applied.

Thanks.

@kchibisov kchibisov closed this Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C - waiting on author Waiting for a response or another PR DS - wayland Affects the Wayland backend, or generally free Unix platforms

Development

Successfully merging this pull request may close these issues.

3 participants