Commit 045a6978 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Victor Toso
Browse files


When this capability is negoticated by both the client & the agent,
the clipboard grab messages have an associated serial counter.

The serial is reset to 0 upon client connection.

The counter is increment by 1 on each grab message, by both sides.

The sender of the message with the highest serial should be the
clipboard grab owner, and the current session serial should be

If a lower serial than the current session serial is received, the
grab should be discarded.

Whenever two grabs share the same serial, the one coming from the
client should have a higher priority and the client should gain the
clipboard ownership.

No special treatement is done for the unlikely case of overflowing the
counter. It may temporarily inverse the priority, until both side have
overflown and/or synchronized.

Note: this mechanism isn't aiming at making "the most recent" (as in
time) side gaining the ownership. One side sending subsequent grab
messages earlier will likely take the ownership over a side sending a
single message simultaneously the other way. It only clears the
situation where both side believe that the other is the current
clipboard owner, by having a global ordering and priority in case of
serial conflict.
Signed-off-by: default avatarMarc-André Lureau <>
Acked-by: Victor Toso's avatarVictor Toso <>
parent 4f397d69
Pipeline #116612 passed with stage
in 1 minute and 16 seconds
......@@ -231,6 +231,9 @@ typedef struct SPICE_ATTR_PACKED VDAgentClipboardGrab {
uint8_t selection;
uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)];
uint32_t serial;
uint32_t types[0];
} VDAgentClipboardGrab;
......@@ -304,6 +307,7 @@ enum {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment