wayland: Link statically against KIdleTime integration plugin
The main motivation behind this change is to improve startup time. The Poller class was renamed to avoid potential name conflicts in the future.
This commit is contained in:
parent
f3a902911a
commit
0dd2f787ae
7 changed files with 24 additions and 31 deletions
|
@ -831,6 +831,7 @@ target_link_libraries(kwin_wayland
|
|||
KWinQpaPlugin
|
||||
KF5GlobalAccelPrivateKWin
|
||||
KF5WindowSystemKWinPrivatePlugin
|
||||
KF5IdleTimeKWinWaylandPrivatePlugin
|
||||
)
|
||||
|
||||
########### install files ###############
|
||||
|
|
|
@ -35,6 +35,7 @@ target_link_libraries(KWinIntegrationTestFramework
|
|||
KWinQpaPlugin
|
||||
KF5GlobalAccelPrivateKWin
|
||||
KF5WindowSystemKWinPrivatePlugin
|
||||
KF5IdleTimeKWinWaylandPrivatePlugin
|
||||
)
|
||||
|
||||
function(integrationTest)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
Q_IMPORT_PLUGIN(KWinIntegrationPlugin)
|
||||
Q_IMPORT_PLUGIN(KGlobalAccelImpl)
|
||||
Q_IMPORT_PLUGIN(KWindowSystemKWinPlugin)
|
||||
Q_IMPORT_PLUGIN(KWinIdleTimePoller)
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
Q_IMPORT_PLUGIN(KWinIntegrationPlugin)
|
||||
Q_IMPORT_PLUGIN(KGlobalAccelImpl)
|
||||
Q_IMPORT_PLUGIN(KWindowSystemKWinPlugin)
|
||||
Q_IMPORT_PLUGIN(KWinIdleTimePoller)
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
|
|
@ -2,17 +2,6 @@ set(idletime_plugin_SRCS
|
|||
poller.cpp
|
||||
)
|
||||
|
||||
add_library(KF5IdleTimeKWinWaylandPrivatePlugin MODULE ${idletime_plugin_SRCS})
|
||||
set_target_properties(KF5IdleTimeKWinWaylandPrivatePlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf5/org.kde.kidletime.platforms/")
|
||||
target_link_libraries(KF5IdleTimeKWinWaylandPrivatePlugin
|
||||
KF5::IdleTime
|
||||
KF5::WaylandClient
|
||||
kwin
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
KF5IdleTimeKWinWaylandPrivatePlugin
|
||||
DESTINATION
|
||||
${PLUGIN_INSTALL_DIR}/kf5/org.kde.kidletime.platforms/
|
||||
)
|
||||
add_library(KF5IdleTimeKWinWaylandPrivatePlugin OBJECT ${idletime_plugin_SRCS})
|
||||
target_compile_definitions(KF5IdleTimeKWinWaylandPrivatePlugin PRIVATE QT_STATICPLUGIN)
|
||||
target_link_libraries(KF5IdleTimeKWinWaylandPrivatePlugin KF5::IdleTime KF5::WaylandClient kwin)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
|
||||
Poller::Poller(QObject *parent)
|
||||
KWinIdleTimePoller::KWinIdleTimePoller(QObject *parent)
|
||||
: AbstractSystemPoller(parent)
|
||||
{
|
||||
connect(KWin::waylandServer(), &KWin::WaylandServer::terminatingInternalClientConnection, this,
|
||||
|
@ -28,14 +28,14 @@ Poller::Poller(QObject *parent)
|
|||
);
|
||||
}
|
||||
|
||||
Poller::~Poller() = default;
|
||||
KWinIdleTimePoller::~KWinIdleTimePoller() = default;
|
||||
|
||||
bool Poller::isAvailable()
|
||||
bool KWinIdleTimePoller::isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Poller::setUpPoller()
|
||||
bool KWinIdleTimePoller::setUpPoller()
|
||||
{
|
||||
auto registry = KWin::waylandServer()->internalClientRegistry();
|
||||
if (!m_seat) {
|
||||
|
@ -49,11 +49,11 @@ bool Poller::setUpPoller()
|
|||
return m_seat->isValid() && m_idle->isValid();
|
||||
}
|
||||
|
||||
void Poller::unloadPoller()
|
||||
void KWinIdleTimePoller::unloadPoller()
|
||||
{
|
||||
}
|
||||
|
||||
void Poller::addTimeout(int nextTimeout)
|
||||
void KWinIdleTimePoller::addTimeout(int nextTimeout)
|
||||
{
|
||||
if (m_timeouts.contains(nextTimeout)) {
|
||||
return;
|
||||
|
@ -68,10 +68,10 @@ void Poller::addTimeout(int nextTimeout)
|
|||
emit timeoutReached(nextTimeout);
|
||||
}
|
||||
);
|
||||
connect(timeout, &KWayland::Client::IdleTimeout::resumeFromIdle, this, &Poller::resumingFromIdle);
|
||||
connect(timeout, &KWayland::Client::IdleTimeout::resumeFromIdle, this, &KWinIdleTimePoller::resumingFromIdle);
|
||||
}
|
||||
|
||||
void Poller::removeTimeout(int nextTimeout)
|
||||
void KWinIdleTimePoller::removeTimeout(int nextTimeout)
|
||||
{
|
||||
auto it = m_timeouts.find(nextTimeout);
|
||||
if (it == m_timeouts.end()) {
|
||||
|
@ -81,12 +81,12 @@ void Poller::removeTimeout(int nextTimeout)
|
|||
m_timeouts.erase(it);
|
||||
}
|
||||
|
||||
QList< int > Poller::timeouts() const
|
||||
QList< int > KWinIdleTimePoller::timeouts() const
|
||||
{
|
||||
return QList<int>();
|
||||
}
|
||||
|
||||
void Poller::catchIdleEvent()
|
||||
void KWinIdleTimePoller::catchIdleEvent()
|
||||
{
|
||||
if (m_catchResumeTimeout) {
|
||||
// already setup
|
||||
|
@ -104,18 +104,18 @@ void Poller::catchIdleEvent()
|
|||
);
|
||||
}
|
||||
|
||||
void Poller::stopCatchingIdleEvents()
|
||||
void KWinIdleTimePoller::stopCatchingIdleEvents()
|
||||
{
|
||||
delete m_catchResumeTimeout;
|
||||
m_catchResumeTimeout = nullptr;
|
||||
}
|
||||
|
||||
int Poller::forcePollRequest()
|
||||
int KWinIdleTimePoller::forcePollRequest()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Poller::simulateUserActivity()
|
||||
void KWinIdleTimePoller::simulateUserActivity()
|
||||
{
|
||||
for (auto it = m_timeouts.constBegin(); it != m_timeouts.constEnd(); ++it) {
|
||||
it.value()->simulateUserActivity();
|
||||
|
|
|
@ -23,15 +23,15 @@ class IdleTimeout;
|
|||
}
|
||||
}
|
||||
|
||||
class Poller : public AbstractSystemPoller
|
||||
class KWinIdleTimePoller : public AbstractSystemPoller
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.kde.kidletime.AbstractSystemPoller" FILE "kwin.json")
|
||||
Q_PLUGIN_METADATA(IID AbstractSystemPoller_iid FILE "kwin.json")
|
||||
Q_INTERFACES(AbstractSystemPoller)
|
||||
|
||||
public:
|
||||
Poller(QObject *parent = nullptr);
|
||||
~Poller() override;
|
||||
KWinIdleTimePoller(QObject *parent = nullptr);
|
||||
~KWinIdleTimePoller() override;
|
||||
|
||||
bool isAvailable() override;
|
||||
bool setUpPoller() override;
|
||||
|
|
Loading…
Reference in a new issue