Skip to content
Commit 3984732e authored by David Redondo's avatar David Redondo 📖
Browse files

waylandclipboard: Update QClipboard when gaining focus

A process that owns the clipboard via KSystemClipboard (wlr-data-control)
and tries to read the clipboard via QClipboard  will deadlock itself and
eventually times out because the read is done blocking and the send event
is only received afterwards by WaylandClipboard.
When Qt knows it owns the keyboard it can get the data directly, so the
idea is to set QClipboard if possible. However this can be done only
when the Application has focus. Unfortunately inside Qt window system events
are delieverd asnycronously while QClipboard uses signal to indicate changes,
this makes QGuiApplication::focusWindowChanged not useable here because it
happens to late - after the QClipboard signal. For this reason we bind
to the wl_seat and track focus ourselves.
QClipboard takes ownership of QMimeData that is passed into it and so does
KSystemClipboard and ultimately DataControlSource which now uses unique_ptr
to signify this and make it clear that ownership is transferred when the
QClipboard is set.
BUG:442521
BUG:454379
parent 1588ce0c
Loading
Loading
Loading
Pipeline #282727 passed with stage
in 11 minutes and 12 seconds
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment