wayland: Cancel selections if set without focus
Otherwise we confused clients in the following situation: Client A sets selection, but due to timing has lost focus User copies something in client B Client later tries to paste in client A. Client A still thinks it owns the selection so does nothing. CCBUG: 459389
This commit is contained in:
parent
a9dc50e22d
commit
46cad20ea8
1 changed files with 10 additions and 2 deletions
|
@ -293,20 +293,28 @@ void SeatInterfacePrivate::endDrag()
|
||||||
|
|
||||||
void SeatInterfacePrivate::updateSelection(DataDeviceInterface *dataDevice)
|
void SeatInterfacePrivate::updateSelection(DataDeviceInterface *dataDevice)
|
||||||
{
|
{
|
||||||
|
DataSourceInterface *selection = dataDevice->selection();
|
||||||
// if the update is from the focussed window we should inform the active client
|
// if the update is from the focussed window we should inform the active client
|
||||||
if (!(globalKeyboard.focus.surface && (*globalKeyboard.focus.surface->client() == dataDevice->client()))) {
|
if (!(globalKeyboard.focus.surface && (*globalKeyboard.focus.surface->client() == dataDevice->client()))) {
|
||||||
|
if (selection) {
|
||||||
|
selection->cancel();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
q->setSelection(dataDevice->selection());
|
q->setSelection(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeatInterfacePrivate::updatePrimarySelection(PrimarySelectionDeviceV1Interface *primarySelectionDevice)
|
void SeatInterfacePrivate::updatePrimarySelection(PrimarySelectionDeviceV1Interface *primarySelectionDevice)
|
||||||
{
|
{
|
||||||
|
PrimarySelectionSourceV1Interface *selection = primarySelectionDevice->selection();
|
||||||
// if the update is from the focussed window we should inform the active client
|
// if the update is from the focussed window we should inform the active client
|
||||||
if (!(globalKeyboard.focus.surface && (*globalKeyboard.focus.surface->client() == primarySelectionDevice->client()))) {
|
if (!(globalKeyboard.focus.surface && (*globalKeyboard.focus.surface->client() == primarySelectionDevice->client()))) {
|
||||||
|
if (selection) {
|
||||||
|
selection->cancel();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
q->setPrimarySelection(primarySelectionDevice->selection());
|
q->setPrimarySelection(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeatInterfacePrivate::sendCapabilities()
|
void SeatInterfacePrivate::sendCapabilities()
|
||||||
|
|
Loading…
Reference in a new issue