Fix regression caused by backward compatibility support in data source
We should only enforce the check whether a data source has set the actions for drag on drop on a selection if it's at least version 3. For backward compatibility we used to set a default action which would ensure that a version <3 and >3 client can interact with each other. But due to that the action was set to a default value which breaks any selection. Sorry about that. This change ensures the backward compatibility behavior does not break selection. As the regression causes all clients to quit it is a severe regression which requires fast action. Due to that I'm doing a maintainer push without review. I encourage everyone to do a post commit review. Sorry for not noticing the regression before. The backward compatibility was the last thing I added in that patch set and apparently I did not run all tests again.
This commit is contained in:
parent
072ad10b4b
commit
e087a3666b
4 changed files with 8 additions and 3 deletions
|
@ -73,6 +73,7 @@ static const QString s_socketName = QStringLiteral("kwayland-test-wayland-datade
|
|||
|
||||
void TestDataDevice::init()
|
||||
{
|
||||
qRegisterMetaType<KWayland::Server::DataSourceInterface*>();
|
||||
using namespace KWayland::Server;
|
||||
delete m_display;
|
||||
m_display = new Display(this);
|
||||
|
|
|
@ -132,6 +132,7 @@ void TestDataSource::testOffer()
|
|||
using namespace KWayland::Client;
|
||||
using namespace KWayland::Server;
|
||||
|
||||
qRegisterMetaType<KWayland::Server::DataSourceInterface*>();
|
||||
QSignalSpy dataSourceCreatedSpy(m_dataDeviceManagerInterface, SIGNAL(dataSourceCreated(KWayland::Server::DataSourceInterface*)));
|
||||
QVERIFY(dataSourceCreatedSpy.isValid());
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ void DataDeviceInterface::Private::setSelectionCallback(wl_client *client, wl_re
|
|||
|
||||
void DataDeviceInterface::Private::setSelection(DataSourceInterface *dataSource)
|
||||
{
|
||||
if (dataSource->supportedDragAndDropActions()) {
|
||||
if (dataSource && dataSource->supportedDragAndDropActions() && wl_resource_get_version(dataSource->resource()) >= WL_DATA_SOURCE_ACTION_SINCE_VERSION) {
|
||||
wl_resource_post_error(dataSource->resource(), WL_DATA_SOURCE_ERROR_INVALID_SOURCE, "Data source is for drag and drop");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ public:
|
|||
~Private();
|
||||
|
||||
QStringList mimeTypes;
|
||||
// sensible default for < version 3
|
||||
DataDeviceManagerInterface::DnDActions supportedDnDActions = DataDeviceManagerInterface::DnDAction::Copy;
|
||||
DataDeviceManagerInterface::DnDActions supportedDnDActions = DataDeviceManagerInterface::DnDAction::None;
|
||||
|
||||
private:
|
||||
DataSourceInterface *q_func() {
|
||||
|
@ -111,6 +110,10 @@ void DataSourceInterface::Private::setActionsCallback(wl_client *client, wl_reso
|
|||
DataSourceInterface::DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource)
|
||||
: Resource(new Private(this, parent, parentResource))
|
||||
{
|
||||
if (wl_resource_get_version(parentResource) < WL_DATA_SOURCE_ACTION_SINCE_VERSION) {
|
||||
Q_D();
|
||||
d->supportedDnDActions = DataDeviceManagerInterface::DnDAction::Copy;
|
||||
}
|
||||
}
|
||||
|
||||
DataSourceInterface::~DataSourceInterface() = default;
|
||||
|
|
Loading…
Reference in a new issue