Fix warnings
Summary: Remove unused variables and members. We were often storing the q of classes without ever needing them. I'd just do it when it's useful. We do it in the private class so it can always be added, removes boilerplate code. Don't use std::move when returning temporary QImage. The compiler is smart enough to know to do it but produces the warning "moving a temporary object prevents copy elision". Remove unused lambda captured variables. Test Plan: Getting much cleaner build logs Reviewers: #frameworks, #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D28442
This commit is contained in:
parent
6d606ba393
commit
fb81fe7a10
14 changed files with 50 additions and 56 deletions
|
@ -37,7 +37,6 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
KWayland::Server::Display *m_display;
|
||||
KWayland::Server::CompositorInterface *m_compositorInterface;
|
||||
KWayland::Client::ConnectionThread *m_connection;
|
||||
KWayland::Client::Compositor *m_compositor;
|
||||
KWayland::Client::ShmPool *m_shmPool;
|
||||
|
@ -49,7 +48,6 @@ static const QString s_socketName = QStringLiteral("kwin-test-wayland-surface-0"
|
|||
TestShmPool::TestShmPool(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_display(nullptr)
|
||||
, m_compositorInterface(nullptr)
|
||||
, m_connection(nullptr)
|
||||
, m_compositor(nullptr)
|
||||
, m_shmPool(nullptr)
|
||||
|
|
|
@ -71,7 +71,6 @@ private:
|
|||
|
||||
QSignalSpy *m_announcedSpy;
|
||||
QSignalSpy *m_omSpy;
|
||||
QSignalSpy *m_configSpy;
|
||||
};
|
||||
|
||||
static const QString s_socketName = QStringLiteral("kwin-test-wayland-output-0");
|
||||
|
|
|
@ -879,7 +879,7 @@ void TestWaylandShell::testClientDisconnecting()
|
|||
QVERIFY(serverShellSurface2);
|
||||
|
||||
connect(serverShellSurface, &Resource::unbound, this,
|
||||
[serverShellSurface, serverShellSurface2] {
|
||||
[serverShellSurface2] {
|
||||
serverShellSurface2->requestSize(QSize(100, 200));
|
||||
}
|
||||
);
|
||||
|
|
|
@ -244,14 +244,14 @@ OutputInterface *Display::createOutput(QObject *parent)
|
|||
CompositorInterface *Display::createCompositor(QObject *parent)
|
||||
{
|
||||
CompositorInterface *compositor = new CompositorInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, compositor, [this,compositor] { delete compositor; });
|
||||
connect(this, &Display::aboutToTerminate, compositor, [compositor] { delete compositor; });
|
||||
return compositor;
|
||||
}
|
||||
|
||||
ShellInterface *Display::createShell(QObject *parent)
|
||||
{
|
||||
ShellInterface *shell = new ShellInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, shell, [this,shell] { delete shell; });
|
||||
connect(this, &Display::aboutToTerminate, shell, [shell] { delete shell; });
|
||||
return shell;
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ OutputDeviceInterface *Display::createOutputDevice(QObject *parent)
|
|||
OutputManagementInterface *Display::createOutputManagement(QObject *parent)
|
||||
{
|
||||
OutputManagementInterface *om = new OutputManagementInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, om, [this,om] { delete om; });
|
||||
connect(this, &Display::aboutToTerminate, om, [om] { delete om; });
|
||||
return om;
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ SeatInterface *Display::createSeat(QObject *parent)
|
|||
{
|
||||
SeatInterface *seat = new SeatInterface(this, parent);
|
||||
connect(seat, &QObject::destroyed, this, [this, seat] { d->seats.removeAll(seat); });
|
||||
connect(this, &Display::aboutToTerminate, seat, [this,seat] { delete seat; });
|
||||
connect(this, &Display::aboutToTerminate, seat, [seat] { delete seat; });
|
||||
d->seats << seat;
|
||||
return seat;
|
||||
}
|
||||
|
@ -283,91 +283,91 @@ SeatInterface *Display::createSeat(QObject *parent)
|
|||
SubCompositorInterface *Display::createSubCompositor(QObject *parent)
|
||||
{
|
||||
auto c = new SubCompositorInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, c, [this,c] { delete c; });
|
||||
connect(this, &Display::aboutToTerminate, c, [c] { delete c; });
|
||||
return c;
|
||||
}
|
||||
|
||||
DataDeviceManagerInterface *Display::createDataDeviceManager(QObject *parent)
|
||||
{
|
||||
auto m = new DataDeviceManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, m, [this,m] { delete m; });
|
||||
connect(this, &Display::aboutToTerminate, m, [m] { delete m; });
|
||||
return m;
|
||||
}
|
||||
|
||||
PlasmaShellInterface *Display::createPlasmaShell(QObject* parent)
|
||||
{
|
||||
auto s = new PlasmaShellInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, s, [this, s] { delete s; });
|
||||
connect(this, &Display::aboutToTerminate, s, [s] { delete s; });
|
||||
return s;
|
||||
}
|
||||
|
||||
PlasmaWindowManagementInterface *Display::createPlasmaWindowManagement(QObject *parent)
|
||||
{
|
||||
auto wm = new PlasmaWindowManagementInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, wm, [this, wm] { delete wm; });
|
||||
connect(this, &Display::aboutToTerminate, wm, [wm] { delete wm; });
|
||||
return wm;
|
||||
}
|
||||
|
||||
QtSurfaceExtensionInterface *Display::createQtSurfaceExtension(QObject *parent)
|
||||
{
|
||||
auto s = new QtSurfaceExtensionInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, s, [this, s] { delete s; });
|
||||
connect(this, &Display::aboutToTerminate, s, [s] { delete s; });
|
||||
return s;
|
||||
}
|
||||
|
||||
RemoteAccessManagerInterface *Display::createRemoteAccessManager(QObject *parent)
|
||||
{
|
||||
auto i = new RemoteAccessManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, i, [this, i] { delete i; });
|
||||
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
||||
return i;
|
||||
}
|
||||
|
||||
IdleInterface *Display::createIdle(QObject *parent)
|
||||
{
|
||||
auto i = new IdleInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, i, [this, i] { delete i; });
|
||||
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
||||
return i;
|
||||
}
|
||||
|
||||
FakeInputInterface *Display::createFakeInput(QObject *parent)
|
||||
{
|
||||
auto i = new FakeInputInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, i, [this, i] { delete i; });
|
||||
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
||||
return i;
|
||||
}
|
||||
|
||||
ShadowManagerInterface *Display::createShadowManager(QObject *parent)
|
||||
{
|
||||
auto s = new ShadowManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, s, [this, s] { delete s; });
|
||||
connect(this, &Display::aboutToTerminate, s, [s] { delete s; });
|
||||
return s;
|
||||
}
|
||||
|
||||
BlurManagerInterface *Display::createBlurManager(QObject *parent)
|
||||
{
|
||||
auto b = new BlurManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
ContrastManagerInterface *Display::createContrastManager(QObject *parent)
|
||||
{
|
||||
auto b = new ContrastManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
SlideManagerInterface *Display::createSlideManager(QObject *parent)
|
||||
{
|
||||
auto b = new SlideManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
DpmsManagerInterface *Display::createDpmsManager(QObject *parent)
|
||||
{
|
||||
auto d = new DpmsManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, d, [this, d] { delete d; });
|
||||
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ PointerConstraintsInterface *Display::createPointerConstraints(const PointerCons
|
|||
XdgForeignInterface *Display::createXdgForeignInterface(QObject *parent)
|
||||
{
|
||||
XdgForeignInterface *foreign = new XdgForeignInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, foreign, [this,foreign] { delete foreign; });
|
||||
connect(this, &Display::aboutToTerminate, foreign, [foreign] { delete foreign; });
|
||||
return foreign;
|
||||
}
|
||||
|
||||
|
@ -464,42 +464,42 @@ IdleInhibitManagerInterface *Display::createIdleInhibitManager(const IdleInhibit
|
|||
i = new IdleInhibitManagerUnstableV1Interface(this, parent);
|
||||
break;
|
||||
}
|
||||
connect(this, &Display::aboutToTerminate, i, [this,i] { delete i; });
|
||||
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
||||
return i;
|
||||
}
|
||||
|
||||
AppMenuManagerInterface *Display::createAppMenuManagerInterface(QObject *parent)
|
||||
{
|
||||
auto b = new AppMenuManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
ServerSideDecorationPaletteManagerInterface *Display::createServerSideDecorationPaletteManager(QObject *parent)
|
||||
{
|
||||
auto b = new ServerSideDecorationPaletteManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
LinuxDmabufUnstableV1Interface *Display::createLinuxDmabufInterface(QObject *parent)
|
||||
{
|
||||
auto b = new LinuxDmabufUnstableV1Interface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
PlasmaVirtualDesktopManagementInterface *Display::createPlasmaVirtualDesktopManagement(QObject *parent)
|
||||
{
|
||||
auto b = new PlasmaVirtualDesktopManagementInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
XdgOutputManagerInterface *Display::createXdgOutputManager(QObject *parent)
|
||||
{
|
||||
auto b = new XdgOutputManagerInterface(this, parent);
|
||||
connect(this, &Display::aboutToTerminate, b, [this, b] { delete b; });
|
||||
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,13 +53,10 @@ private:
|
|||
class FakeInputDevice::Private
|
||||
{
|
||||
public:
|
||||
Private(wl_resource *resource, FakeInputInterface *interface, FakeInputDevice *q);
|
||||
Private(wl_resource *resource, FakeInputInterface *interface);
|
||||
wl_resource *resource;
|
||||
FakeInputInterface *interface;
|
||||
bool authenticated = false;
|
||||
|
||||
private:
|
||||
FakeInputDevice *q;
|
||||
};
|
||||
|
||||
const quint32 FakeInputInterface::Private::s_version = 4;
|
||||
|
@ -280,16 +277,15 @@ FakeInputInterface::FakeInputInterface(Display *display, QObject *parent)
|
|||
|
||||
FakeInputInterface::~FakeInputInterface() = default;
|
||||
|
||||
FakeInputDevice::Private::Private(wl_resource *resource, FakeInputInterface *interface, FakeInputDevice *q)
|
||||
FakeInputDevice::Private::Private(wl_resource *resource, FakeInputInterface *interface)
|
||||
: resource(resource)
|
||||
, interface(interface)
|
||||
, q(q)
|
||||
{
|
||||
}
|
||||
|
||||
FakeInputDevice::FakeInputDevice(wl_resource *resource, FakeInputInterface *parent)
|
||||
: QObject(parent)
|
||||
, d(new Private(resource, parent, this))
|
||||
, d(new Private(resource, parent))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,8 @@ OutputInterface::OutputInterface(Display *display, QObject *parent)
|
|||
{
|
||||
Q_D();
|
||||
connect(this, &OutputInterface::currentModeChanged, this,
|
||||
[this, d] {
|
||||
[this] {
|
||||
Q_D();
|
||||
auto currentModeIt = std::find_if(d->modes.constBegin(), d->modes.constEnd(), [](const Mode &mode) { return mode.flags.testFlag(ModeFlag::Current); });
|
||||
if (currentModeIt == d->modes.constEnd()) {
|
||||
return;
|
||||
|
@ -126,12 +127,12 @@ OutputInterface::OutputInterface(Display *display, QObject *parent)
|
|||
wl_display_flush_clients(*(d->display));
|
||||
}
|
||||
);
|
||||
connect(this, &OutputInterface::subPixelChanged, this, [this, d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::transformChanged, this, [this, d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::globalPositionChanged, this, [this, d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::modelChanged, this, [this, d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::manufacturerChanged, this, [this, d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::scaleChanged, this, [this, d] { d->updateScale(); });
|
||||
connect(this, &OutputInterface::subPixelChanged, this, [d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::transformChanged, this, [d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::globalPositionChanged, this, [d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::modelChanged, this, [d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::manufacturerChanged, this, [d] { d->updateGeometry(); });
|
||||
connect(this, &OutputInterface::scaleChanged, this, [d] { d->updateScale(); });
|
||||
}
|
||||
|
||||
OutputInterface::~OutputInterface() = default;
|
||||
|
|
|
@ -42,7 +42,6 @@ private:
|
|||
return reinterpret_cast<Private*>(wl_resource_get_user_data(resource));
|
||||
}
|
||||
|
||||
wl_listener listener;
|
||||
static const struct org_kde_plasma_virtual_desktop_interface s_interface;
|
||||
};
|
||||
|
||||
|
|
|
@ -110,7 +110,6 @@ private:
|
|||
QIcon m_icon;
|
||||
quint32 m_virtualDesktop = 0;
|
||||
quint32 m_state = 0;
|
||||
wl_listener listener;
|
||||
static const struct org_kde_plasma_window_interface s_interface;
|
||||
};
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ QImage::Format BufferInterface::Private::format() const
|
|||
|
||||
QImage BufferInterface::data()
|
||||
{
|
||||
return std::move(d->createImage());
|
||||
return d->createImage();
|
||||
}
|
||||
|
||||
QImage BufferInterface::Private::createImage()
|
||||
|
@ -283,12 +283,12 @@ QImage BufferInterface::Private::createImage()
|
|||
s_accessedBuffer = this;
|
||||
s_accessCounter++;
|
||||
wl_shm_buffer_begin_access(shmBuffer);
|
||||
return std::move(QImage((const uchar*)wl_shm_buffer_get_data(shmBuffer),
|
||||
size.width(),
|
||||
size.height(),
|
||||
wl_shm_buffer_get_stride(shmBuffer),
|
||||
imageFormat,
|
||||
&imageBufferCleanupHandler, this));
|
||||
return QImage((const uchar*)wl_shm_buffer_get_data(shmBuffer),
|
||||
size.width(),
|
||||
size.height(),
|
||||
wl_shm_buffer_get_stride(shmBuffer),
|
||||
imageFormat,
|
||||
&imageBufferCleanupHandler, this);
|
||||
}
|
||||
|
||||
bool BufferInterface::isReferenced() const
|
||||
|
|
|
@ -48,8 +48,8 @@ void EglStreamControllerInterface::Private::attachStreamConsumerAttribs(wl_clien
|
|||
EglStreamControllerInterface::Private::Private(EglStreamControllerInterface *q, Display *display)
|
||||
// libnvidia-egl-wayland.so.1 may not be present on all systems, so we load it dynamically
|
||||
: Global::Private(display,
|
||||
(wl_interface *)QLibrary::resolve(QLatin1String("libnvidia-egl-wayland.so.1"),
|
||||
"wl_eglstream_controller_interface"),
|
||||
reinterpret_cast<wl_interface *>(QLibrary::resolve(QLatin1String("libnvidia-egl-wayland.so.1"),
|
||||
"wl_eglstream_controller_interface")),
|
||||
s_version)
|
||||
, q(q)
|
||||
{
|
||||
|
|
|
@ -376,7 +376,7 @@ void TextInputManagerUnstableV0Interface::Private::createTextInputCallback(wl_cl
|
|||
}
|
||||
);
|
||||
QObject::connect(t, &TextInputUnstableV0Interface::requestActivate, m->q,
|
||||
[t, m] (SeatInterface *seat) {
|
||||
[t] (SeatInterface *seat) {
|
||||
// TODO: disallow for other seat
|
||||
seat->d_func()->registerTextInput(t);
|
||||
t->d_func()->seat = seat;
|
||||
|
|
|
@ -123,7 +123,7 @@ void ShadowTest::setupShadow()
|
|||
Shadow *shadow = m_shadowManager->createShadow(m_surface, this);
|
||||
Q_ASSERT(shadow);
|
||||
|
||||
auto addElement = [shadow, this](const QColor color) {
|
||||
auto addElement = [this] (const QColor color) {
|
||||
const QSize size = QSize(10, 10);
|
||||
auto buffer = m_shm->getBuffer(size, size.width() * 4).toStrongRef();
|
||||
buffer->setUsed(true);
|
||||
|
|
|
@ -128,7 +128,7 @@ void WaylandClientTest::setupRegistry(Registry *registry)
|
|||
}
|
||||
Keyboard *k = s->createKeyboard(this);
|
||||
connect(k, &Keyboard::keyChanged, this,
|
||||
[this](quint32 key, Keyboard::KeyState state) {
|
||||
[] (quint32 key, Keyboard::KeyState state) {
|
||||
if (key == KEY_Q && state == Keyboard::KeyState::Released) {
|
||||
QCoreApplication::instance()->quit();
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ void XdgForeignTest::setupRegistry(Registry *registry)
|
|||
m_surface = m_compositor->createSurface(this);
|
||||
Q_ASSERT(m_surface);
|
||||
auto parentDeco = m_decoration->create(m_surface, this);
|
||||
Q_UNUSED(parentDeco)
|
||||
m_shellSurface = m_shell->createSurface(m_surface, this);
|
||||
Q_ASSERT(m_shellSurface);
|
||||
connect(m_shellSurface, &XdgShellSurface::sizeChanged, this, &XdgForeignTest::render);
|
||||
|
@ -137,6 +138,7 @@ void XdgForeignTest::setupRegistry(Registry *registry)
|
|||
m_childSurface = m_compositor->createSurface(this);
|
||||
Q_ASSERT(m_childSurface);
|
||||
auto childDeco = m_decoration->create(m_childSurface, this);
|
||||
Q_UNUSED(childDeco)
|
||||
m_childShellSurface = m_shell->createSurface(m_childSurface, this);
|
||||
Q_ASSERT(m_childShellSurface);
|
||||
connect(m_childShellSurface, &XdgShellSurface::sizeChanged, this, &XdgForeignTest::render);
|
||||
|
|
Loading…
Reference in a new issue