Implement a TerminateServerFilter to handle XKB_KEY_Terminate_Server
On special request by sebas. It's not really dangerous as by default the xkb layout doesn't have it enabled. So if a user actually enables it, we can also support it. And now I'm going to reconfigure my layout again to not hit it by chance. Reviewed-By: sebas
This commit is contained in:
parent
d8a3e0525f
commit
16301aa4cf
1 changed files with 15 additions and 0 deletions
15
input.cpp
15
input.cpp
|
@ -123,6 +123,20 @@ public:
|
|||
};
|
||||
#endif
|
||||
|
||||
class TerminateServerFilter : public InputEventFilter {
|
||||
public:
|
||||
bool keyEvent(QKeyEvent *event) override {
|
||||
if (event->type() == QEvent::KeyPress && !event->isAutoRepeat()) {
|
||||
if (event->nativeVirtualKey() == XKB_KEY_Terminate_Server) {
|
||||
qCWarning(KWIN_CORE) << "Request to terminate server";
|
||||
QMetaObject::invokeMethod(qApp, "quit", Qt::QueuedConnection);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class LockScreenFilter : public InputEventFilter {
|
||||
public:
|
||||
bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override {
|
||||
|
@ -866,6 +880,7 @@ void InputRedirection::setupInputFilters()
|
|||
}
|
||||
#endif
|
||||
if (waylandServer()) {
|
||||
installInputEventFilter(new TerminateServerFilter);
|
||||
installInputEventFilter(new DragAndDropInputFilter);
|
||||
installInputEventFilter(new LockScreenFilter);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue