Skip to content
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

MonitorHandle::scale_factor does not use fractional factor on Wayland #3183

Closed
dhardy opened this issue Oct 25, 2023 · 5 comments · Fixed by #3195
Closed

MonitorHandle::scale_factor does not use fractional factor on Wayland #3183

dhardy opened this issue Oct 25, 2023 · 5 comments · Fixed by #3195
Labels
DS - wayland S - docs Awareness, docs, examples, etc.

Comments

@dhardy
Copy link
Contributor

dhardy commented Oct 25, 2023

I see MonitorHandle::scale_factor reporting 2 while Window::scale_factor correctly reports 1.5 on Wayland.

The docs of Window::scale_factor note that it uses wp-fractional-scale protocol if available, otherwise returning an integer factor. The docs of MonitorHandle::scale_factor do not mention any such limitation — is this just a doc issue?

BTW the apple_2 link is broken.

@kchibisov
Copy link
Member

The monitor scale and window scale has nothing to do with each other on Wayland.

@dhardy
Copy link
Contributor Author

dhardy commented Oct 25, 2023

Different protocol, sure, but is it a bug that MonitorHandle::scale_factor is not returning the (correct) fractional scale factor (as configured in kwin) or is it just a doc issue (protocol does not support reporting the correct scale here)?

It's a nuisance that I'm not getting the correct scale factor since I'm attempting to limit the window size to the screen size (also not really possible on multi-screen systems).

@kchibisov
Copy link
Member

I mean, they are just separate, use the scale factor from the window not from the monitor, winit can't by any means return a fractional scaling from the monitor, because wayland doesn't have such information, at all.

The GTK folks had the same issue since they used heuristics, they were told to not do that anymore, because it's just plain wrong, since you don't know on which monitor you'll open anyway.

I can update docs explicitly saying that the scale factor is for the monitor, but window could have different scaling factor. There're compositor which set a scaling on per window basis, so you can have clients with 2, 1.5, 1 scaling on the same output at the same time without anything being blurry (KWIN does this as well, for XWayland only though).

@dhardy
Copy link
Contributor Author

dhardy commented Oct 25, 2023

Sure, I have to use a different approach for sizing. But...

I can update docs explicitly saying that the scale factor is for the monitor

This is not true in my case: the reported value is 2 while the desktop has it set to 1.5. Possibly this means that MonitorHandle::scale_factor should never be used for any purpose.

@kchibisov
Copy link
Member

This is not true in my case: the reported value is 2 while the desktop has it set to 1.5. Possibly this means that MonitorHandle::scale_factor should never be used for any purpose.

Exactly, that's what wayland devs will tell you as well, that's all just metadata about the outputs, nothing more.

@kchibisov kchibisov added this to the Version 0.29.3 milestone Oct 25, 2023
kchibisov added a commit to kchibisov/winit that referenced this issue Oct 27, 2023
Wayland scales each window individually, thus make it clear. Also
recommend against using the `MonitorHandle::scale_factor`.

Fixes rust-windowing#3183.
kchibisov added a commit to kchibisov/winit that referenced this issue Oct 27, 2023
Wayland scales each window individually, thus make it clear. Also
recommend against using the `MonitorHandle::scale_factor`.

Fixes rust-windowing#3183.
kchibisov added a commit that referenced this issue Oct 28, 2023
Wayland scales each window individually, thus make it clear. Also
recommend against using the `MonitorHandle::scale_factor`.

Fixes #3183.
kchibisov added a commit to kchibisov/winit that referenced this issue Oct 28, 2023
Wayland scales each window individually, thus make it clear. Also
recommend against using the `MonitorHandle::scale_factor`.

Fixes rust-windowing#3183.
kchibisov added a commit that referenced this issue Oct 28, 2023
Wayland scales each window individually, thus make it clear. Also
recommend against using the `MonitorHandle::scale_factor`.

Fixes #3183.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DS - wayland S - docs Awareness, docs, examples, etc.
Development

Successfully merging a pull request may close this issue.

2 participants