Smithay / client-toolkit

Smithay's toolkit for writing wayland clients
MIT License
285 stars 80 forks source link

Panic - missing wl_subcompositor #210

Open levone1 opened 2 years ago

levone1 commented 2 years ago

Anybody here have any thoughts about this - https://github.com/alacritty/alacritty/issues/5709

Thanks

Maybe some way to export wl_subcompositor or run with --wl_subcompositor= or...?

i509VCB commented 2 years ago

In the alacritty issue, I assume by qxdisplay you are referring to this: https://github.com/sailfish-containers/qxdisplay

levone1 commented 2 years ago

In the alacritty issue, I assume by qxdisplay you are referring to this: https://github.com/sailfish-containers/qxdisplay

yes

i509VCB commented 2 years ago

Could you run wayland-info inside the container and report the output?

Based on the alacritty issue I think might be an issue with qxdisplay, that command should reveal some more information about the situation we have here.

levone1 commented 2 years ago

QT_WAYLAND_DISABLE_WINDOWDECORATION=1 WAYLAND_DISPLAY=../../display/wayland-container-0 EGL_PLATFORM=wayland QT_WAYLAND_FORCE_DPI=96> Could you run wayland-info inside the container and report the output?

Based on the alacritty issue I think might be an issue with qxdisplay, that command should reveal some more information about the situation we have here.

Command not found... Also no pkg by that name in repos... I did see a Gitlab source for it. I could try building if helpful ... env | grep -i wayland shows QT_WAYLAND_DISABLE_WINDOWDECORATION=1 WAYLAND_DISPLAY=../../display/wayland-container-0 EGL_PLATFORM=wayland QT_WAYLAND_FORCE_DPI=96

echo $XDG_SESSSION_TYPE shows unspecified

i509VCB commented 2 years ago

Well that does show the environment is set, which is expected because alacritty did not fail to create the event loop.

The output of wayland-info would help a lot since I need to see what globals the compositor is providing to clients.

It might be under some meta package, wayland-utils for example in arch packages repo. You might also have weston-info which is pretty much the same package in your package repositories?

levone1 commented 2 years ago

Well that does show the environment is set, which is expected because alacritty did not fail to create the event loop.

The output of wayland-info would help a lot since I need to see what globals the compositor is providing to clients.

It might be under some meta package, wayland-utils for example in arch packages repo. You might also have weston-info which is pretty much the same package in your package repositories?

weston-info output: ` Please use wayland-info instead weston-info is deprecated and will be removed in a future version

interface: 'wl_compositor', version: 3, name: 1 interface: 'wl_data_device_manager', version: 1, name: 2 interface: 'wl_shm', version: 1, name: 3 formats: 'C8 '(0x20203843) 'XR30'(0x30335258) 'AR30'(0x30335241) 'XB30'(0x30334258) 'AB24'(0x34324241) 'XB24'(0x34324258) 'AR12'(0x32315241) 'XR12'(0x32315258) 'RG24'(0x34324752) 'XR15'(0x35315258) RGB565 ARGB8888 XRGB8888 XRGB8888 ARGB8888 interface: 'qt_hardware_integration', version: 1, name: 4 interface: 'android_wlegl', version: 2, name: 5 interface: 'qt_surface_extension', version: 1, name: 6 interface: 'qt_touch_extension', version: 1, name: 7 interface: 'qt_key_extension', version: 2, name: 8 interface: 'wl_seat', version: 3, name: 9 name: (null) capabilities: pointer keyboard touch interface: 'wl_shell', version: 1, name: 10 interface: 'wl_output', version: 2, name: 11 x: 0, y: 0, scale: 1, physical_width: -1 mm, physical_height: -1 mm, make: '', model: '', subpixel_orientation: unknown, output_transform: normal, mode: width: 1080 px, height: 2160 px, refresh: 60.000 Hz, flags: current preferred` Indeed, no wl_subcompositor ... Possible to add?

i509VCB commented 2 years ago

