diff --git a/src/server/seat_interface.cpp b/src/server/seat_interface.cpp index 8faf74b..5645a92 100644 --- a/src/server/seat_interface.cpp +++ b/src/server/seat_interface.cpp @@ -239,9 +239,9 @@ QVector SeatInterface::Private::touchsForSurface(SurfaceInterf return interfacesForSurface(surface, touchs); } -DataDeviceInterface *SeatInterface::Private::dataDeviceForSurface(SurfaceInterface *surface) const +QVector SeatInterface::Private::dataDevicesForSurface(SurfaceInterface *surface) const { - return interfaceForSurface(surface, dataDevices); + return interfacesForSurface(surface, dataDevices); } TextInputInterface *SeatInterface::Private::textInputForSurface(SurfaceInterface *surface) const @@ -255,9 +255,7 @@ void SeatInterface::Private::registerDataDevice(DataDeviceInterface *dataDevice) dataDevices << dataDevice; auto dataDeviceCleanup = [this, dataDevice] { dataDevices.removeOne(dataDevice); - if (keys.focus.selection == dataDevice) { - keys.focus.selection = nullptr; - } + keys.focus.selections.removeOne(dataDevice); }; QObject::connect(dataDevice, &QObject::destroyed, q, dataDeviceCleanup); QObject::connect(dataDevice, &Resource::unbound, q, dataDeviceCleanup); @@ -323,10 +321,10 @@ void SeatInterface::Private::registerDataDevice(DataDeviceInterface *dataDevice) } ); // is the new DataDevice for the current keyoard focus? - if (keys.focus.surface && !keys.focus.selection) { + if (keys.focus.surface) { // same client? if (keys.focus.surface->client() == dataDevice->client()) { - keys.focus.selection = dataDevice; + keys.focus.selections.append(dataDevice); if (currentSelection) { dataDevice->sendSelection(currentSelection); } @@ -641,7 +639,13 @@ void SeatInterface::setDragTarget(SurfaceInterface *surface, const QPointF &glob if (d->drag.target) { d->drag.target->updateDragTarget(nullptr, serial); } - d->drag.target = d->dataDeviceForSurface(surface); + + // FIXME? + d->drag.target = nullptr; + if (d->dataDevicesForSurface(surface).size() > 0) { + d->drag.target = d->dataDevicesForSurface(surface).first(); + } + if (d->drag.mode == Private::Drag::Mode::Pointer) { setPointerPos(globalPosition); } else if (d->drag.mode == Private::Drag::Mode::Touch && @@ -1121,12 +1125,14 @@ void SeatInterface::setFocusedKeyboardSurface(SurfaceInterface *surface) ); d->keys.focus.serial = serial; // selection? - d->keys.focus.selection = d->dataDeviceForSurface(surface); - if (d->keys.focus.selection) { + + const QVector dataDevices = d->dataDevicesForSurface(surface); + d->keys.focus.selections = dataDevices; + for (auto dataDevice : dataDevices) { if (d->currentSelection) { - d->keys.focus.selection->sendSelection(d->currentSelection); + dataDevice->sendSelection(d->currentSelection); } else { - d->keys.focus.selection->sendClearSelection(); + dataDevice->sendClearSelection(); } } } @@ -1608,11 +1614,11 @@ void SeatInterface::setSelection(AbstractDataSource *selection) d->currentSelection = selection; - if (d->keys.focus.selection) { + for (auto dataDevice: qAsConst(d->keys.focus.selections)) { if (selection) { - d->keys.focus.selection->sendSelection(selection); + dataDevice->sendSelection(selection); } else { - d->keys.focus.selection->sendClearSelection(); + dataDevice->sendClearSelection(); } } diff --git a/src/server/seat_interface_p.h b/src/server/seat_interface_p.h index 8bde640..c6d39fb 100644 --- a/src/server/seat_interface_p.h +++ b/src/server/seat_interface_p.h @@ -35,7 +35,7 @@ public: QVector pointersForSurface(SurfaceInterface *surface) const; QVector keyboardsForSurface(SurfaceInterface *surface) const; QVector touchsForSurface(SurfaceInterface *surface) const; - DataDeviceInterface *dataDeviceForSurface(SurfaceInterface *surface) const; + QVector dataDevicesForSurface(SurfaceInterface *surface) const; TextInputInterface *textInputForSurface(SurfaceInterface *surface) const; void registerDataDevice(DataDeviceInterface *dataDevice); void registerDataControlDevice(DataControlDeviceInterface *dataDevice); @@ -108,7 +108,7 @@ public: QVector keyboards; QMetaObject::Connection destroyConnection; quint32 serial = 0; - DataDeviceInterface *selection = nullptr; + QVector selections; }; Focus focus; quint32 lastStateSerial = 0;