Adapt to Layer Shell Qt API change

The Layer Shell Qt library is updated to match its API more closely to
the protocol. It is now possible, or rather required if the behavior
should not change, to specify a desired output for a LayerShell window.
wilder-5.25
Julius Zint 4 years ago committed by David Edmundson
parent a61b3faecb
commit a31293f79d
  1. 3
      ksplash/ksplashqml/splashapp.cpp
  2. 4
      ksplash/ksplashqml/splashwindow.cpp
  3. 4
      ksplash/ksplashqml/splashwindow.h
  4. 3
      logout-greeter/greeter.cpp
  5. 19
      logout-greeter/shutdowndlg.cpp
  6. 4
      logout-greeter/shutdowndlg.h

@ -131,9 +131,8 @@ void SplashApp::adoptScreen(QScreen *screen)
if (screen->geometry().isNull()) {
return;
}
SplashWindow *w = new SplashWindow(m_testing, m_window, m_theme);
SplashWindow *w = new SplashWindow(m_testing, m_window, m_theme, screen);
w->setGeometry(screen->geometry());
w->setScreen(screen);
w->setStage(m_stage);
w->setVisible(true);
m_windows << w;

@ -24,7 +24,7 @@
#include <KWindowSystem>
SplashWindow::SplashWindow(bool testing, bool window, const QString &theme)
SplashWindow::SplashWindow(bool testing, bool window, const QString &theme, QScreen *screen)
: KQuickAddons::QuickViewSharedEngine()
, m_stage(0)
, m_testing(testing)
@ -36,9 +36,11 @@ SplashWindow::SplashWindow(bool testing, bool window, const QString &theme)
layerShellWindow->setScope(QStringLiteral("ksplashqml"));
layerShellWindow->setLayer(LayerShellQt::Window::LayerOverlay);
layerShellWindow->setExclusiveZone(-1);
layerShellWindow->setDesiredOutput(screen);
}
}
setScreen(screen);
setColor(Qt::transparent);
setDefaultAlphaBuffer(true);
setClearBeforeRendering(true);

@ -6,6 +6,8 @@
#pragma once
#include <QScreen>
#include <KQuickAddons/QuickViewSharedEngine>
class QMouseEvent;
@ -14,7 +16,7 @@ class QKeyEvent;
class SplashWindow : public KQuickAddons::QuickViewSharedEngine
{
public:
SplashWindow(bool testing, bool window, const QString &theme);
SplashWindow(bool testing, bool window, const QString &theme, QScreen *screen);
void setStage(int stage);
virtual void setGeometry(const QRect &rect);

@ -60,7 +60,7 @@ void Greeter::adoptScreen(QScreen *screen)
return;
}
// TODO: last argument is the theme, maybe add command line option for it?
KSMShutdownDlg *w = new KSMShutdownDlg(nullptr, m_shutdownType);
KSMShutdownDlg *w = new KSMShutdownDlg(nullptr, m_shutdownType, screen);
w->installEventFilter(this);
m_dialogs << w;
@ -72,7 +72,6 @@ void Greeter::adoptScreen(QScreen *screen)
connect(w, &KSMShutdownDlg::accepted, this, []() {
QApplication::exit(1);
});
w->setScreen(screen);
w->setGeometry(screen->geometry());
w->init();
}

@ -54,7 +54,7 @@ static const QString s_dbusPropertiesInterface = QStringLiteral("org.freedesktop
static const QString s_login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager");
static const QString s_login1RebootToFirmwareSetup = QStringLiteral("RebootToFirmwareSetup");
KSMShutdownDlg::KSMShutdownDlg(QWindow *parent, KWorkSpace::ShutdownType sdtype)
KSMShutdownDlg::KSMShutdownDlg(QWindow *parent, KWorkSpace::ShutdownType sdtype, QScreen *screen)
: QuickViewSharedEngine(parent)
, m_result(false)
// this is a WType_Popup on purpose. Do not change that! Not
@ -63,6 +63,16 @@ KSMShutdownDlg::KSMShutdownDlg(QWindow *parent, KWorkSpace::ShutdownType sdtype)
// window stuff
setClearBeforeRendering(true);
setColor(QColor(Qt::transparent));
setScreen(screen);
if (KWindowSystem::isPlatformWayland()) {
if (auto w = LayerShellQt::Window::get(this)) {
w->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityExclusive);
w->setExclusiveZone(-1);
w->setLayer(LayerShellQt::Window::LayerOverlay);
w->setDesiredOutput(screen);
}
}
setResizeMode(KQuickAddons::QuickViewSharedEngine::SizeRootObjectToView);
@ -189,13 +199,6 @@ void KSMShutdownDlg::init()
setKeyboardGrabEnabled(true);
KWindowEffects::enableBlurBehind(this, true);
if (KWindowSystem::isPlatformWayland()) {
if (auto w = LayerShellQt::Window::get(this)) {
w->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityExclusive);
w->setExclusiveZone(-1);
w->setLayer(LayerShellQt::Window::LayerOverlay);
}
}
}
void KSMShutdownDlg::resizeEvent(QResizeEvent *e)

@ -8,6 +8,8 @@
#pragma once
#include <QScreen>
#include <kquickaddons/quickviewsharedengine.h>
#include <kworkspace.h>
#include <sessionmanagement.h>
@ -18,7 +20,7 @@ class KSMShutdownDlg : public KQuickAddons::QuickViewSharedEngine
Q_OBJECT
public:
KSMShutdownDlg(QWindow *parent, KWorkSpace::ShutdownType sdtype);
KSMShutdownDlg(QWindow *parent, KWorkSpace::ShutdownType sdtype, QScreen *screen);
void init();
bool result() const;

Loading…
Cancel
Save