Looking at the qt compositor reference, you might have to take things into your own hands: https://doc.qt.io/qt-5/qtwayland-compositor-qmlmodule.html

There isn't any WaylandSubcompositor type I can easily find but I think some low level interaction can be done to make it work.

Now why does sctk and by proxy winit and alacritty need the subcompositor? sctk uses the subcompositor to draw it's fallback decorations if server side decorations are not present. We don't currently have an option to turn that requirement off.

Not sure if @vberger would want to add another fallback to just not draw the frame if there is no sub-compositor. That is something that would need to go up the chain for winit and there alacritty to update for if it is done.

elinorbgr commented 2 years ago

I'd like to point that wl_subcompositor is a non-deprecated part of the core Wayland protocol, as such any compliant compositor is expected to support it, and client can rely on it.

levone1 commented 2 years ago

Looking at the qt compositor reference, you might have to take things into your own hands: https://doc.qt.io/qt-5/qtwayland-compositor-qmlmodule.html

There isn't any WaylandSubcompositor type I can easily find but I think some low level interaction can be done to make it work.

Now why does sctk and by proxy winit and alacritty need the subcompositor? sctk uses the subcompositor to draw it's fallback decorations if server side decorations are not present. We don't currently have an option to turn that requirement off.

Not sure if @vberger would want to add another fallback to just not draw the frame if there is no sub-compositor. That is something that would need to go up the chain for winit and there alacritty to update for if it is done

Looking at the qt compositor reference, you might have to take things into your own hands: https://doc.qt.io/qt-5/qtwayland-compositor-qmlmodule.html

There isn't any WaylandSubcompositor type I can easily find but I think some low level interaction can be done to make it work.

Now why does sctk and by proxy winit and alacritty need the subcompositor? sctk uses the subcompositor to draw it's fallback decorations if server side decorations are not present. We don't currently have an option to turn that requirement off.

Not sure if @vberger would want to add another fallback to just not draw the frame if there is no sub-compositor. That is something that would need to go up the chain for winit and there alacritty to update for if it is done.

Any way to edit source to disable whatever requirement it's looking for? I have attempted to edit environment.rs line 183 (where the panic is called), but not knowledgeable enough, plus I don't think removing the panic will necessarily make it work, or...?

levone1 commented 2 years ago

@vberger - here is reply from qxcompositor dev - https://github.com/elros34/qxcompositor/issues/2

Anything useful there, as far as maybe making it work?

elinorbgr commented 2 years ago

Well, if you want to remove the requirement for subsurfaces, you're going to need to significantly change the Window logic in SCTK to remove the fallback decorations, as they are made using subsurfaces.

That'll mean that unless your compositor provides server-side decorations, alacritty build using such a modified SCTK will be undecorated, which may be a problem depending on your environment.

MarijnS95 commented 11 months ago

For completeness gamescope also doesn't expose wl_subcompositor (probably because it always renders a single full-screen window).

In winit it's extremely trivial to just disable Client Side Decorations by making the subcompositor Optional and never initializing the "lazily initialized" Frame (that's either from sctk or sctk_adwaita).

i509VCB commented 11 months ago

For completeness gamescope also doesn't expose wl_subcompositor (probably because it always renders a single full-screen window).

In winit it's extremely trivial to just disable Client Side Decorations by making the subcompositor Optional and never initializing the "lazily initialized" Frame (that's either from sctk or sctk_adwaita).

Does gamescope provide decorations in that case?

MarijnS95 commented 11 months ago

Where would it provide those decorations - outside of the physical screen where they're invisible?

i509VCB commented 11 months ago

Where would it provide those decorations - outside of the physical screen where they're invisible?

More specifically if gamescope isn't fullscreened, does gamescope provide decorations to the host compositor on behalf of the window it is wrapping?

MarijnS95 commented 11 months ago

I am not aware of it providing window borders or forwarding borders of the nested application (via wl_subcompositor...) in the nested-compositor "sandboxing" use-case.