File indexing completed on 2021-12-21 14:17:30

0001 /********************************************************************
0002  KSld - the KDE Screenlocker Daemon
0003  This file is part of the KDE project.
0004 
0005  Copyright (C) 2015 Bhushan Shah <bhush94@gmail.com>
0006 
0007 This program is free software; you can redistribute it and/or modify
0008 it under the terms of the GNU General Public License as published by
0009 the Free Software Foundation; either version 2 of the License, or
0010 (at your option) any later version.
0011 
0012 This program is distributed in the hope that it will be useful,
0013 but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 GNU General Public License for more details.
0016 
0017 You should have received a copy of the GNU General Public License
0018 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0019 *********************************************************************/
0020 
0021 #include "waylandlocker.h"
0022 
0023 #include <QGuiApplication>
0024 #include <QScreen>
0025 
0026 namespace ScreenLocker
0027 {
0028 WaylandLocker::WaylandLocker(QObject *parent)
0029     : AbstractLocker(parent)
0030 {
0031     if (m_background) {
0032         updateGeometryOfBackground();
0033         const auto screens = qApp->screens();
0034         for (auto s : screens) {
0035             connect(s, &QScreen::geometryChanged, this, &WaylandLocker::updateGeometryOfBackground);
0036         }
0037         connect(qApp, &QGuiApplication::screenAdded, this, [this](QScreen *s) {
0038             connect(s, &QScreen::geometryChanged, this, &WaylandLocker::updateGeometryOfBackground);
0039             updateGeometryOfBackground();
0040         });
0041         connect(qApp, &QGuiApplication::screenRemoved, this, &WaylandLocker::updateGeometryOfBackground);
0042     }
0043 }
0044 
0045 WaylandLocker::~WaylandLocker()
0046 {
0047 }
0048 
0049 void WaylandLocker::updateGeometryOfBackground()
0050 {
0051     QRect combined;
0052     const auto screens = qApp->screens();
0053     for (auto s : screens) {
0054         combined = combined.united(s->geometry());
0055     }
0056     m_background->setGeometry(combined);
0057     m_background->update();
0058 }
0059 
0060 void WaylandLocker::showLockWindow()
0061 {
0062 }
0063 
0064 void WaylandLocker::hideLockWindow()
0065 {
0066 }
0067 
0068 void WaylandLocker::addAllowedWindow(quint32 window)
0069 {
0070     Q_UNUSED(window)
0071     Q_EMIT lockWindowShown();
0072 }
0073 
0074 void WaylandLocker::stayOnTop()
0075 {
0076 }
0077 
0078 }