~nick-dedekind/qtmir/mock-task-controller

« back to all changes in this revision

Viewing changes to src/platforms/mirserver/qteventfeeder.cpp

  • Committer: Nick Dedekind
  • Date: 2015-09-07 08:19:21 UTC
  • mfrom: (345.1.24 qtmir)
  • Revision ID: nick.dedekind@canonical.com-20150907081921-0qfdre9pqzlenmzw
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright © 2013-2015 Canonical Ltd.
 
2
 * Copyright (C) 2013-2015 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it under
5
5
 * the terms of the GNU Lesser General Public License version 3, as published by
12
12
 *
13
13
 * You should have received a copy of the GNU Lesser General Public License
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
17
 
 *              Gerry Boland <gerry.boland@canonical.com>
18
15
 */
19
16
 
20
17
#include "qteventfeeder.h"
37
34
 
38
35
// XKB Keysyms which do not map directly to Qt types (i.e. Unicode points)
39
36
static const uint32_t KeyTable[] = {
40
 
    XKB_KEY_Escape,                  Qt::Key_Escape,
41
 
    XKB_KEY_Tab,                     Qt::Key_Tab,
42
 
    XKB_KEY_ISO_Left_Tab,            Qt::Key_Backtab,
43
 
    XKB_KEY_BackSpace,               Qt::Key_Backspace,
44
 
    XKB_KEY_Return,                  Qt::Key_Return,
45
 
    XKB_KEY_Insert,                  Qt::Key_Insert,
46
 
    XKB_KEY_Delete,                  Qt::Key_Delete,
47
 
    XKB_KEY_Clear,                   Qt::Key_Delete,
48
 
    XKB_KEY_Pause,                   Qt::Key_Pause,
49
 
    XKB_KEY_Print,                   Qt::Key_Print,
50
 
 
51
 
    XKB_KEY_Home,                    Qt::Key_Home,
52
 
    XKB_KEY_End,                     Qt::Key_End,
53
 
    XKB_KEY_Left,                    Qt::Key_Left,
54
 
    XKB_KEY_Up,                      Qt::Key_Up,
55
 
    XKB_KEY_Right,                   Qt::Key_Right,
56
 
    XKB_KEY_Down,                    Qt::Key_Down,
57
 
    XKB_KEY_Prior,                   Qt::Key_PageUp,
58
 
    XKB_KEY_Next,                    Qt::Key_PageDown,
59
 
 
60
 
    XKB_KEY_Shift_L,                 Qt::Key_Shift,
61
 
    XKB_KEY_Shift_R,                 Qt::Key_Shift,
62
 
    XKB_KEY_Shift_Lock,              Qt::Key_Shift,
63
 
    XKB_KEY_Control_L,               Qt::Key_Control,
64
 
    XKB_KEY_Control_R,               Qt::Key_Control,
65
 
    XKB_KEY_Meta_L,                  Qt::Key_Meta,
66
 
    XKB_KEY_Meta_R,                  Qt::Key_Meta,
67
 
    XKB_KEY_Alt_L,                   Qt::Key_Alt,
68
 
    XKB_KEY_Alt_R,                   Qt::Key_Alt,
69
 
    XKB_KEY_Caps_Lock,               Qt::Key_CapsLock,
70
 
    XKB_KEY_Num_Lock,                Qt::Key_NumLock,
71
 
    XKB_KEY_Scroll_Lock,             Qt::Key_ScrollLock,
72
 
    XKB_KEY_Super_L,                 Qt::Key_Super_L,
73
 
    XKB_KEY_Super_R,                 Qt::Key_Super_R,
74
 
    XKB_KEY_Menu,                    Qt::Key_Menu,
75
 
    XKB_KEY_Hyper_L,                 Qt::Key_Hyper_L,
76
 
    XKB_KEY_Hyper_R,                 Qt::Key_Hyper_R,
77
 
    XKB_KEY_Help,                    Qt::Key_Help,
78
 
 
79
 
    XKB_KEY_KP_Space,                Qt::Key_Space,
80
 
    XKB_KEY_KP_Tab,                  Qt::Key_Tab,
81
 
    XKB_KEY_KP_Enter,                Qt::Key_Enter,
82
 
    XKB_KEY_KP_Home,                 Qt::Key_Home,
83
 
    XKB_KEY_KP_Left,                 Qt::Key_Left,
84
 
    XKB_KEY_KP_Up,                   Qt::Key_Up,
85
 
    XKB_KEY_KP_Right,                Qt::Key_Right,
86
 
    XKB_KEY_KP_Down,                 Qt::Key_Down,
87
 
    XKB_KEY_KP_Prior,                Qt::Key_PageUp,
88
 
    XKB_KEY_KP_Next,                 Qt::Key_PageDown,
89
 
    XKB_KEY_KP_End,                  Qt::Key_End,
90
 
    XKB_KEY_KP_Begin,                Qt::Key_Clear,
91
 
    XKB_KEY_KP_Insert,               Qt::Key_Insert,
92
 
    XKB_KEY_KP_Delete,               Qt::Key_Delete,
93
 
    XKB_KEY_KP_Equal,                Qt::Key_Equal,
94
 
    XKB_KEY_KP_Multiply,             Qt::Key_Asterisk,
95
 
    XKB_KEY_KP_Add,                  Qt::Key_Plus,
96
 
    XKB_KEY_KP_Separator,            Qt::Key_Comma,
97
 
    XKB_KEY_KP_Subtract,             Qt::Key_Minus,
98
 
    XKB_KEY_KP_Decimal,              Qt::Key_Period,
99
 
    XKB_KEY_KP_Divide,               Qt::Key_Slash,
100
 
 
101
 
    XKB_KEY_ISO_Level3_Shift,        Qt::Key_AltGr,
102
 
    XKB_KEY_Multi_key,               Qt::Key_Multi_key,
103
 
    XKB_KEY_Codeinput,               Qt::Key_Codeinput,
104
 
    XKB_KEY_SingleCandidate,         Qt::Key_SingleCandidate,
105
 
    XKB_KEY_MultipleCandidate,       Qt::Key_MultipleCandidate,
106
 
    XKB_KEY_PreviousCandidate,       Qt::Key_PreviousCandidate,
107
 
 
108
 
    XKB_KEY_Mode_switch,             Qt::Key_Mode_switch,
109
 
    XKB_KEY_script_switch,           Qt::Key_Mode_switch,
 
37
    // misc keys
 
38
    XKB_KEY_Escape,             Qt::Key_Escape,
 
39
    XKB_KEY_Tab,                Qt::Key_Tab,
 
40
    XKB_KEY_ISO_Left_Tab,       Qt::Key_Backtab,
 
41
    XKB_KEY_BackSpace,          Qt::Key_Backspace,
 
42
    XKB_KEY_Return,             Qt::Key_Return,
 
43
    XKB_KEY_Insert,             Qt::Key_Insert,
 
44
    XKB_KEY_Delete,             Qt::Key_Delete,
 
45
    XKB_KEY_Clear,              Qt::Key_Delete,
 
46
    XKB_KEY_Pause,              Qt::Key_Pause,
 
47
    XKB_KEY_Print,              Qt::Key_Print,
 
48
    0x1005FF60,                 Qt::Key_SysReq,         // hardcoded Sun SysReq
 
49
    0x1007ff00,                 Qt::Key_SysReq,         // hardcoded X386 SysReq
 
50
 
 
51
    // cursor movement
 
52
 
 
53
    XKB_KEY_Home,               Qt::Key_Home,
 
54
    XKB_KEY_End,                Qt::Key_End,
 
55
    XKB_KEY_Left,               Qt::Key_Left,
 
56
    XKB_KEY_Up,                 Qt::Key_Up,
 
57
    XKB_KEY_Right,              Qt::Key_Right,
 
58
    XKB_KEY_Down,               Qt::Key_Down,
 
59
    XKB_KEY_Prior,              Qt::Key_PageUp,
 
60
    XKB_KEY_Next,               Qt::Key_PageDown,
 
61
 
 
62
    // modifiers
 
63
 
 
64
    XKB_KEY_Shift_L,            Qt::Key_Shift,
 
65
    XKB_KEY_Shift_R,            Qt::Key_Shift,
 
66
    XKB_KEY_Shift_Lock,         Qt::Key_Shift,
 
67
    XKB_KEY_Control_L,          Qt::Key_Control,
 
68
    XKB_KEY_Control_R,          Qt::Key_Control,
 
69
    XKB_KEY_Meta_L,             Qt::Key_Meta,
 
70
    XKB_KEY_Meta_R,             Qt::Key_Meta,
 
71
    XKB_KEY_Alt_L,              Qt::Key_Alt,
 
72
    XKB_KEY_Alt_R,              Qt::Key_Alt,
 
73
    XKB_KEY_Caps_Lock,          Qt::Key_CapsLock,
 
74
    XKB_KEY_Num_Lock,           Qt::Key_NumLock,
 
75
    XKB_KEY_Scroll_Lock,        Qt::Key_ScrollLock,
 
76
    XKB_KEY_Super_L,            Qt::Key_Super_L,
 
77
    XKB_KEY_Super_R,            Qt::Key_Super_R,
 
78
    XKB_KEY_Menu,               Qt::Key_Menu,
 
79
    XKB_KEY_Hyper_L,            Qt::Key_Hyper_L,
 
80
    XKB_KEY_Hyper_R,            Qt::Key_Hyper_R,
 
81
    XKB_KEY_Help,               Qt::Key_Help,
 
82
    0x1000FF74,                 Qt::Key_Backtab,        // hardcoded HP backtab
 
83
    0x1005FF10,                 Qt::Key_F11,            // hardcoded Sun F36 (labeled F11)
 
84
    0x1005FF11,                 Qt::Key_F12,            // hardcoded Sun F37 (labeled F12)
 
85
 
 
86
    // numeric and function keypad keys
 
87
 
 
88
    XKB_KEY_KP_Space,           Qt::Key_Space,
 
89
    XKB_KEY_KP_Tab,             Qt::Key_Tab,
 
90
    XKB_KEY_KP_Enter,           Qt::Key_Enter,
 
91
    //XKB_KEY_KP_F1,            Qt::Key_F1,
 
92
    //XKB_KEY_KP_F2,            Qt::Key_F2,
 
93
    //XKB_KEY_KP_F3,            Qt::Key_F3,
 
94
    //XKB_KEY_KP_F4,            Qt::Key_F4,
 
95
    XKB_KEY_KP_Home,            Qt::Key_Home,
 
96
    XKB_KEY_KP_Left,            Qt::Key_Left,
 
97
    XKB_KEY_KP_Up,              Qt::Key_Up,
 
98
    XKB_KEY_KP_Right,           Qt::Key_Right,
 
99
    XKB_KEY_KP_Down,            Qt::Key_Down,
 
100
    XKB_KEY_KP_Prior,           Qt::Key_PageUp,
 
101
    XKB_KEY_KP_Next,            Qt::Key_PageDown,
 
102
    XKB_KEY_KP_End,             Qt::Key_End,
 
103
    XKB_KEY_KP_Begin,           Qt::Key_Clear,
 
104
    XKB_KEY_KP_Insert,          Qt::Key_Insert,
 
105
    XKB_KEY_KP_Delete,          Qt::Key_Delete,
 
106
    XKB_KEY_KP_Equal,           Qt::Key_Equal,
 
107
    XKB_KEY_KP_Multiply,        Qt::Key_Asterisk,
 
108
    XKB_KEY_KP_Add,             Qt::Key_Plus,
 
109
    XKB_KEY_KP_Separator,       Qt::Key_Comma,
 
110
    XKB_KEY_KP_Subtract,        Qt::Key_Minus,
 
111
    XKB_KEY_KP_Decimal,         Qt::Key_Period,
 
112
    XKB_KEY_KP_Divide,          Qt::Key_Slash,
 
113
 
 
114
    // International input method support keys
 
115
 
 
116
    // International & multi-key character composition
 
117
    XKB_KEY_ISO_Level3_Shift,   Qt::Key_AltGr,
 
118
    XKB_KEY_Multi_key,          Qt::Key_Multi_key,
 
119
    XKB_KEY_Codeinput,          Qt::Key_Codeinput,
 
120
    XKB_KEY_SingleCandidate,    Qt::Key_SingleCandidate,
 
121
    XKB_KEY_MultipleCandidate,  Qt::Key_MultipleCandidate,
 
122
    XKB_KEY_PreviousCandidate,  Qt::Key_PreviousCandidate,
 
123
 
 
124
    // Misc Functions
 
125
    XKB_KEY_Mode_switch,        Qt::Key_Mode_switch,
 
126
    XKB_KEY_script_switch,      Qt::Key_Mode_switch,
 
127
 
 
128
    // Japanese keyboard support
 
129
    XKB_KEY_Kanji,              Qt::Key_Kanji,
 
130
    XKB_KEY_Muhenkan,           Qt::Key_Muhenkan,
 
131
    //XKB_KEY_Henkan_Mode,      Qt::Key_Henkan_Mode,
 
132
    XKB_KEY_Henkan_Mode,        Qt::Key_Henkan,
 
133
    XKB_KEY_Henkan,             Qt::Key_Henkan,
 
134
    XKB_KEY_Romaji,             Qt::Key_Romaji,
 
135
    XKB_KEY_Hiragana,           Qt::Key_Hiragana,
 
136
    XKB_KEY_Katakana,           Qt::Key_Katakana,
 
137
    XKB_KEY_Hiragana_Katakana,  Qt::Key_Hiragana_Katakana,
 
138
    XKB_KEY_Zenkaku,            Qt::Key_Zenkaku,
 
139
    XKB_KEY_Hankaku,            Qt::Key_Hankaku,
 
140
    XKB_KEY_Zenkaku_Hankaku,    Qt::Key_Zenkaku_Hankaku,
 
141
    XKB_KEY_Touroku,            Qt::Key_Touroku,
 
142
    XKB_KEY_Massyo,             Qt::Key_Massyo,
 
143
    XKB_KEY_Kana_Lock,          Qt::Key_Kana_Lock,
 
144
    XKB_KEY_Kana_Shift,         Qt::Key_Kana_Shift,
 
145
    XKB_KEY_Eisu_Shift,         Qt::Key_Eisu_Shift,
 
146
    XKB_KEY_Eisu_toggle,        Qt::Key_Eisu_toggle,
 
147
    //XKB_KEY_Kanji_Bangou,     Qt::Key_Kanji_Bangou,
 
148
    //XKB_KEY_Zen_Koho,         Qt::Key_Zen_Koho,
 
149
    //XKB_KEY_Mae_Koho,         Qt::Key_Mae_Koho,
 
150
    XKB_KEY_Kanji_Bangou,       Qt::Key_Codeinput,
 
151
    XKB_KEY_Zen_Koho,           Qt::Key_MultipleCandidate,
 
152
    XKB_KEY_Mae_Koho,           Qt::Key_PreviousCandidate,
 
153
 
 
154
#ifdef XKB_KEY_KOREAN
 
155
    // Korean keyboard support
 
156
    XKB_KEY_Hangul,                  Qt::Key_Hangul,
 
157
    XKB_KEY_Hangul_Start,            Qt::Key_Hangul_Start,
 
158
    XKB_KEY_Hangul_End,              Qt::Key_Hangul_End,
 
159
    XKB_KEY_Hangul_Hanja,            Qt::Key_Hangul_Hanja,
 
160
    XKB_KEY_Hangul_Jamo,             Qt::Key_Hangul_Jamo,
 
161
    XKB_KEY_Hangul_Romaja,           Qt::Key_Hangul_Romaja,
 
162
    //XKB_KEY_Hangul_Codeinput,      Qt::Key_Hangul_Codeinput,
 
163
    XKB_KEY_Hangul_Codeinput,        Qt::Key_Codeinput,
 
164
    XKB_KEY_Hangul_Jeonja,           Qt::Key_Hangul_Jeonja,
 
165
    XKB_KEY_Hangul_Banja,            Qt::Key_Hangul_Banja,
 
166
    XKB_KEY_Hangul_PreHanja,         Qt::Key_Hangul_PreHanja,
 
167
    XKB_KEY_Hangul_PostHanja,        Qt::Key_Hangul_PostHanja,
 
168
    //XKB_KEY_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate,
 
169
    //XKB_KEY_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate,
 
170
    //XKB_KEY_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate,
 
171
    XKB_KEY_Hangul_SingleCandidate,  Qt::Key_SingleCandidate,
 
172
    XKB_KEY_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate,
 
173
    XKB_KEY_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate,
 
174
    XKB_KEY_Hangul_Special,          Qt::Key_Hangul_Special,
 
175
    //XKB_KEY_Hangul_switch,         Qt::Key_Hangul_switch,
 
176
    XKB_KEY_Hangul_switch,           Qt::Key_Mode_switch,
 
177
#endif  // XKB_KEY_KOREAN
 
178
 
 
179
    // dead keys
 
180
    XKB_KEY_dead_grave,              Qt::Key_Dead_Grave,
 
181
    XKB_KEY_dead_acute,              Qt::Key_Dead_Acute,
 
182
    XKB_KEY_dead_circumflex,         Qt::Key_Dead_Circumflex,
 
183
    XKB_KEY_dead_tilde,              Qt::Key_Dead_Tilde,
 
184
    XKB_KEY_dead_macron,             Qt::Key_Dead_Macron,
 
185
    XKB_KEY_dead_breve,              Qt::Key_Dead_Breve,
 
186
    XKB_KEY_dead_abovedot,           Qt::Key_Dead_Abovedot,
 
187
    XKB_KEY_dead_diaeresis,          Qt::Key_Dead_Diaeresis,
 
188
    XKB_KEY_dead_abovering,          Qt::Key_Dead_Abovering,
 
189
    XKB_KEY_dead_doubleacute,        Qt::Key_Dead_Doubleacute,
 
190
    XKB_KEY_dead_caron,              Qt::Key_Dead_Caron,
 
191
    XKB_KEY_dead_cedilla,            Qt::Key_Dead_Cedilla,
 
192
    XKB_KEY_dead_ogonek,             Qt::Key_Dead_Ogonek,
 
193
    XKB_KEY_dead_iota,               Qt::Key_Dead_Iota,
 
194
    XKB_KEY_dead_voiced_sound,       Qt::Key_Dead_Voiced_Sound,
 
195
    XKB_KEY_dead_semivoiced_sound,   Qt::Key_Dead_Semivoiced_Sound,
 
196
    XKB_KEY_dead_belowdot,           Qt::Key_Dead_Belowdot,
 
197
    XKB_KEY_dead_hook,               Qt::Key_Dead_Hook,
 
198
    XKB_KEY_dead_horn,               Qt::Key_Dead_Horn,
 
199
 
 
200
    // Special keys from X.org - This include multimedia keys,
 
201
    // wireless/bluetooth/uwb keys, special launcher keys, etc.
 
202
    XKB_KEY_XF86Back,                Qt::Key_Back,
 
203
    XKB_KEY_XF86Forward,             Qt::Key_Forward,
 
204
    XKB_KEY_XF86Stop,                Qt::Key_Stop,
 
205
    XKB_KEY_XF86Refresh,             Qt::Key_Refresh,
 
206
    XKB_KEY_XF86Favorites,           Qt::Key_Favorites,
 
207
    XKB_KEY_XF86AudioMedia,          Qt::Key_LaunchMedia,
 
208
    XKB_KEY_XF86OpenURL,             Qt::Key_OpenUrl,
 
209
    XKB_KEY_XF86HomePage,            Qt::Key_HomePage,
 
210
    XKB_KEY_XF86Search,              Qt::Key_Search,
 
211
    XKB_KEY_XF86AudioLowerVolume,    Qt::Key_VolumeDown,
 
212
    XKB_KEY_XF86AudioMute,           Qt::Key_VolumeMute,
110
213
    XKB_KEY_XF86AudioRaiseVolume,    Qt::Key_VolumeUp,
111
 
    XKB_KEY_XF86AudioLowerVolume,    Qt::Key_VolumeDown,
112
 
    XKB_KEY_XF86PowerOff,            Qt::Key_PowerOff,
113
 
    XKB_KEY_XF86PowerDown,           Qt::Key_PowerDown,
114
 
 
115
 
    /* Bluetooth / Wired headset multimedia keys */
116
214
    XKB_KEY_XF86AudioPlay,           Qt::Key_MediaPlay,
 
215
    XKB_KEY_XF86AudioStop,           Qt::Key_MediaStop,
117
216
    XKB_KEY_XF86AudioPrev,           Qt::Key_MediaPrevious,
118
217
    XKB_KEY_XF86AudioNext,           Qt::Key_MediaNext,
 
218
    XKB_KEY_XF86AudioRecord,         Qt::Key_MediaRecord,
119
219
    XKB_KEY_XF86AudioPause,          Qt::Key_MediaPause,
120
 
    XKB_KEY_XF86AudioMedia,          Qt::Key_MediaTogglePlayPause,
 
220
    XKB_KEY_XF86Mail,                Qt::Key_LaunchMail,
 
221
    XKB_KEY_XF86MyComputer,          Qt::Key_Launch0,  // ### Qt 6: remap properly
 
222
    XKB_KEY_XF86Calculator,          Qt::Key_Launch1,
 
223
    XKB_KEY_XF86Memo,                Qt::Key_Memo,
 
224
    XKB_KEY_XF86ToDoList,            Qt::Key_ToDoList,
 
225
    XKB_KEY_XF86Calendar,            Qt::Key_Calendar,
 
226
    XKB_KEY_XF86PowerDown,           Qt::Key_PowerDown,
 
227
    XKB_KEY_XF86ContrastAdjust,      Qt::Key_ContrastAdjust,
 
228
    XKB_KEY_XF86Standby,             Qt::Key_Standby,
 
229
    XKB_KEY_XF86MonBrightnessUp,     Qt::Key_MonBrightnessUp,
 
230
    XKB_KEY_XF86MonBrightnessDown,   Qt::Key_MonBrightnessDown,
 
231
    XKB_KEY_XF86KbdLightOnOff,       Qt::Key_KeyboardLightOnOff,
 
232
    XKB_KEY_XF86KbdBrightnessUp,     Qt::Key_KeyboardBrightnessUp,
 
233
    XKB_KEY_XF86KbdBrightnessDown,   Qt::Key_KeyboardBrightnessDown,
 
234
    XKB_KEY_XF86PowerOff,            Qt::Key_PowerOff,
 
235
    XKB_KEY_XF86WakeUp,              Qt::Key_WakeUp,
 
236
    XKB_KEY_XF86Eject,               Qt::Key_Eject,
 
237
    XKB_KEY_XF86ScreenSaver,         Qt::Key_ScreenSaver,
 
238
    XKB_KEY_XF86WWW,                 Qt::Key_WWW,
 
239
    XKB_KEY_XF86Sleep,               Qt::Key_Sleep,
 
240
    XKB_KEY_XF86LightBulb,           Qt::Key_LightBulb,
 
241
    XKB_KEY_XF86Shop,                Qt::Key_Shop,
 
242
    XKB_KEY_XF86History,             Qt::Key_History,
 
243
    XKB_KEY_XF86AddFavorite,         Qt::Key_AddFavorite,
 
244
    XKB_KEY_XF86HotLinks,            Qt::Key_HotLinks,
 
245
    XKB_KEY_XF86BrightnessAdjust,    Qt::Key_BrightnessAdjust,
 
246
    XKB_KEY_XF86Finance,             Qt::Key_Finance,
 
247
    XKB_KEY_XF86Community,           Qt::Key_Community,
 
248
    XKB_KEY_XF86AudioRewind,         Qt::Key_AudioRewind,
 
249
    XKB_KEY_XF86BackForward,         Qt::Key_BackForward,
 
250
    XKB_KEY_XF86ApplicationLeft,     Qt::Key_ApplicationLeft,
 
251
    XKB_KEY_XF86ApplicationRight,    Qt::Key_ApplicationRight,
 
252
    XKB_KEY_XF86Book,                Qt::Key_Book,
 
253
    XKB_KEY_XF86CD,                  Qt::Key_CD,
 
254
    XKB_KEY_XF86Calculater,          Qt::Key_Calculator,
 
255
    XKB_KEY_XF86Clear,               Qt::Key_Clear,
 
256
    XKB_KEY_XF86ClearGrab,           Qt::Key_ClearGrab,
 
257
    XKB_KEY_XF86Close,               Qt::Key_Close,
 
258
    XKB_KEY_XF86Copy,                Qt::Key_Copy,
 
259
    XKB_KEY_XF86Cut,                 Qt::Key_Cut,
 
260
    XKB_KEY_XF86Display,             Qt::Key_Display,
 
261
    XKB_KEY_XF86DOS,                 Qt::Key_DOS,
 
262
    XKB_KEY_XF86Documents,           Qt::Key_Documents,
 
263
    XKB_KEY_XF86Excel,               Qt::Key_Excel,
 
264
    XKB_KEY_XF86Explorer,            Qt::Key_Explorer,
 
265
    XKB_KEY_XF86Game,                Qt::Key_Game,
 
266
    XKB_KEY_XF86Go,                  Qt::Key_Go,
 
267
    XKB_KEY_XF86iTouch,              Qt::Key_iTouch,
 
268
    XKB_KEY_XF86LogOff,              Qt::Key_LogOff,
 
269
    XKB_KEY_XF86Market,              Qt::Key_Market,
 
270
    XKB_KEY_XF86Meeting,             Qt::Key_Meeting,
 
271
    XKB_KEY_XF86MenuKB,              Qt::Key_MenuKB,
 
272
    XKB_KEY_XF86MenuPB,              Qt::Key_MenuPB,
 
273
    XKB_KEY_XF86MySites,             Qt::Key_MySites,
 
274
    XKB_KEY_XF86New,                 Qt::Key_New,
 
275
    XKB_KEY_XF86News,                Qt::Key_News,
 
276
    XKB_KEY_XF86OfficeHome,          Qt::Key_OfficeHome,
 
277
    XKB_KEY_XF86Open,                Qt::Key_Open,
 
278
    XKB_KEY_XF86Option,              Qt::Key_Option,
 
279
    XKB_KEY_XF86Paste,               Qt::Key_Paste,
 
280
    XKB_KEY_XF86Phone,               Qt::Key_Phone,
 
281
    XKB_KEY_XF86Reply,               Qt::Key_Reply,
 
282
    XKB_KEY_XF86Reload,              Qt::Key_Reload,
 
283
    XKB_KEY_XF86RotateWindows,       Qt::Key_RotateWindows,
 
284
    XKB_KEY_XF86RotationPB,          Qt::Key_RotationPB,
 
285
    XKB_KEY_XF86RotationKB,          Qt::Key_RotationKB,
 
286
    XKB_KEY_XF86Save,                Qt::Key_Save,
 
287
    XKB_KEY_XF86Send,                Qt::Key_Send,
 
288
    XKB_KEY_XF86Spell,               Qt::Key_Spell,
 
289
    XKB_KEY_XF86SplitScreen,         Qt::Key_SplitScreen,
 
290
    XKB_KEY_XF86Support,             Qt::Key_Support,
 
291
    XKB_KEY_XF86TaskPane,            Qt::Key_TaskPane,
 
292
    XKB_KEY_XF86Terminal,            Qt::Key_Terminal,
 
293
    XKB_KEY_XF86Tools,               Qt::Key_Tools,
 
294
    XKB_KEY_XF86Travel,              Qt::Key_Travel,
 
295
    XKB_KEY_XF86Video,               Qt::Key_Video,
 
296
    XKB_KEY_XF86Word,                Qt::Key_Word,
 
297
    XKB_KEY_XF86Xfer,                Qt::Key_Xfer,
 
298
    XKB_KEY_XF86ZoomIn,              Qt::Key_ZoomIn,
 
299
    XKB_KEY_XF86ZoomOut,             Qt::Key_ZoomOut,
 
300
    XKB_KEY_XF86Away,                Qt::Key_Away,
 
301
    XKB_KEY_XF86Messenger,           Qt::Key_Messenger,
 
302
    XKB_KEY_XF86WebCam,              Qt::Key_WebCam,
 
303
    XKB_KEY_XF86MailForward,         Qt::Key_MailForward,
 
304
    XKB_KEY_XF86Pictures,            Qt::Key_Pictures,
 
305
    XKB_KEY_XF86Music,               Qt::Key_Music,
 
306
    XKB_KEY_XF86Battery,             Qt::Key_Battery,
 
307
    XKB_KEY_XF86Bluetooth,           Qt::Key_Bluetooth,
 
308
    XKB_KEY_XF86WLAN,                Qt::Key_WLAN,
 
309
    XKB_KEY_XF86UWB,                 Qt::Key_UWB,
 
310
    XKB_KEY_XF86AudioForward,        Qt::Key_AudioForward,
 
311
    XKB_KEY_XF86AudioRepeat,         Qt::Key_AudioRepeat,
 
312
    XKB_KEY_XF86AudioRandomPlay,     Qt::Key_AudioRandomPlay,
 
313
    XKB_KEY_XF86Subtitle,            Qt::Key_Subtitle,
 
314
    XKB_KEY_XF86AudioCycleTrack,     Qt::Key_AudioCycleTrack,
 
315
    XKB_KEY_XF86Time,                Qt::Key_Time,
 
316
    XKB_KEY_XF86Select,              Qt::Key_Select,
 
317
    XKB_KEY_XF86View,                Qt::Key_View,
 
318
    XKB_KEY_XF86TopMenu,             Qt::Key_TopMenu,
 
319
    XKB_KEY_XF86Red,                 Qt::Key_Red,
 
320
    XKB_KEY_XF86Green,               Qt::Key_Green,
 
321
    XKB_KEY_XF86Yellow,              Qt::Key_Yellow,
 
322
    XKB_KEY_XF86Blue,                Qt::Key_Blue,
 
323
    XKB_KEY_XF86Bluetooth,           Qt::Key_Bluetooth,
 
324
    XKB_KEY_XF86Suspend,             Qt::Key_Suspend,
 
325
    XKB_KEY_XF86Hibernate,           Qt::Key_Hibernate,
 
326
    XKB_KEY_XF86TouchpadToggle,      Qt::Key_TouchpadToggle,
 
327
    XKB_KEY_XF86TouchpadOn,          Qt::Key_TouchpadOn,
 
328
    XKB_KEY_XF86TouchpadOff,         Qt::Key_TouchpadOff,
 
329
    XKB_KEY_XF86AudioMicMute,        Qt::Key_MicMute,
 
330
    XKB_KEY_XF86Launch0,             Qt::Key_Launch2, // ### Qt 6: remap properly
 
331
    XKB_KEY_XF86Launch1,             Qt::Key_Launch3,
 
332
    XKB_KEY_XF86Launch2,             Qt::Key_Launch4,
 
333
    XKB_KEY_XF86Launch3,             Qt::Key_Launch5,
 
334
    XKB_KEY_XF86Launch4,             Qt::Key_Launch6,
 
335
    XKB_KEY_XF86Launch5,             Qt::Key_Launch7,
 
336
    XKB_KEY_XF86Launch6,             Qt::Key_Launch8,
 
337
    XKB_KEY_XF86Launch7,             Qt::Key_Launch9,
 
338
    XKB_KEY_XF86Launch8,             Qt::Key_LaunchA,
 
339
    XKB_KEY_XF86Launch9,             Qt::Key_LaunchB,
 
340
    XKB_KEY_XF86LaunchA,             Qt::Key_LaunchC,
 
341
    XKB_KEY_XF86LaunchB,             Qt::Key_LaunchD,
 
342
    XKB_KEY_XF86LaunchC,             Qt::Key_LaunchE,
 
343
    XKB_KEY_XF86LaunchD,             Qt::Key_LaunchF,
 
344
    XKB_KEY_XF86LaunchE,             Qt::Key_LaunchG,
 
345
    XKB_KEY_XF86LaunchF,             Qt::Key_LaunchH,
121
346
 
122
347
    0,                          0
123
348
};
219
444
    delete mQtWindowSystem;
