Commit 697ea3ae authored by Martin Flöser's avatar Martin Flöser

Delay query whether screenlocker is registered till WaylandServer is initialized

If we try to query before WaylandServer created the KSldApp the service
owner change is never delivered. Thus a delay till we know that the
service is there on Wayland. On X11 the initialization can be done
directly.

To know when the WaylandServer is fully initialized an additional
signal is added to WaylandServer.
parent 440d49da
......@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "screenlockerwatcher.h"
#include "wayland_server.h"
#include <QFutureWatcher>
#include <QtConcurrentRun>
......@@ -36,6 +37,19 @@ ScreenLockerWatcher::ScreenLockerWatcher(QObject *parent)
, m_interface(NULL)
, m_serviceWatcher(new QDBusServiceWatcher(this))
, m_locked(false)
{
if (waylandServer() && waylandServer()->hasScreenLockerIntegration()) {
connect(waylandServer(), &WaylandServer::initialized, this, &ScreenLockerWatcher::initialize);
} else {
initialize();
}
}
ScreenLockerWatcher::~ScreenLockerWatcher()
{
}
void ScreenLockerWatcher::initialize()
{
connect(m_serviceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), SLOT(serviceOwnerChanged(QString,QString,QString)));
m_serviceWatcher->setWatchMode(QDBusServiceWatcher::WatchForOwnerChange);
......@@ -49,10 +63,6 @@ ScreenLockerWatcher::ScreenLockerWatcher(QObject *parent)
SCREEN_LOCKER_SERVICE_NAME));
}
ScreenLockerWatcher::~ScreenLockerWatcher()
{
}
void ScreenLockerWatcher::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
{
Q_UNUSED(oldOwner)
......
......@@ -48,6 +48,7 @@ private Q_SLOTS:
void serviceRegisteredQueried();
void serviceOwnerQueried();
private:
void initialize();
OrgFreedesktopScreenSaverInterface *m_interface;
QDBusServiceWatcher *m_serviceWatcher;
bool m_locked;
......
......@@ -323,6 +323,7 @@ void WaylandServer::initWorkspace()
ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate);
}
}
emit initialized();
}
void WaylandServer::initOutputs()
......
......@@ -167,6 +167,7 @@ Q_SIGNALS:
void shellClientAdded(KWin::ShellClient*);
void shellClientRemoved(KWin::ShellClient*);
void terminatingInternalClientConnection();
void initialized();
private:
void setupX11ClipboardSync();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment