clipboard: Select target with different priority
Before the target was chosen as the first type from clipboard
that satisfy the requested (from client) type.
However possibly this was not the best choice. For instance
if there were STRING
and UTF8_STRING
the STRING
was chosen
potentially having issues with no-ASCII characters.
Now while scanning the types in the clipboard pick up the one
with a smaller index in atom2agent making atom2agent become a
priority list. This way UTF8_STRING
is picked up instead.
This fixes GitLab issue #37 where openSUSE Tumbleweed is presenting
lot of type for text into clipboard but having text/plain
and
STRING
before UTF8 strings. This causes pastes from guest to
client to not pass correctly no-ASCII characters.
Tested with both GTK code and X11 code (--without-gtk
) and clipboard
text is now working both directions.