wlroots icon indicating copy to clipboard operation
wlroots copied to clipboard

Don't send offers to new windows before first interaction

Open emersion opened this issue 7 years ago • 5 comments

Currently it's possible to steal the current selection by creating a new window (which can be transparent).

Instead we could wait for the first interaction with the window (key press, click, …) to send selection offers.


wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1398

emersion avatar Nov 27 '18 18:11 emersion

Yes, there are such clients. But at least until https://github.com/swaywm/wlr-protocols/pull/25 is merged, I think allowing this as a workaround is actually a good thing. Once we have a viable alternative I agree we should fix this.

ammen99 avatar Nov 27 '18 21:11 ammen99

Instead we could wait for the first interaction with the window (key press, click, …) to send selection offers.

I believe modifiers key presses should not be counted as a first interaction, so it is possible to close the window using a key binding without exposing the clipboard.

progandy avatar Nov 27 '18 22:11 progandy

Would need to make sure we send offers before the actual interaction event though, so something like "open a new window, first interaction is middle-click paste" still works. Although with protocols being asynchronous, if you wait for that middle-click to send the offer it might be somewhat unreliable?..

martinetd avatar Nov 28 '18 00:11 martinetd

Would need to make sure we send offers before the actual interaction event though, so something like "open a new window, first interaction is middle-click paste" still works.

That's the same as "window is not focused, focus it with middle-click paste", which works currently.

Although with protocols being asynchronous, if you wait for that middle-click to send the offer it might be somewhat unreliable?..

Asynchronous doesn't mean out-of-order.

emersion avatar Nov 28 '18 06:11 emersion

Asynchronous doesn't mean out-of-order.

Depending on the protocol it doesn't need to be out-of-order to be unreliable (e.g. if the offer would have needed a round-trip to setup); but that's apparently not the case here. Anyway, you're correct that it's the same as focusing a window with middle-click, and that works on rootston - it's not necessarily difficult, just something to be careful about (it will almost certainly be different in implementation if the new view has focus but not offers, as we just send offer when focusing)

martinetd avatar Nov 28 '18 08:11 martinetd