~stolowski/unity-2d/wallpaper-kludge-removal

« back to all changes in this revision

Viewing changes to libunity-2d-private/src/keyboardmodifiersmonitor.h

[lib] Kill keyboardmodifiersmonitor, and integrate its functionality into keymonitor

This helps to prevent wrong HUD triggers on ultrafast alt+key presses. Fixes: https://bugs.launchpad.net/bugs/968840. Approved by Gerry Boland.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of unity-2d
3
 
 *
4
 
 * Copyright 2011 Canonical Ltd.
5
 
 *
6
 
 * Authors:
7
 
 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
8
 
 *
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.
12
 
 *
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.
17
 
 *
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/>.
20
 
 */
21
 
 
22
 
#ifndef KEYBOARDMODIFIERMONITOR_H
23
 
#define KEYBOARDMODIFIERMONITOR_H
24
 
 
25
 
// Local
26
 
#include <unity2dapplication.h>
27
 
 
28
 
class HotModifier;
29
 
 
30
 
struct KeyboardModifiersMonitorPrivate;
31
 
 
32
 
/**
33
 
 * This class monitor keyboard modifiers. It is able to track changes even if
34
 
 * the active window does not belong to the application.
35
 
 *
36
 
 * You *must* use Unity2dApplication to be able to use this class.
37
 
 *
38
 
 * In most case you don't need your own instance: use the one returned by
39
 
 * instance() instead.
40
 
 */
41
 
class KeyboardModifiersMonitor : public QObject, protected AbstractX11EventFilter
42
 
{
43
 
Q_OBJECT
44
 
public:
45
 
    KeyboardModifiersMonitor(QObject *parent = 0);
46
 
    ~KeyboardModifiersMonitor();
47
 
 
48
 
    Qt::KeyboardModifiers keyboardModifiers() const;
49
 
 
50
 
    HotModifier* getHotModifierFor(Qt::KeyboardModifiers modifiers);
51
 
 
52
 
    void disableModifiers(Qt::KeyboardModifiers modifiers);
53
 
    void enableModifiers(Qt::KeyboardModifiers modifiers);
54
 
 
55
 
    static KeyboardModifiersMonitor* instance();
56
 
 
57
 
Q_SIGNALS:
58
 
    void keyboardModifiersChanged(Qt::KeyboardModifiers);
59
 
 
60
 
protected:
61
 
    bool x11EventFilter(XEvent*);
62
 
 
63
 
private:
64
 
    KeyboardModifiersMonitorPrivate* const d;
65
 
    QList<HotModifier*> m_hotModifiers;
66
 
    Qt::KeyboardModifiers m_disabledModifiers;
67
 
};
68
 
 
69
 
#endif /* KEYBOARDMODIFIERMONITOR_H */