x11: Ignore old XFixesSelectionNotify events

GtkEntryCompletion can rapidly release and claim ownership of the
primary selection. This generates multiple XFixesSelectionNotify events,
first stating that no one owns the selection, then another stating that
we own the selection. The notification that no one owns the selection
causes GtkEntryCompletion to deselect the text, breaking inline
autocompletion.

This fixes it by ignoring any XFixesSelectionNotify with a timestamp
earlier than our clipboard timestamp.

Fixes #14
This commit is contained in:
Jason Crain 2018-07-21 04:17:57 -05:00
parent 7dabc2a42c
commit 77c3ef48cf

View File

@ -491,6 +491,14 @@ gdk_x11_clipboard_xevent (GdkDisplay *display,
if (sn->selection != cb->xselection)
return FALSE;
if (sn->selection_timestamp < cb->timestamp)
{
GDK_DISPLAY_NOTE (display, CLIPBOARD,
g_printerr ("%s: Ignoring XFixesSelectionNotify with too old timestamp (%lu vs %lu)\n",
cb->selection, sn->selection_timestamp, cb->timestamp));
return FALSE;
}
if (sn->owner == GDK_X11_DISPLAY (display)->leader_window)
{
GDK_DISPLAY_NOTE (display, CLIPBOARD,