session-lock: ext_session_lock_v1 events not sent after a roundtrip
Tamaranch opened this issue · comments
Describe the bug
I wanted to try the recent implementation of the session-lock protocol on a port of xfce4-screensaver to Wayland that I made recently, which works correctly on labwc (it's not merged yet because it depends on an experimental embedded compositor library we're developing at Xfce).
With wayfire it doesn't work because the ext_session_lock_v1::locked
(or ::finished
) event is not sent when I do a roundtrip after connecting the listener. And the rest of my code depends on the event returned at that point (it's here if you want to have a look).
It's sent afterwards, but it seems to me that I should receive it during the roundtrip, which is how it usually works.
To Reproduce
Steps to reproduce the behavior:
Basically have a code that executes this:
struct ext_session_lock_v1 *lock = ext_session_lock_manager_v1_lock (lock_manager);
ext_session_lock_v1_add_listener (lock, &lock_listener, lock_manager);
wl_display_roundtrip (wl_display);
and see if it passes into the connected listener during the roundtrip.
Expected behavior
The compositor should send ext_session_lock_v1::locked
or ext_session_lock_v1::finished
during a roundtrip after connecting the listener.
Wayfire version
git master 74ebf68
The protocol says:
In response to the creation of this object the compositor must send either the locked or finished event.
Note however that it doesn't send immediately. If it had used the word immediately, your assumption would have been correct :)
Another part of the protocol:
The compositor may wait for the client to create and render session lock surfaces before sending the locked event to avoid displaying intermediate blank frames.
This is what Wayfire does:
https://github.com/WayfireWM/wayfire/blob/master/plugins/protocols/session-lock.cpp#L269
https://github.com/WayfireWM/wayfire/blob/master/plugins/protocols/session-lock.cpp#L364
So, according to my understanding, your client should be adapted to deal with this case if you want it to be portable across all compositors ;)
Hm indeed, I've been fooled once again by the subtleties of these protocols, which I should have (re)read more carefully :)
What I can expect is to receive the finished event immediately if the compositor doesn't want to lock:
The finished event should be sent immediately on creation of this object if the compositor decides that the locked event will not be sent.
which is a bit different but only requires a slight modification.
It now works correctly on both labwc and wayfire, at least for the session-lock protocol part. Thanks for the tip :)