kwin/src/placeholderinputeventfilter.cpp
David Edmundson 99caa54901 core: Introduce explicit weight to InputEventFilter
This is problematic as it means anything requiring a fixed position
in the chain cannot be added or removed at runtime. This is bad for both
performance and code cleanliness as all code ends up input.cpp rather than
where it semantically belongs.

Remaining users that prepend event filters have the problem of the order
being effectively undefined.

This patch adds a weight attribute to the filter allowing filters to be
installed and removed at runtime whilst maintaining a specific deterministic
order.

Currently the order is defined by an enum based on the filter names.
This gives an easy to read explicit order for anyone reading kwin code, but
it is left cast to an int so we have future flexibility.
2024-08-01 08:46:06 +00:00

50 lines
1 KiB
C++

/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "placeholderinputeventfilter.h"
namespace KWin
{
PlaceholderInputEventFilter::PlaceholderInputEventFilter()
: InputEventFilter(InputFilterOrder::PlaceholderOutput)
{
}
bool PlaceholderInputEventFilter::pointerEvent(MouseEvent *event, quint32 nativeButton)
{
return true;
}
bool PlaceholderInputEventFilter::wheelEvent(WheelEvent *event)
{
return true;
}
bool PlaceholderInputEventFilter::keyEvent(KeyEvent *event)
{
return true;
}
bool PlaceholderInputEventFilter::touchDown(qint32 id, const QPointF &pos, std::chrono::microseconds time)
{
return true;
}
bool PlaceholderInputEventFilter::touchMotion(qint32 id, const QPointF &pos, std::chrono::microseconds time)
{
return true;
}
bool PlaceholderInputEventFilter::touchUp(qint32 id, std::chrono::microseconds time)
{
return true;
}
}