Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider sending the first wl_surface.preferred_buffer_scale = 1 #1640

Open
YaLTeR opened this issue Jan 21, 2025 · 4 comments
Open

Consider sending the first wl_surface.preferred_buffer_scale = 1 #1640

YaLTeR opened this issue Jan 21, 2025 · 4 comments

Comments

@YaLTeR
Copy link
Contributor

YaLTeR commented Jan 21, 2025

While wl_surface.preferred_buffer_scale is defined to default to 1, GNOME sends the initial preferred_buffer_scale(1), so clients may start to rely on it.

For example, Kitty was relying on this: kovidgoyal/kitty#8236 Though admittedly, it was to work around suboptimal behavior in other compositors, and it's just been changed in Kitty in a way that shouldn't affect Smithay any more.

In any case, it should be a simple change in Smithay, and it's just one event at initial configure, so maybe it's best to send it. The relevant code:

// NOTE we insert default for checks below to work properly.
let mut storage = data
.data_map
.get_or_insert(|| RefCell::new(SuggestedSurfaceState::default()))
.borrow_mut();
if storage.scale != scale {
surface.preferred_buffer_scale(scale);
storage.scale = scale;
}

Note that GNOME does not send the initial preferred_buffer_transform if it's Normal.

@kchibisov
Copy link
Member

You only mention the wl_surface v6, but you should account for fractional as well, which is other place.

@YaLTeR
Copy link
Contributor Author

YaLTeR commented Jan 21, 2025

Fractional already sends initial scale = 1, at least on niri

@kchibisov
Copy link
Member

Hm, indeed, I guess the issue is that identifying when you'd need to send it initially, and I think it's when you assign the scale.

@Drakulix
Copy link
Member

I guess wouldn't cause any harm to send an initial scale value, even if it is 1, as long as downstream has the option to send a different value for the initial configure. PRs welcome.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants