Due to being a compositor, kwin has to conform to some certain interfaces. It means a lot of virtual functions and function tables to integrate with C APIs. Naturally, we not always want to use every argument in such functions. Since we get -Wunused-parameter from -Wall, we have to plumb those unused arguments in order to suppress compiler warnings at the moment. However, I don't think that extra work is worth it. We cannot change or alter prototypes in any way to fix the warning the desired way. Q_UNUSED and similar macros are not good indicators of whether an argument is used too, we tend to overlook putting or removing those macros. I've also noticed that Q_UNUSED are not used to guide us with the removal no longer needed parameters. Therefore, I think it's worth adding -Wno-unused-parameter compiler option to stop the compiler producing warnings about unused parameters. It changes nothing except that we don't need to put Q_UNUSED anymore, which can be really cumbersome sometimes. Note that it doesn't affect unused variables, you'll still get a -Wunused-variable compiler warning if a variable is unused.
94 lines
2.2 KiB
C++
94 lines
2.2 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "kwin_export.h"
|
|
|
|
#include "clientconnection.h"
|
|
#include "datadevicemanager_interface.h"
|
|
|
|
struct wl_client;
|
|
|
|
namespace KWaylandServer
|
|
{
|
|
/**
|
|
* @brief The AbstractDataSource class abstracts the data that
|
|
* can be transferred to another client.
|
|
*
|
|
* It loosely maps to DataDeviceInterface
|
|
*/
|
|
|
|
// Anything related to selections are pure virtual, content relating
|
|
// to drag and drop has a default implementation
|
|
|
|
class KWIN_EXPORT AbstractDataSource : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
virtual bool isAccepted() const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual void accept(const QString &mimeType)
|
|
{
|
|
};
|
|
virtual void requestData(const QString &mimeType, qint32 fd) = 0;
|
|
virtual void cancel() = 0;
|
|
|
|
virtual QStringList mimeTypes() const = 0;
|
|
|
|
/**
|
|
* @returns The Drag and Drop actions supported by this DataSourceInterface.
|
|
*/
|
|
virtual DataDeviceManagerInterface::DnDActions supportedDragAndDropActions() const
|
|
{
|
|
return {};
|
|
};
|
|
virtual DataDeviceManagerInterface::DnDAction selectedDndAction() const
|
|
{
|
|
return DataDeviceManagerInterface::DnDAction::None;
|
|
}
|
|
/**
|
|
* The user performed the drop action during a drag and drop operation.
|
|
*/
|
|
virtual void dropPerformed(){};
|
|
/**
|
|
* The drop destination finished interoperating with this data source.
|
|
*/
|
|
virtual void dndFinished(){};
|
|
/**
|
|
* This event indicates the @p action selected by the compositor after matching the
|
|
* source/destination side actions. Only one action (or none) will be offered here.
|
|
*/
|
|
virtual void dndAction(DataDeviceManagerInterface::DnDAction action)
|
|
{
|
|
};
|
|
|
|
/**
|
|
* Called when a user stops clicking but it is not accepted by a client.
|
|
*/
|
|
virtual void dndCancelled()
|
|
{
|
|
}
|
|
|
|
virtual wl_client *client() const
|
|
{
|
|
return nullptr;
|
|
};
|
|
|
|
Q_SIGNALS:
|
|
void aboutToBeDestroyed();
|
|
|
|
void mimeTypeOffered(const QString &);
|
|
void supportedDragAndDropActionsChanged();
|
|
|
|
protected:
|
|
explicit AbstractDataSource(QObject *parent = nullptr);
|
|
};
|
|
|
|
}
|