Client disconnections
I have recently been playing around with libei and picked up changes from xdg-desktop-portal, xdg-desktop-portal-gnome, mutter (as tabulated in #1). I am creating a client with sender context to emulate virtual pointer/keyboard devices. All the changes work pretty well except when monitor is resized/changed. Mutter tends to drop the existing absolute pointer device and recreates it with the new view port but as the device is dropped (paused and removed), libeis-device stops the device emulation (via eis_device_stop_emulating
). This in turns causes (or at least that is my understanding) the libei client (running in sender context) to receive a stop emulating message and it immediately disconnects the client due to the sanity check: DISCONNECT_IF_SENDER_CONTEXT
. (Note that on my client end, I am already stopping the device emulation when a pause event is received for any emulated device). This problem is always reproducible.
I am also seeing another slightly different but related issue that is happening on monitor resize/change i.e. all emulated devices are abruptly removed by mutter and the client is disconnected. I think the event is somehow getting generated by libeis that forces mutter to disconnect client. I have double checked ref counting of objects in both mutter code as well my client side but that doesn't seem to be a problem. This problem is not consistently reproducible but can be reproduced after repeated monitor resizes. It is not obvious to me why the client disconnection is initiated by libei.
Lastly, what is the prescribed way to re-establish new client connection? I was thinking of creating a new sender context but then the previous fd doesn't get any events and attempt to do a fresh ConnectToEIS
fails since the session is active. It would be a bit heavy weight to tear down the portal session completely in order to get a new libei client connection to the server. Thoughts?