[server] Properly send a selection clear prior to keyboard focus enter

Authored by graesslin on Jul 5 2016, 8:56 AM.

Description

[server] Properly send a selection clear prior to keyboard focus enter

Summary:
When setting the keyboard focus the server needs also to send the current
selection to the client. So far KWayland only sent the selection if it was
set. That is if the last focused client cleared the selection it was not
updated and the client might have had an outdated selection.

To prevent this situation the server now explicitly sends the clear to the
client on enter if there is no selection. Also if the selection is cleared,
the SeatInterface now unsets it's current selection to make sure that the
next focused keyboard will get the clear selection sent.

Test Plan:
Existing test case adjusted and a new test case added which
simulates the interaction of two clients.

Reviewers: Plasma on Wayland

Subscribers: plasma-devel

Tags: Plasma on Wayland

Differential Revision: https://phabricator.kde.org/D2091