[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:
Bhushan Shah 2015-11-16 15:49:38 +05:30
parent 5d416a0f69
commit 450bbaafdc
4 changed files with 28 additions and 2 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}
}

View file

@ -117,6 +117,11 @@ public:
int createInputMethodConnection();
void destroyInputMethodConnection();
/**
* @returns true if screen is locked.
**/
bool isScreenLocked() const;
void createInternalConnection();
void destroyInternalConnection();
void initWorkspace();