[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.
This commit is contained in:
parent
5d416a0f69
commit
450bbaafdc
4 changed files with 28 additions and 2 deletions
|
@ -101,8 +101,8 @@ public:
|
||||||
return m_windowId;
|
return m_windowId;
|
||||||
}
|
}
|
||||||
bool isInternal() const;
|
bool isInternal() const;
|
||||||
bool isLockScreen() const;
|
bool isLockScreen() const override;
|
||||||
bool isInputMethod() const;
|
bool isInputMethod() const override;
|
||||||
QWindow *internalWindow() const {
|
QWindow *internalWindow() const {
|
||||||
return m_internalWindow;
|
return m_internalWindow;
|
||||||
}
|
}
|
||||||
|
|
13
toplevel.h
13
toplevel.h
|
@ -252,6 +252,9 @@ public:
|
||||||
bool isComboBox() const;
|
bool isComboBox() const;
|
||||||
bool isDNDIcon() const;
|
bool isDNDIcon() const;
|
||||||
|
|
||||||
|
virtual bool isLockScreen() const;
|
||||||
|
virtual bool isInputMethod() const;
|
||||||
|
|
||||||
virtual int desktop() const = 0;
|
virtual int desktop() const = 0;
|
||||||
virtual QStringList activities() const = 0;
|
virtual QStringList activities() const = 0;
|
||||||
bool isOnDesktop(int d) const;
|
bool isOnDesktop(int d) const;
|
||||||
|
@ -650,6 +653,16 @@ inline bool Toplevel::isDNDIcon() const
|
||||||
return windowType() == NET::DNDIcon;
|
return windowType() == NET::DNDIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool Toplevel::isLockScreen() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool Toplevel::isInputMethod() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
inline QRegion Toplevel::damage() const
|
inline QRegion Toplevel::damage() const
|
||||||
{
|
{
|
||||||
return damage_region;
|
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
|
// skip Xwayland clients, those are created using standard X11 way
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (surface->client() == m_screenLockerClientConnection && !isScreenLocked()) {
|
||||||
|
ScreenLocker::KSldApp::self()->lockScreenShown();
|
||||||
|
}
|
||||||
auto client = new ShellClient(surface);
|
auto client = new ShellClient(surface);
|
||||||
if (auto c = Compositor::self()) {
|
if (auto c = Compositor::self()) {
|
||||||
connect(client, &Toplevel::needsRepaint, c, &Compositor::scheduleRepaint);
|
connect(client, &Toplevel::needsRepaint, c, &Compositor::scheduleRepaint);
|
||||||
|
@ -480,4 +483,9 @@ quint16 WaylandServer::createClientId(ClientConnection *c)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WaylandServer::isScreenLocked() const
|
||||||
|
{
|
||||||
|
return ScreenLocker::KSldApp::self()->lockState() == ScreenLocker::KSldApp::Locked;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,11 @@ public:
|
||||||
int createInputMethodConnection();
|
int createInputMethodConnection();
|
||||||
void destroyInputMethodConnection();
|
void destroyInputMethodConnection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns true if screen is locked.
|
||||||
|
**/
|
||||||
|
bool isScreenLocked() const;
|
||||||
|
|
||||||
void createInternalConnection();
|
void createInternalConnection();
|
||||||
void destroyInternalConnection();
|
void destroyInternalConnection();
|
||||||
void initWorkspace();
|
void initWorkspace();
|
||||||
|
|
Loading…
Reference in a new issue