Hey everyone,

I use synergy (for input device sharing) on a daily basis
and experienced this rather annoying bug in combination with st:

Whenever I paste something from another machine to st,
pasting succeeded only the first time. After about a year
of being annoyed by this bug (it's just too easy to work around it),
I finally digged into the issue today and eventually discovered that st
does not delete its CLIPBOARD and PRIMARY properties after pasting
the copied data. I don't know of any other x client that
cares about this, but synergy waits for st to clear the property
before sending the new selection data.

As ICCCM specifies that the client should delete the property
after handling the request, I adjusted st's behavior. Patch attached.
I have no idea why Christoph originally added the additional condition
there. The only two event types that get through to this code
are PropertyNotify and SelectionNotify and for both of them property
should be deleted.


v4hn
From dacb3e0593aedd191604d25571bf7f8fe9e35c6f Mon Sep 17 00:00:00 2001
From: v4hn <m...@v4hn.de>
Date: Thu, 19 May 2016 12:16:57 +0200
Subject: [PATCH] delete clipboard properties after pasting them

https://tronche.com/gui/x/icccm/sec-2.html#s-2.4 specifies:
> Once all the data in the selection has been retrieved,
> the requestor should delete the property in the SelectionNotify request

Most Clipboard-Owners ignore whether or not the property is already set,
so this is mostly a cosmetic change to keep the windows property list clean.

However, at least synergy decides to wait for the requestor to delete
the properties if they are already set by a previous paste (from synergy).
---
 st.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/st.c b/st.c
index 27536d2..6736464 100644
--- a/st.c
+++ b/st.c
@@ -1151,8 +1151,7 @@ selnotify(XEvent *e)
         * Deleting the property again tells the selection owner to send the
         * next data chunk in the property.
         */
-       if (e->type == PropertyNotify)
-               XDeleteProperty(xw.dpy, xw.win, (int)property);
+       XDeleteProperty(xw.dpy, xw.win, (int)property);
 }
 
 void
-- 
2.8.2

Attachment: signature.asc
Description: PGP signature

Reply via email to