KWin
Loading...
Searching...
No Matches
kglobalaccel_plugin.cpp
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
10
11#include "input.h"
12
13#include <QDebug>
14
16 : KGlobalAccelInterface(parent)
17{
18}
19
21
22bool KGlobalAccelImpl::grabKey(int key, bool grab)
23{
24 return true;
25}
26
28{
29 if (m_shuttingDown) {
30 return;
31 }
32 static KWin::InputRedirection *s_input = KWin::InputRedirection::self();
33 if (!s_input) {
34 qFatal("This plugin is intended to be used with KWin and this is not KWin, exiting now");
35 } else {
36 if (!m_inputDestroyedConnection) {
37 m_inputDestroyedConnection = connect(s_input, &QObject::destroyed, this, [this] {
38 m_shuttingDown = true;
39 });
40 }
41 }
42 s_input->registerGlobalAccel(enabled ? this : nullptr);
43}
44
46{
47 return keyPressed(keyQt);
48}
49
51{
52 return keyReleased(keyQt);
53}
54
55#include "moc_kglobalaccel_plugin.cpp"
bool checkKeyReleased(int keyQt)
bool grabKey(int key, bool grab) override
bool checkKeyPressed(int keyQt)
~KGlobalAccelImpl() override
KGlobalAccelImpl(QObject *parent=nullptr)
void setEnabled(bool) override
This class is responsible for redirecting incoming input to the surface which currently has input or ...
Definition input.h:70
void registerGlobalAccel(KGlobalAccelInterface *interface)
Definition input.cpp:3342