The issue of Qt application being unable to write data to the clipboard when performing write operations under Wayland

张廷安 zhangtingan at uniontech.com
Mon Sep 18 10:07:51 BST 2023


Hello,


I noticed that in Wayland protocol, when I perform a copy operation in a program, the protocol performs some data operations through `SetSelection` function.
But when I set `Qt::WindowDoesNotAcceptFocus` via Qt in this program and write data via `setText` operation in `QClipboard`, the function `updateSelection` in Wayland will not send the `setSelection` signal. I found that the following code is causing the signal not to be sent.


`*globalKeyboard.focus.surface->client() == dataDevice->client()`.


may i ask why this judgment is necessary, and if I want my app to write clipboard data without getting focus, is there an alternative way I can do it?


Interested to hear back.


Best Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwin/attachments/20230918/c9548cd3/attachment.htm>


More information about the kwin mailing list