Hyprland
Hyprland copied to clipboard
Viewporter does not work properly with layer-shell
How the client is supposed to look:

How it actually looks when using wp_viewport:

What the client does:
[wayrs] -> [email protected](46,wl_output@12)
[wayrs] -> [email protected]_surface(wl_surface@13)
[wayrs] -> [email protected]_fractional_scale(wp_fractional_scale_v1@14,13)
[wayrs] -> [email protected]_layer_surface(zwlr_layer_surface_v1@15,13,12,2,"i3bar-river")
[wayrs] -> [email protected]_size(0,20)
[wayrs] -> [email protected]_anchor(13)
[wayrs] -> [email protected]_margin(0,0,5,0)
[wayrs] -> [email protected]_exclusive_zone(25)
[wayrs] -> [email protected]_viewport(wp_viewport@16,13)
...
[wayrs] [email protected]_scale(144)
[wayrs] [email protected](136803798)
[wayrs] -> [email protected]_source(0,0,1919,24)
[wayrs] -> [email protected]_destination(1599,20)
[wayrs] -> [email protected](19,0,0)
[wayrs] -> [email protected](0,0,2147483647,2147483647)
[wayrs] -> [email protected]()
huh, odd. is that i3bar-river? Can I get a reproducible example case (probably a config for i3bar-river)
tested on my laptop and it works properly, but fractionalScale is not bound. Maybe you can make a branch with wp-fs-v1 so that I can test?
hyprpaper uses wp-fs-v1 and it's working fine as far as I can tell.
Yes, I pushed my attempt to implement fractional scaling to https://github.com/MaxVerevkin/i3bar-river/tree/wpfs (it works in river btw (I mean the viewport part, river does not implement wp-fs)). Min config:
$ cat .config/i3bar-river/config.toml
command = "sh -c 'echo hello_world; sleep 99999'"
hyprpaper uses wp-fs-v1 and it's working fine as far as I can tell.
Hm...
$ WAYLAND_DEBUG=1 build/hyprpaper 2>&1 | rg viewpo
[3289227.537] [email protected](12, "wp_viewporter", 1)
[3289227.539] -> [email protected](12, "wp_viewporter", 1, new id [unknown]@5)
[3289227.969] -> [email protected]_viewport(new id wp_viewport@16, wl_surface@11)
[3289274.831] -> [email protected]_destination(1919, 1079)
[3289289.401] -> [email protected]_destination(1919, 1079)
AFAIK with scaling you should only use the destination, as no cropping is needed. Can't say I fully understand their reasoning in the spec, though.
That's weird that binding wp-fs changes the semantics of wp-vp. Might be worth opening an issue at wayland-protocols for clarification.
[3289274.831] -> [email protected]_destination(1919, 1079) [3289289.401] -> [email protected]_destination(1919, 1079)
This still seems wrong because the physical size of my screen is 1920x1080, and with scale=1.2 it should be 1600x900.
Maybe offtopic, but this seems wrong to:
$ WAYLAND_DEBUG=1 build/hyprpaper 2>&1 | rg set_buffer_scale
[1813637.325] -> [email protected]_buffer_scale(2)
[1813647.356] -> [email protected]_buffer_scale(2)
Spec:
The wl_surface buffer scale should remain set to 1.
possible. Do I look like I carefully read the spec? lol
mostly took a look at code from the test clients.
AFAIK with scaling you should only use the destination, as no cropping is needed. Can't say I fully understand their reasoning in the spec, though.
Apparently set_source is optional in general, didn't know that.
After https://github.com/hyprwm/Hyprland/commit/859d6b9b8a961669c814632bbc7a1a9d94556551 something different happens:

(The top uses set_buffer_scale(2), the bottom uses viewporter)
possible.
Hyprpaper uses wp-fs-v1 and works. See that impl.
This is not even related to fractional scaling. The client may not even bind wp-fs, receive "scale=2" event, render with scale of 2 and instead of setting "buffer_scale=2" the client may use wp-vp to scale the buffer down. This is a perfectly valid use of wp-vp.
Hyprpaper uses wp-fs-v1 and works
And it is wrong.
[3289274.831] -> [email protected]_destination(1919, 1079) [3289289.401] -> [email protected]_destination(1919, 1079)This still seems wrong because the physical size of my screen is 1920x1080, and with scale=1.2 it should be 1600x900.
fixed in both hl and hp.
Works!