Changeset View
Changeset View
Standalone View
Standalone View
input_event.h
Show All 13 Lines | |||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef KWIN_INPUT_EVENT_H | 20 | #ifndef KWIN_INPUT_EVENT_H | ||
21 | #define KWIN_INPUT_EVENT_H | 21 | #define KWIN_INPUT_EVENT_H | ||
22 | | ||||
23 | #include "input.h" | ||||
24 | | ||||
22 | #include <QInputEvent> | 25 | #include <QInputEvent> | ||
23 | 26 | | |||
24 | namespace KWin | 27 | namespace KWin | ||
25 | { | 28 | { | ||
26 | 29 | | |||
27 | namespace LibInput | 30 | namespace LibInput | ||
28 | { | 31 | { | ||
29 | class Device; | 32 | class Device; | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 75 | private: | |||
73 | QSizeF m_delta; | 76 | QSizeF m_delta; | ||
74 | QSizeF m_deltaUnccelerated; | 77 | QSizeF m_deltaUnccelerated; | ||
75 | quint64 m_timestampMicroseconds; | 78 | quint64 m_timestampMicroseconds; | ||
76 | LibInput::Device *m_device; | 79 | LibInput::Device *m_device; | ||
77 | Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); | 80 | Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); | ||
78 | quint32 m_nativeButton = 0; | 81 | quint32 m_nativeButton = 0; | ||
79 | }; | 82 | }; | ||
80 | 83 | | |||
84 | // TODO: Don't derive from QWheelEvent, this event is quite domain specific. | ||||
81 | class WheelEvent : public QWheelEvent | 85 | class WheelEvent : public QWheelEvent | ||
82 | { | 86 | { | ||
83 | public: | 87 | public: | ||
84 | explicit WheelEvent(const QPointF &pos, qreal delta, Qt::Orientation orientation, Qt::MouseButtons buttons, | 88 | explicit WheelEvent(const QPointF &pos, qreal delta, qint32 discreteDelta, Qt::Orientation orientation, | ||
85 | Qt::KeyboardModifiers modifiers, quint32 timestamp, LibInput::Device *device); | 89 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, InputRedirection::PointerAxisSource source, | ||
90 | quint32 timestamp, LibInput::Device *device); | ||||
91 | | ||||
92 | Qt::Orientation orientation() const { | ||||
93 | return m_orientation; | ||||
94 | } | ||||
95 | | ||||
96 | qreal delta() const { | ||||
97 | return m_delta; | ||||
98 | } | ||||
99 | | ||||
100 | qint32 discreteDelta() const { | ||||
101 | return m_discreteDelta; | ||||
102 | } | ||||
103 | | ||||
104 | InputRedirection::PointerAxisSource axisSource() const { | ||||
105 | return m_source; | ||||
106 | } | ||||
86 | 107 | | |||
87 | LibInput::Device *device() const { | 108 | LibInput::Device *device() const { | ||
88 | return m_device; | 109 | return m_device; | ||
89 | } | 110 | } | ||
90 | 111 | | |||
91 | Qt::KeyboardModifiers modifiersRelevantForGlobalShortcuts() const { | 112 | Qt::KeyboardModifiers modifiersRelevantForGlobalShortcuts() const { | ||
92 | return m_modifiersRelevantForShortcuts; | 113 | return m_modifiersRelevantForShortcuts; | ||
93 | } | 114 | } | ||
94 | 115 | | |||
95 | void setModifiersRelevantForGlobalShortcuts(const Qt::KeyboardModifiers &mods) { | 116 | void setModifiersRelevantForGlobalShortcuts(const Qt::KeyboardModifiers &mods) { | ||
96 | m_modifiersRelevantForShortcuts = mods; | 117 | m_modifiersRelevantForShortcuts = mods; | ||
97 | } | 118 | } | ||
98 | 119 | | |||
99 | private: | 120 | private: | ||
100 | LibInput::Device *m_device; | 121 | LibInput::Device *m_device; | ||
122 | Qt::Orientation m_orientation; | ||||
123 | qreal m_delta; | ||||
124 | qint32 m_discreteDelta; | ||||
125 | InputRedirection::PointerAxisSource m_source; | ||||
101 | Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); | 126 | Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); | ||
102 | }; | 127 | }; | ||
103 | 128 | | |||
104 | class KeyEvent : public QKeyEvent | 129 | class KeyEvent : public QKeyEvent | ||
105 | { | 130 | { | ||
106 | public: | 131 | public: | ||
107 | explicit KeyEvent(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers, quint32 code, quint32 keysym, | 132 | explicit KeyEvent(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers, quint32 code, quint32 keysym, | ||
108 | const QString &text, bool autorepeat, quint32 timestamp, LibInput::Device *device); | 133 | const QString &text, bool autorepeat, quint32 timestamp, LibInput::Device *device); | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |