Commit 450bbaaf authored by Bhushan Shah's avatar Bhushan Shah 📱

[wayland] Introduce property to identify lockscreen and inputmethods

This introduces Toplevel::isLockScreen() and Toplevel::isInputMethod(),
this can be used to allow only lockscreen/inputmethods to get input
events and shown when screen is locked.
parent 5d416a0f
......@@ -101,8 +101,8 @@ public:
return m_windowId;
}
bool isInternal() const;
bool isLockScreen() const;
bool isInputMethod() const;
bool isLockScreen() const override;
bool isInputMethod() const override;
QWindow *internalWindow() const {
return m_internalWindow;
}
......
......@@ -252,6 +252,9 @@ public:
bool isComboBox() const;
bool isDNDIcon() const;
virtual bool isLockScreen() const;
virtual bool isInputMethod() const;
virtual int desktop() const = 0;
virtual QStringList activities() const = 0;
bool isOnDesktop(int d) const;
......@@ -650,6 +653,16 @@ inline bool Toplevel::isDNDIcon() const
return windowType() == NET::DNDIcon;
}
inline bool Toplevel::isLockScreen() const
{
return false;
}
inline bool Toplevel::isInputMethod() const
{
return false;
}
inline QRegion Toplevel::damage() const
{
return damage_region;
......
......@@ -133,6 +133,9 @@ void WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
// skip Xwayland clients, those are created using standard X11 way
return;
}
if (surface->client() == m_screenLockerClientConnection && !isScreenLocked()) {
ScreenLocker::KSldApp::self()->lockScreenShown();
}
auto client = new ShellClient(surface);
if (auto c = Compositor::self()) {
connect(client, &Toplevel::needsRepaint, c, &Compositor::scheduleRepaint);
......@@ -480,4 +483,9 @@ quint16 WaylandServer::createClientId(ClientConnection *c)
return id;
}
bool WaylandServer::isScreenLocked() const
{
return ScreenLocker::KSldApp::self()->lockState() == ScreenLocker::KSldApp::Locked;
}
}
......@@ -117,6 +117,11 @@ public:
int createInputMethodConnection();
void destroyInputMethodConnection();
/**
* @returns true if screen is locked.
**/
bool isScreenLocked() const;
void createInternalConnection();
void destroyInternalConnection();
void initWorkspace();
......
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