220
445
}
221
446
 
222
 
void QtEventFeeder::dispatch(MirEvent const& event)
 
447
bool QtEventFeeder::dispatch(MirEvent const& event)
223
448
{
224
449
    auto type = mir_event_get_type(&event);
225
450
    if (type != mir_event_type_input)
226
 
        return;
 
451
        return false;
227
452
    auto iev = mir_event_get_input_event(&event);
228
453
 
229
454
    switch (mir_input_event_get_type(iev)) {
238
463
    default:
239
464
        break;
240
465
    }
 
466
 
 
467
    return true;
241
468
}
242
469
 
243
470
namespace
269
496
    if (mir_pointer_event_button_state(pev, mir_pointer_button_secondary))
270
497
        buttons |= Qt::RightButton;
271
498
    if (mir_pointer_event_button_state(pev, mir_pointer_button_tertiary))
272
 
        buttons |= Qt::MidButton;
 
499
        buttons |= Qt::MiddleButton;
 
500
    if (mir_pointer_event_button_state(pev, mir_pointer_button_back))
 
501
        buttons |= Qt::BackButton;
 
502
    if (mir_pointer_event_button_state(pev, mir_pointer_button_forward))
 
503
        buttons |= Qt::ForwardButton;
273
504
 
274
 
    // TODO: Should mir back and forward buttons exist?
275
 
    // should they be Qt::X button 1 and 2?
276
505
    return static_cast<Qt::MouseButton>(buttons);
277
506
}
278
507
}
423
652
    // not used
424
653
}
425
654
 
426
 
void QtEventFeeder::configuration_changed(std::chrono::nanoseconds when)
427
 
{
428
 
    Q_UNUSED(when);
429
 
}
430
 
 
431
 
void QtEventFeeder::device_reset(int32_t device_id, std::chrono::nanoseconds when)
432
 
{
433
 
    Q_UNUSED(device_id);
434
 
    Q_UNUSED(when);
435
 
}
436
 
 
437
655
void QtEventFeeder::validateTouches(ulong timestamp,
438
656
        QList<QWindowSystemInterface::TouchPoint> &touchPoints)
439
657
{