[dev] [st] ICCCM compatible selection handling

From: Markus Wichmann <nullplan_AT_gmx.net>
Date: Sat, 11 Apr 2015 22:00:15 +0200

Hi all,

I recently read the ICCCM regarding selection handling and noticed we
are doing it wrong. Basically, we're supposed to provide real timestamps
in all the calls to selection functions and check for success.

Now, when requesting selection ownership, that's easy, because xsetsel()
is only called from selcopy(), and selcopy() is only called from
brelease, so we can just add a Time argument to selcopy() and xsetsel(),
that we then hand to XSetSelectionOwner() and initialize from the time
element of the XButtonEvent that starts the whole process. So, that's
copying covered. What remains is clipcopy(), clippaste() and selpaste():
Those are recipes, meant to be called from the configuration. Now I
wonder whether the best solution would be to keep a global variable for
the current timestamp that's always updated in the event handlers for
event types that carry time information, or whether a better solution
exists.

Use case for this is rather slim: The way it currently stands, if the
user selects text in st and then somewhere else, and st takes longer to
get to XSetSelectionOwner() than the other application, then st takes
the selection although the other application should. That's probably
only possible using network transport. But I still think st should work
under any circumstances, not just most of them.

Ciao,
Markus
Received on Sat Apr 11 2015 - 22:00:15 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 11 2015 - 22:12:07 CEST