wayland: FakeInputDevice -> FakeInputDeviceInterface
This is to avoid conflicting with KWin::FakeInputDevice
This commit is contained in:
parent
43eceba9ce
commit
6ac4012827
7 changed files with 71 additions and 71 deletions
|
@ -18,11 +18,11 @@ FakeInputBackend::~FakeInputBackend() = default;
|
|||
void FakeInputBackend::initialize()
|
||||
{
|
||||
m_interface = std::make_unique<KWaylandServer::FakeInputInterface>(waylandServer()->display());
|
||||
connect(m_interface.get(), &KWaylandServer::FakeInputInterface::deviceCreated, this, [this](KWaylandServer::FakeInputDevice *fakeDevice) {
|
||||
connect(m_interface.get(), &KWaylandServer::FakeInputInterface::deviceCreated, this, [this](KWaylandServer::FakeInputDeviceInterface *fakeDevice) {
|
||||
m_devices[fakeDevice] = std::make_unique<FakeInputDevice>(fakeDevice);
|
||||
Q_EMIT deviceAdded(m_devices[fakeDevice].get());
|
||||
});
|
||||
connect(m_interface.get(), &KWaylandServer::FakeInputInterface::deviceDestroyed, this, [this](KWaylandServer::FakeInputDevice *fakeDevice) {
|
||||
connect(m_interface.get(), &KWaylandServer::FakeInputInterface::deviceDestroyed, this, [this](KWaylandServer::FakeInputDeviceInterface *fakeDevice) {
|
||||
auto it = m_devices.find(fakeDevice);
|
||||
if (it != m_devices.end()) {
|
||||
const std::unique_ptr<FakeInputDevice> device = std::move(it->second);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace KWaylandServer
|
||||
{
|
||||
class FakeInputInterface;
|
||||
class FakeInputDevice;
|
||||
class FakeInputDeviceInterface;
|
||||
}
|
||||
|
||||
namespace KWin
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
private:
|
||||
std::unique_ptr<KWaylandServer::FakeInputInterface> m_interface;
|
||||
std::map<KWaylandServer::FakeInputDevice *, std::unique_ptr<FakeInputDevice>> m_devices;
|
||||
std::map<KWaylandServer::FakeInputDeviceInterface *, std::unique_ptr<FakeInputDevice>> m_devices;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -11,35 +11,35 @@ namespace KWin
|
|||
{
|
||||
static int s_lastDeviceId = 0;
|
||||
|
||||
FakeInputDevice::FakeInputDevice(KWaylandServer::FakeInputDevice *device, QObject *parent)
|
||||
FakeInputDevice::FakeInputDevice(KWaylandServer::FakeInputDeviceInterface *device, QObject *parent)
|
||||
: InputDevice(parent)
|
||||
, m_name(QStringLiteral("Fake Input Device %1").arg(++s_lastDeviceId))
|
||||
{
|
||||
connect(device, &KWaylandServer::FakeInputDevice::authenticationRequested, this, [device](const QString &application, const QString &reason) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::authenticationRequested, this, [device](const QString &application, const QString &reason) {
|
||||
// TODO: make secure
|
||||
device->setAuthentication(true);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::pointerMotionRequested, this, [this](const QPointF &delta) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::pointerMotionRequested, this, [this](const QPointF &delta) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT pointerMotion(delta, delta, time, this);
|
||||
Q_EMIT pointerFrame(this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::pointerMotionAbsoluteRequested, this, [this](const QPointF &pos) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::pointerMotionAbsoluteRequested, this, [this](const QPointF &pos) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT pointerMotionAbsolute(pos, time, this);
|
||||
Q_EMIT pointerFrame(this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::pointerButtonPressRequested, this, [this](quint32 button) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::pointerButtonPressRequested, this, [this](quint32 button) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT pointerButtonChanged(button, InputRedirection::PointerButtonPressed, time, this);
|
||||
Q_EMIT pointerFrame(this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::pointerButtonReleaseRequested, this, [this](quint32 button) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::pointerButtonReleaseRequested, this, [this](quint32 button) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT pointerButtonChanged(button, InputRedirection::PointerButtonReleased, time, this);
|
||||
Q_EMIT pointerFrame(this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::pointerAxisRequested, this, [this](Qt::Orientation orientation, qreal delta) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::pointerAxisRequested, this, [this](Qt::Orientation orientation, qreal delta) {
|
||||
InputRedirection::PointerAxis axis;
|
||||
switch (orientation) {
|
||||
case Qt::Horizontal:
|
||||
|
@ -56,29 +56,29 @@ FakeInputDevice::FakeInputDevice(KWaylandServer::FakeInputDevice *device, QObjec
|
|||
Q_EMIT pointerAxisChanged(axis, delta, 0, InputRedirection::PointerAxisSourceUnknown, time, this);
|
||||
Q_EMIT pointerFrame(this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::touchDownRequested, this, [this](qint32 id, const QPointF &pos) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::touchDownRequested, this, [this](qint32 id, const QPointF &pos) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT touchDown(id, pos, time, this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::touchMotionRequested, this, [this](qint32 id, const QPointF &pos) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::touchMotionRequested, this, [this](qint32 id, const QPointF &pos) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT touchMotion(id, pos, time, this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::touchUpRequested, this, [this](qint32 id) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::touchUpRequested, this, [this](qint32 id) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT touchUp(id, time, this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::touchCancelRequested, this, [this]() {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::touchCancelRequested, this, [this]() {
|
||||
Q_EMIT touchCanceled(this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::touchFrameRequested, this, [this]() {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::touchFrameRequested, this, [this]() {
|
||||
Q_EMIT touchFrame(this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::keyboardKeyPressRequested, this, [this](quint32 button) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::keyboardKeyPressRequested, this, [this](quint32 button) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT keyChanged(button, InputRedirection::KeyboardKeyPressed, time, this);
|
||||
});
|
||||
connect(device, &KWaylandServer::FakeInputDevice::keyboardKeyReleaseRequested, this, [this](quint32 button) {
|
||||
connect(device, &KWaylandServer::FakeInputDeviceInterface::keyboardKeyReleaseRequested, this, [this](quint32 button) {
|
||||
const auto time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
Q_EMIT keyChanged(button, InputRedirection::KeyboardKeyReleased, time, this);
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class FakeInputDevice;
|
||||
class FakeInputDeviceInterface;
|
||||
}
|
||||
|
||||
namespace KWin
|
||||
|
@ -21,7 +21,7 @@ class KWIN_EXPORT FakeInputDevice : public InputDevice
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FakeInputDevice(KWaylandServer::FakeInputDevice *device, QObject *parent = nullptr);
|
||||
explicit FakeInputDevice(KWaylandServer::FakeInputDeviceInterface *device, QObject *parent = nullptr);
|
||||
|
||||
QString sysName() const override;
|
||||
QString name() const override;
|
||||
|
|
|
@ -44,7 +44,7 @@ private Q_SLOTS:
|
|||
private:
|
||||
KWaylandServer::Display *m_display = nullptr;
|
||||
FakeInputInterface *m_fakeInputInterface = nullptr;
|
||||
FakeInputDevice *m_device = nullptr;
|
||||
FakeInputDeviceInterface *m_device = nullptr;
|
||||
KWayland::Client::ConnectionThread *m_connection = nullptr;
|
||||
QThread *m_thread = nullptr;
|
||||
KWayland::Client::EventQueue *m_queue = nullptr;
|
||||
|
@ -92,7 +92,7 @@ void FakeInputTest::init()
|
|||
QVERIFY(m_fakeInput->isValid());
|
||||
|
||||
QVERIFY(deviceCreatedSpy.wait());
|
||||
m_device = deviceCreatedSpy.first().first().value<FakeInputDevice *>();
|
||||
m_device = deviceCreatedSpy.first().first().value<FakeInputDeviceInterface *>();
|
||||
QVERIFY(m_device);
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ void FakeInputTest::testAuthenticate()
|
|||
{
|
||||
// this test verifies that an authenticate request is passed to the Server
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy authenticationRequestedSpy(m_device, &FakeInputDevice::authenticationRequested);
|
||||
QSignalSpy authenticationRequestedSpy(m_device, &FakeInputDeviceInterface::authenticationRequested);
|
||||
|
||||
m_fakeInput->authenticate(QStringLiteral("test-case"), QStringLiteral("to test"));
|
||||
QVERIFY(authenticationRequestedSpy.wait());
|
||||
|
@ -142,7 +142,7 @@ void FakeInputTest::testMotion()
|
|||
{
|
||||
// this test verifies that motion is properly passed to the server
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy motionSpy(m_device, &FakeInputDevice::pointerMotionRequested);
|
||||
QSignalSpy motionSpy(m_device, &FakeInputDeviceInterface::pointerMotionRequested);
|
||||
|
||||
// without an authentication we shouldn't get the signals
|
||||
m_fakeInput->requestPointerMove(QSizeF(1, 2));
|
||||
|
@ -166,7 +166,7 @@ void FakeInputTest::testMotionAbsolute()
|
|||
{
|
||||
// this test verifies that motion is properly passed to the server
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy motionSpy(m_device, &FakeInputDevice::pointerMotionAbsoluteRequested);
|
||||
QSignalSpy motionSpy(m_device, &FakeInputDeviceInterface::pointerMotionAbsoluteRequested);
|
||||
|
||||
// without an authentication we shouldn't get the signals
|
||||
m_fakeInput->requestPointerMoveAbsolute(QPointF(1, 2));
|
||||
|
@ -200,8 +200,8 @@ void FakeInputTest::testPointerButtonQt()
|
|||
{
|
||||
// this test verifies that pointer button events are properly passed to the server with Qt button codes
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy pressedSpy(m_device, &FakeInputDevice::pointerButtonPressRequested);
|
||||
QSignalSpy releasedSpy(m_device, &FakeInputDevice::pointerButtonReleaseRequested);
|
||||
QSignalSpy pressedSpy(m_device, &FakeInputDeviceInterface::pointerButtonPressRequested);
|
||||
QSignalSpy releasedSpy(m_device, &FakeInputDeviceInterface::pointerButtonReleaseRequested);
|
||||
|
||||
// without an authentication we shouldn't get the signals
|
||||
QFETCH(Qt::MouseButton, qtButton);
|
||||
|
@ -252,8 +252,8 @@ void FakeInputTest::testPointerButtonLinux()
|
|||
{
|
||||
// this test verifies that pointer button events are properly passed to the server with Qt button codes
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy pressedSpy(m_device, &FakeInputDevice::pointerButtonPressRequested);
|
||||
QSignalSpy releasedSpy(m_device, &FakeInputDevice::pointerButtonReleaseRequested);
|
||||
QSignalSpy pressedSpy(m_device, &FakeInputDeviceInterface::pointerButtonPressRequested);
|
||||
QSignalSpy releasedSpy(m_device, &FakeInputDeviceInterface::pointerButtonReleaseRequested);
|
||||
|
||||
// without an authentication we shouldn't get the signals
|
||||
QFETCH(quint32, linuxButton);
|
||||
|
@ -301,7 +301,7 @@ void FakeInputTest::testAxis()
|
|||
{
|
||||
// this test verifies that pointer axis events are properly passed to the server
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy axisSpy(m_device, &FakeInputDevice::pointerAxisRequested);
|
||||
QSignalSpy axisSpy(m_device, &FakeInputDeviceInterface::pointerAxisRequested);
|
||||
|
||||
QFETCH(Qt::Orientation, orientation);
|
||||
QFETCH(qreal, delta);
|
||||
|
@ -323,11 +323,11 @@ void FakeInputTest::testAxis()
|
|||
void FakeInputTest::testTouch()
|
||||
{
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy touchDownSpy(m_device, &FakeInputDevice::touchDownRequested);
|
||||
QSignalSpy touchMotionSpy(m_device, &FakeInputDevice::touchMotionRequested);
|
||||
QSignalSpy touchUpSpy(m_device, &FakeInputDevice::touchUpRequested);
|
||||
QSignalSpy touchFrameSpy(m_device, &FakeInputDevice::touchFrameRequested);
|
||||
QSignalSpy touchCancelSpy(m_device, &FakeInputDevice::touchCancelRequested);
|
||||
QSignalSpy touchDownSpy(m_device, &FakeInputDeviceInterface::touchDownRequested);
|
||||
QSignalSpy touchMotionSpy(m_device, &FakeInputDeviceInterface::touchMotionRequested);
|
||||
QSignalSpy touchUpSpy(m_device, &FakeInputDeviceInterface::touchUpRequested);
|
||||
QSignalSpy touchFrameSpy(m_device, &FakeInputDeviceInterface::touchFrameRequested);
|
||||
QSignalSpy touchCancelSpy(m_device, &FakeInputDeviceInterface::touchCancelRequested);
|
||||
|
||||
// without an authentication we shouldn't get the signals
|
||||
m_fakeInput->requestTouchDown(0, QPointF(1, 2));
|
||||
|
@ -408,8 +408,8 @@ void FakeInputTest::testKeyboardKeyLinux()
|
|||
{
|
||||
// this test verifies that keyboard key events are properly passed to the server with Qt button codes
|
||||
QVERIFY(!m_device->isAuthenticated());
|
||||
QSignalSpy pressedSpy(m_device, &FakeInputDevice::keyboardKeyPressRequested);
|
||||
QSignalSpy releasedSpy(m_device, &FakeInputDevice::keyboardKeyReleaseRequested);
|
||||
QSignalSpy pressedSpy(m_device, &FakeInputDeviceInterface::keyboardKeyPressRequested);
|
||||
QSignalSpy releasedSpy(m_device, &FakeInputDeviceInterface::keyboardKeyReleaseRequested);
|
||||
|
||||
// without an authentication we shouldn't get the signals
|
||||
QFETCH(quint32, linuxKey);
|
||||
|
|
|
@ -21,10 +21,10 @@ class FakeInputInterfacePrivate : public QtWaylandServer::org_kde_kwin_fake_inpu
|
|||
{
|
||||
public:
|
||||
FakeInputInterfacePrivate(FakeInputInterface *_q, Display *display);
|
||||
std::map<wl_resource *, std::unique_ptr<FakeInputDevice>> devices;
|
||||
std::map<wl_resource *, std::unique_ptr<FakeInputDeviceInterface>> devices;
|
||||
|
||||
private:
|
||||
FakeInputDevice *device(wl_resource *r);
|
||||
FakeInputDeviceInterface *device(wl_resource *r);
|
||||
|
||||
FakeInputInterface *q;
|
||||
static QList<quint32> touchIds;
|
||||
|
@ -62,8 +62,8 @@ FakeInputInterface::~FakeInputInterface() = default;
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_bind_resource(Resource *resource)
|
||||
{
|
||||
auto device = new FakeInputDevice(q, resource->handle);
|
||||
devices[resource->handle] = std::unique_ptr<FakeInputDevice>(device);
|
||||
auto device = new FakeInputDeviceInterface(q, resource->handle);
|
||||
devices[resource->handle] = std::unique_ptr<FakeInputDeviceInterface>(device);
|
||||
Q_EMIT q->deviceCreated(device);
|
||||
}
|
||||
|
||||
|
@ -77,14 +77,14 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_destroy_resource(Resourc
|
|||
}
|
||||
}
|
||||
|
||||
FakeInputDevice *FakeInputInterfacePrivate::device(wl_resource *r)
|
||||
FakeInputDeviceInterface *FakeInputInterfacePrivate::device(wl_resource *r)
|
||||
{
|
||||
return devices[r].get();
|
||||
}
|
||||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_authenticate(Resource *resource, const QString &application, const QString &reason)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d) {
|
||||
return;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_authenticate(Resource *r
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_pointer_motion(Resource *resource, wl_fixed_t delta_x, wl_fixed_t delta_y)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_pointer_motion(Resource
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_button(Resource *resource, uint32_t button, uint32_t state)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_button(Resource *resourc
|
|||
}
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_axis(Resource *resource, uint32_t axis, wl_fixed_t value)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_axis(Resource *resource,
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_down(Resource *resource, uint32_t id, wl_fixed_t x, wl_fixed_t y)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_down(Resource *res
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_motion(Resource *resource, uint32_t id, wl_fixed_t x, wl_fixed_t y)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_motion(Resource *r
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_up(Resource *resource, uint32_t id)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_up(Resource *resou
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_cancel(Resource *resource)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_cancel(Resource *r
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_frame(Resource *resource)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_touch_frame(Resource *re
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_pointer_motion_absolute(Resource *resource, wl_fixed_t x, wl_fixed_t y)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_pointer_motion_absolute(
|
|||
|
||||
void FakeInputInterfacePrivate::org_kde_kwin_fake_input_keyboard_key(Resource *resource, uint32_t button, uint32_t state)
|
||||
{
|
||||
FakeInputDevice *d = device(resource->handle);
|
||||
FakeInputDeviceInterface *d = device(resource->handle);
|
||||
if (!d || !d->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -224,39 +224,39 @@ void FakeInputInterfacePrivate::org_kde_kwin_fake_input_keyboard_key(Resource *r
|
|||
}
|
||||
}
|
||||
|
||||
class FakeInputDevicePrivate
|
||||
class FakeInputDeviceInterfacePrivate
|
||||
{
|
||||
public:
|
||||
FakeInputDevicePrivate(FakeInputInterface *interface, wl_resource *resource);
|
||||
FakeInputDeviceInterfacePrivate(FakeInputInterface *interface, wl_resource *resource);
|
||||
wl_resource *resource;
|
||||
FakeInputInterface *interface;
|
||||
bool authenticated = false;
|
||||
};
|
||||
|
||||
FakeInputDevicePrivate::FakeInputDevicePrivate(FakeInputInterface *interface, wl_resource *resource)
|
||||
FakeInputDeviceInterfacePrivate::FakeInputDeviceInterfacePrivate(FakeInputInterface *interface, wl_resource *resource)
|
||||
: resource(resource)
|
||||
, interface(interface)
|
||||
{
|
||||
}
|
||||
|
||||
FakeInputDevice::FakeInputDevice(FakeInputInterface *parent, wl_resource *resource)
|
||||
: d(std::make_unique<FakeInputDevicePrivate>(parent, resource))
|
||||
FakeInputDeviceInterface::FakeInputDeviceInterface(FakeInputInterface *parent, wl_resource *resource)
|
||||
: d(std::make_unique<FakeInputDeviceInterfacePrivate>(parent, resource))
|
||||
{
|
||||
}
|
||||
|
||||
FakeInputDevice::~FakeInputDevice() = default;
|
||||
FakeInputDeviceInterface::~FakeInputDeviceInterface() = default;
|
||||
|
||||
void FakeInputDevice::setAuthentication(bool authenticated)
|
||||
void FakeInputDeviceInterface::setAuthentication(bool authenticated)
|
||||
{
|
||||
d->authenticated = authenticated;
|
||||
}
|
||||
|
||||
wl_resource *FakeInputDevice::resource()
|
||||
wl_resource *FakeInputDeviceInterface::resource()
|
||||
{
|
||||
return d->resource;
|
||||
}
|
||||
|
||||
bool FakeInputDevice::isAuthenticated() const
|
||||
bool FakeInputDeviceInterface::isAuthenticated() const
|
||||
{
|
||||
return d->authenticated;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ struct wl_resource;
|
|||
namespace KWaylandServer
|
||||
{
|
||||
class Display;
|
||||
class FakeInputDevice;
|
||||
class FakeInputDevicePrivate;
|
||||
class FakeInputDeviceInterface;
|
||||
class FakeInputDeviceInterfacePrivate;
|
||||
class FakeInputInterfacePrivate;
|
||||
|
||||
/**
|
||||
|
@ -49,9 +49,9 @@ Q_SIGNALS:
|
|||
* Signal emitted whenever a client bound the fake input @p device.
|
||||
* @param device The created FakeInputDevice
|
||||
*/
|
||||
void deviceCreated(KWaylandServer::FakeInputDevice *device);
|
||||
void deviceCreated(KWaylandServer::FakeInputDeviceInterface *device);
|
||||
|
||||
void deviceDestroyed(KWaylandServer::FakeInputDevice *device);
|
||||
void deviceDestroyed(KWaylandServer::FakeInputDeviceInterface *device);
|
||||
|
||||
private:
|
||||
std::unique_ptr<FakeInputInterfacePrivate> d;
|
||||
|
@ -62,11 +62,11 @@ private:
|
|||
*
|
||||
* @see FakeInputInterface
|
||||
*/
|
||||
class KWIN_EXPORT FakeInputDevice : public QObject
|
||||
class KWIN_EXPORT FakeInputDeviceInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
~FakeInputDevice() override;
|
||||
~FakeInputDeviceInterface() override;
|
||||
/**
|
||||
* @returns the native wl_resource.
|
||||
*/
|
||||
|
@ -147,10 +147,10 @@ Q_SIGNALS:
|
|||
|
||||
private:
|
||||
friend class FakeInputInterfacePrivate;
|
||||
FakeInputDevice(FakeInputInterface *parent, wl_resource *resource);
|
||||
std::unique_ptr<FakeInputDevicePrivate> d;
|
||||
FakeInputDeviceInterface(FakeInputInterface *parent, wl_resource *resource);
|
||||
std::unique_ptr<FakeInputDeviceInterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(KWaylandServer::FakeInputDevice *)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::FakeInputDeviceInterface *)
|
||||
|
|
Loading…
Reference in a new issue