1/*
2 SPDX-FileCopyrightText: 2009 Michael Leupold <lemma@confuego.org>
3 SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef KMODIFIERKEYINFOPROVIDERXCB_H
9#define KMODIFIERKEYINFOPROVIDERXCB_H
10
11#include "kmodifierkeyinfoprovider_p.h"
12#include <QAbstractNativeEventFilter>
13class KModifierKeyInfoProviderXcb : public KModifierKeyInfoProvider, public QAbstractNativeEventFilter
14{
15 Q_OBJECT
16public:
17 KModifierKeyInfoProviderXcb();
18 ~KModifierKeyInfoProviderXcb() override;
19
20 bool setKeyLatched(Qt::Key key, bool latched) override;
21 bool setKeyLocked(Qt::Key key, bool locked) override;
22
23 bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *) override;
24
25 void xkbUpdateModifierMapping();
26 void xkbModifierStateChanged(unsigned char mods, unsigned char latched_mods, unsigned char locked_mods);
27 void xkbButtonStateChanged(unsigned short ptr_buttons);
28
29private:
30 int m_xkbEv;
31 bool m_xkbAvailable;
32
33 // maps a Qt::Key to a modifier mask
34 QHash<Qt::Key, unsigned int> m_xkbModifiers;
35 // maps a Qt::MouseButton to a button mask
36 QHash<Qt::MouseButton, unsigned short> m_xkbButtons;
37};
38
39#endif
40

source code of kguiaddons/src/util/kmodifierkeyinfoprovider_xcb.h