2
* This file is part of unity-2d
4
* Copyright 2011 Canonical Ltd.
7
* - Aurélien Gâteau <aurelien.gateau@canonical.com>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef KEYBOARDMODIFIERMONITOR_H
23
#define KEYBOARDMODIFIERMONITOR_H
26
#include <unity2dapplication.h>
30
struct KeyboardModifiersMonitorPrivate;
33
* This class monitor keyboard modifiers. It is able to track changes even if
34
* the active window does not belong to the application.
36
* You *must* use Unity2dApplication to be able to use this class.
38
* In most case you don't need your own instance: use the one returned by
41
class KeyboardModifiersMonitor : public QObject, protected AbstractX11EventFilter
45
KeyboardModifiersMonitor(QObject *parent = 0);
46
~KeyboardModifiersMonitor();
48
Qt::KeyboardModifiers keyboardModifiers() const;
50
HotModifier* getHotModifierFor(Qt::KeyboardModifiers modifiers);
52
void disableModifiers(Qt::KeyboardModifiers modifiers);
53
void enableModifiers(Qt::KeyboardModifiers modifiers);
55
static KeyboardModifiersMonitor* instance();
58
void keyboardModifiersChanged(Qt::KeyboardModifiers);
61
bool x11EventFilter(XEvent*);
64
KeyboardModifiersMonitorPrivate* const d;
65
QList<HotModifier*> m_hotModifiers;
66
Qt::KeyboardModifiers m_disabledModifiers;
69
#endif /* KEYBOARDMODIFIERMONITOR_H */