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.
icc-effect-5.14.5
Martin Gräßlin 2016-08-16 09:26:17 +02:00
parent 440d49da00
commit 697ea3ae00
4 changed files with 17 additions and 4 deletions

View File

@ -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)

View File

@ -48,6 +48,7 @@ private Q_SLOTS:
void serviceRegisteredQueried();
void serviceOwnerQueried();
private:
void initialize();
OrgFreedesktopScreenSaverInterface *m_interface;
QDBusServiceWatcher *m_serviceWatcher;
bool m_locked;

View File

@ -323,6 +323,7 @@ void WaylandServer::initWorkspace()
ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate);
}
}
emit initialized();
}
void WaylandServer::initOutputs()

View File

@ -167,6 +167,7 @@ Q_SIGNALS:
void shellClientAdded(KWin::ShellClient*);
void shellClientRemoved(KWin::ShellClient*);
void terminatingInternalClientConnection();
void initialized();
private:
void setupX11ClipboardSync();