Commit d610b795 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Use LayerShellQt to implement on Wayland

Using the PlasmaShell protocol has all sorts of problems because
placement is decided by the client at a position level rather than by
the application.
This adopts the layer shell and enforces the surface to be full screen
on the correct output and the compositor should be responsible for
placing it correctly.
parent aef2a2eb
......@@ -85,6 +85,7 @@ set_package_properties(KF5Wayland PROPERTIES
PURPOSE "Required for building screenlocker")
find_package(WaylandScanner)
find_package(Wayland 1.3 COMPONENTS Client Server)
find_package(LayerShellQt REQUIRED)
set_package_properties(Wayland PROPERTIES
TYPE REQUIRED
......
......@@ -50,6 +50,7 @@ target_link_libraries(kscreenlocker_greet
${X11_LIBRARIES}
KF5::WaylandClient
Wayland::Client
LayerShellQt::Interface
)
install(TARGETS kscreenlocker_greet DESTINATION ${KDE_INSTALL_LIBEXECDIR})
......
......@@ -43,7 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KWayland
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/event_queue.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h>
// Qt
......@@ -300,10 +299,6 @@ void UnlockApp::screenGeometryChanged(QScreen *screen, const QRect &geo)
}
KQuickAddons::QuickViewSharedEngine *view = m_views[screenIndex];
view->setGeometry(geo);
KWayland::Client::PlasmaShellSurface *plasmaSurface = view->property("plasmaShellSurface").value<KWayland::Client::PlasmaShellSurface *>();
if (plasmaSurface) {
plasmaSurface->setPosition(view->geometry().topLeft());
}
}
void UnlockApp::initialViewSetup()
......@@ -351,14 +346,6 @@ void UnlockApp::desktopResized()
wl_display_flush(m_ksldConnection->display());
}
if (m_plasmaShell) {
using namespace KWayland::Client;
if (Surface *surface = Surface::fromWindow(view)) {
PlasmaShellSurface *shellSurface = m_plasmaShell->createSurface(surface, view);
view->setProperty("plasmaShellSurface", QVariant::fromValue(shellSurface));
}
}
// engine stuff
QQmlContext *context = view->engine()->rootContext();
......@@ -415,13 +402,9 @@ void UnlockApp::desktopResized()
auto *view = m_views.at(i);
auto screen = QGuiApplication::screens()[i];
view->setGeometry(screen->geometry());
KWayland::Client::PlasmaShellSurface *plasmaSurface = view->property("plasmaShellSurface").value<KWayland::Client::PlasmaShellSurface *>();
if (plasmaSurface) {
plasmaSurface->setPosition(view->geometry().topLeft());
}
if (auto object = view->property("wallpaperGraphicsObject").value<KDeclarative::QmlObjectSharedEngine *>()) {
// initialize with our size to avoid as much resize events as possible
view->setScreen(screen);
if (auto object = view->property("wallpaperGraphicsObject").value<KDeclarative::QmlObjectSharedEngine*>()) {
//initialize with our size to avoid as much resize events as possible
object->completeInitialization({
{QStringLiteral("width"), view->width()},
{QStringLiteral("height"), view->height()},
......@@ -429,7 +412,7 @@ void UnlockApp::desktopResized()
}
// on Wayland we may not use fullscreen as that puts all windows on one screen
if (m_testing || plasmaSurface || QX11Info::isPlatformX11()) {
if (m_testing || QX11Info::isPlatformX11()) {
view->show();
} else {
view->showFullScreen();
......
......@@ -40,6 +40,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <unistd.h>
#endif
#include <LayerShellQt/Shell>
static void signalHandler(int signum)
{
ScreenLocker::UnlockApp *instance = qobject_cast<ScreenLocker::UnlockApp *>(QCoreApplication::instance());
......@@ -66,6 +68,8 @@ static void signalHandler(int signum)
int main(int argc, char *argv[])
{
LayerShellQt::Shell::useLayerShell();
// disable ptrace on the greeter
#if HAVE_PR_SET_DUMPABLE
prctl(PR_SET_DUMPABLE, 0);
......
Supports Markdown
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