Gtk+ should not drop PRIMARY selection when visible selection is cleared
Submitted by Zack Weinberg
Link to original bug (#584236)
Description
This is spun off from bug 333514.
The historical behavior of the X11 PRIMARY selection is that it is asserted when the user takes an action which directly results in a selection highlight (so for example when text is selected by click-and-drag, but not when text becomes selected via keyboard form traversal) but is not deasserted when the user takes an action which clears the selection highlight (e.g. single left click in the same text pane). Gtk+ deasserts PRIMARY when the visible selection is cleared, which is wrong, and contrary to the current revision of the freedesktop.org clipboard spec. I'm going to repeat the reproduction recipe from bug 333514:
Run 'zenity --text-info --editable < /dev/null > /dev/null 2>&1 &' twice. The redirections are necessary to prevent zenity from freezing up trying to read from your terminal. Type some text in one zenity window. Select some of it with left mouse. Middle-click in the other zenity window. The selected text will be pasted. This is correct. Now single-click in the first zenity window. The visible selection will vanish. This is still correct. Now middle-click again in the other zenity window. Nothing will happen. This is WRONG WRONG WRONG. The text that you selected before should be pasted again.
Version: 3.22.x