Simulate user activity on fake input events

Summary:
This ensures that using KDE Connect to control input properly inhibits
idle timeouts.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9555
icc-effect-5.14.5
Martin Flöser 2017-12-29 18:29:19 +01:00
parent 04dbafd75e
commit b002b27903
3 changed files with 21 additions and 3 deletions

View File

@ -1589,18 +1589,21 @@ void InputRedirection::setupWorkspace()
[this] (const QSizeF &delta) {
// TODO: Fix time
m_pointer->processMotion(globalPointer() + QPointF(delta.width(), delta.height()), 0);
waylandServer()->simulateUserActivity();
}
);
connect(device, &FakeInputDevice::pointerButtonPressRequested, this,
[this] (quint32 button) {
// TODO: Fix time
m_pointer->processButton(button, InputRedirection::PointerButtonPressed, 0);
waylandServer()->simulateUserActivity();
}
);
connect(device, &FakeInputDevice::pointerButtonReleaseRequested, this,
[this] (quint32 button) {
// TODO: Fix time
m_pointer->processButton(button, InputRedirection::PointerButtonReleased, 0);
waylandServer()->simulateUserActivity();
}
);
connect(device, &FakeInputDevice::pointerAxisRequested, this,
@ -1620,24 +1623,28 @@ void InputRedirection::setupWorkspace()
}
// TODO: Fix time
m_pointer->processAxis(axis, delta, 0);
waylandServer()->simulateUserActivity();
}
);
connect(device, &FakeInputDevice::touchDownRequested, this,
[this] (quint32 id, const QPointF &pos) {
// TODO: Fix time
m_touch->processDown(id, pos, 0);
waylandServer()->simulateUserActivity();
}
);
connect(device, &FakeInputDevice::touchMotionRequested, this,
[this] (quint32 id, const QPointF &pos) {
// TODO: Fix time
m_touch->processMotion(id, pos, 0);
waylandServer()->simulateUserActivity();
}
);
connect(device, &FakeInputDevice::touchUpRequested, this,
[this] (quint32 id) {
// TODO: Fix time
m_touch->processUp(id, 0);
waylandServer()->simulateUserActivity();
}
);
connect(device, &FakeInputDevice::touchCancelRequested, this,

View File

@ -249,9 +249,9 @@ bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
}
}
);
auto idle = m_display->createIdle(m_display);
idle->create();
auto idleInhibition = new IdleInhibition(idle);
m_idle = m_display->createIdle(m_display);
m_idle->create();
auto idleInhibition = new IdleInhibition(m_idle);
connect(this, &WaylandServer::shellClientAdded, idleInhibition, &IdleInhibition::registerShellClient);
m_display->createIdleInhibitManager(IdleInhibitManagerInterfaceVersion::UnstableV1, m_display)->create();
m_plasmaShell = m_display->createPlasmaShell(m_display);
@ -749,4 +749,11 @@ bool WaylandServer::hasScreenLockerIntegration() const
return !m_initFlags.testFlag(InitalizationFlag::NoLockScreenIntegration);
}
void WaylandServer::simulateUserActivity()
{
if (m_idle) {
m_idle->simulateUserActivity();
}
}
}

View File

@ -45,6 +45,7 @@ class ClientConnection;
class CompositorInterface;
class Display;
class DataDeviceInterface;
class IdleInterface;
class ShellInterface;
class SeatInterface;
class ServerSideDecorationManagerInterface;
@ -192,6 +193,8 @@ public:
**/
SocketPairConnection createConnection();
void simulateUserActivity();
Q_SIGNALS:
void shellClientAdded(KWin::ShellClient*);
void shellClientRemoved(KWin::ShellClient*);
@ -223,6 +226,7 @@ private:
KWayland::Server::OutputManagementInterface *m_outputManagement = nullptr;
KWayland::Server::AppMenuManagerInterface *m_appMenuManager = nullptr;
KWayland::Server::ServerSideDecorationPaletteManagerInterface *m_paletteManager = nullptr;
KWayland::Server::IdleInterface *m_idle = nullptr;
struct {
KWayland::Server::ClientConnection *client = nullptr;
QMetaObject::Connection destroyConnection;