qxcbkeyboard.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbkeyboard.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the plugins of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33#include "qxcbkeyboard.h"-
34#include "qxcbwindow.h"-
35#include "qxcbscreen.h"-
36-
37#include <qpa/qwindowsysteminterface.h>-
38#include <qpa/qplatforminputcontext.h>-
39#include <qpa/qplatformintegration.h>-
40#include <qpa/qplatformcursor.h>-
41-
42#include <QtCore/QTextCodec>-
43#include <QtCore/QMetaMethod>-
44#include <QtCore/QDir>-
45#include <private/qguiapplication_p.h>-
46-
47#include <stdio.h>-
48#include <X11/keysym.h>-
49-
50#ifdef XCB_USE_XINPUT22-
51#include <X11/extensions/XI2proto.h>-
52#undef KeyPress-
53#undef KeyRelease-
54#endif-
55-
56#ifndef XK_ISO_Left_Tab-
57#define XK_ISO_Left_Tab 0xFE20-
58#endif-
59-
60#ifndef XK_dead_hook-
61#define XK_dead_hook 0xFE61-
62#endif-
63-
64#ifndef XK_dead_horn-
65#define XK_dead_horn 0xFE62-
66#endif-
67-
68#ifndef XK_Codeinput-
69#define XK_Codeinput 0xFF37-
70#endif-
71-
72#ifndef XK_Kanji_Bangou-
73#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */-
74#endif-
75-
76// Fix old X libraries-
77#ifndef XK_KP_Home-
78#define XK_KP_Home 0xFF95-
79#endif-
80#ifndef XK_KP_Left-
81#define XK_KP_Left 0xFF96-
82#endif-
83#ifndef XK_KP_Up-
84#define XK_KP_Up 0xFF97-
85#endif-
86#ifndef XK_KP_Right-
87#define XK_KP_Right 0xFF98-
88#endif-
89#ifndef XK_KP_Down-
90#define XK_KP_Down 0xFF99-
91#endif-
92#ifndef XK_KP_Prior-
93#define XK_KP_Prior 0xFF9A-
94#endif-
95#ifndef XK_KP_Next-
96#define XK_KP_Next 0xFF9B-
97#endif-
98#ifndef XK_KP_End-
99#define XK_KP_End 0xFF9C-
100#endif-
101#ifndef XK_KP_Insert-
102#define XK_KP_Insert 0xFF9E-
103#endif-
104#ifndef XK_KP_Delete-
105#define XK_KP_Delete 0xFF9F-
106#endif-
107-
108// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special-
109// multimedia keys. They are included here as not every system has them.-
110#define XF86XK_MonBrightnessUp 0x1008FF02-
111#define XF86XK_MonBrightnessDown 0x1008FF03-
112#define XF86XK_KbdLightOnOff 0x1008FF04-
113#define XF86XK_KbdBrightnessUp 0x1008FF05-
114#define XF86XK_KbdBrightnessDown 0x1008FF06-
115#define XF86XK_Standby 0x1008FF10-
116#define XF86XK_AudioLowerVolume 0x1008FF11-
117#define XF86XK_AudioMute 0x1008FF12-
118#define XF86XK_AudioRaiseVolume 0x1008FF13-
119#define XF86XK_AudioPlay 0x1008FF14-
120#define XF86XK_AudioStop 0x1008FF15-
121#define XF86XK_AudioPrev 0x1008FF16-
122#define XF86XK_AudioNext 0x1008FF17-
123#define XF86XK_HomePage 0x1008FF18-
124#define XF86XK_Mail 0x1008FF19-
125#define XF86XK_Start 0x1008FF1A-
126#define XF86XK_Search 0x1008FF1B-
127#define XF86XK_AudioRecord 0x1008FF1C-
128#define XF86XK_Calculator 0x1008FF1D-
129#define XF86XK_Memo 0x1008FF1E-
130#define XF86XK_ToDoList 0x1008FF1F-
131#define XF86XK_Calendar 0x1008FF20-
132#define XF86XK_PowerDown 0x1008FF21-
133#define XF86XK_ContrastAdjust 0x1008FF22-
134#define XF86XK_Back 0x1008FF26-
135#define XF86XK_Forward 0x1008FF27-
136#define XF86XK_Stop 0x1008FF28-
137#define XF86XK_Refresh 0x1008FF29-
138#define XF86XK_PowerOff 0x1008FF2A-
139#define XF86XK_WakeUp 0x1008FF2B-
140#define XF86XK_Eject 0x1008FF2C-
141#define XF86XK_ScreenSaver 0x1008FF2D-
142#define XF86XK_WWW 0x1008FF2E-
143#define XF86XK_Sleep 0x1008FF2F-
144#define XF86XK_Favorites 0x1008FF30-
145#define XF86XK_AudioPause 0x1008FF31-
146#define XF86XK_AudioMedia 0x1008FF32-
147#define XF86XK_MyComputer 0x1008FF33-
148#define XF86XK_LightBulb 0x1008FF35-
149#define XF86XK_Shop 0x1008FF36-
150#define XF86XK_History 0x1008FF37-
151#define XF86XK_OpenURL 0x1008FF38-
152#define XF86XK_AddFavorite 0x1008FF39-
153#define XF86XK_HotLinks 0x1008FF3A-
154#define XF86XK_BrightnessAdjust 0x1008FF3B-
155#define XF86XK_Finance 0x1008FF3C-
156#define XF86XK_Community 0x1008FF3D-
157#define XF86XK_AudioRewind 0x1008FF3E-
158#define XF86XK_BackForward 0x1008FF3F-
159#define XF86XK_Launch0 0x1008FF40-
160#define XF86XK_Launch1 0x1008FF41-
161#define XF86XK_Launch2 0x1008FF42-
162#define XF86XK_Launch3 0x1008FF43-
163#define XF86XK_Launch4 0x1008FF44-
164#define XF86XK_Launch5 0x1008FF45-
165#define XF86XK_Launch6 0x1008FF46-
166#define XF86XK_Launch7 0x1008FF47-
167#define XF86XK_Launch8 0x1008FF48-
168#define XF86XK_Launch9 0x1008FF49-
169#define XF86XK_LaunchA 0x1008FF4A-
170#define XF86XK_LaunchB 0x1008FF4B-
171#define XF86XK_LaunchC 0x1008FF4C-
172#define XF86XK_LaunchD 0x1008FF4D-
173#define XF86XK_LaunchE 0x1008FF4E-
174#define XF86XK_LaunchF 0x1008FF4F-
175#define XF86XK_ApplicationLeft 0x1008FF50-
176#define XF86XK_ApplicationRight 0x1008FF51-
177#define XF86XK_Book 0x1008FF52-
178#define XF86XK_CD 0x1008FF53-
179#define XF86XK_Calculater 0x1008FF54-
180#define XF86XK_Clear 0x1008FF55-
181#define XF86XK_ClearGrab 0x1008FE21-
182#define XF86XK_Close 0x1008FF56-
183#define XF86XK_Copy 0x1008FF57-
184#define XF86XK_Cut 0x1008FF58-
185#define XF86XK_Display 0x1008FF59-
186#define XF86XK_DOS 0x1008FF5A-
187#define XF86XK_Documents 0x1008FF5B-
188#define XF86XK_Excel 0x1008FF5C-
189#define XF86XK_Explorer 0x1008FF5D-
190#define XF86XK_Game 0x1008FF5E-
191#define XF86XK_Go 0x1008FF5F-
192#define XF86XK_iTouch 0x1008FF60-
193#define XF86XK_LogOff 0x1008FF61-
194#define XF86XK_Market 0x1008FF62-
195#define XF86XK_Meeting 0x1008FF63-
196#define XF86XK_MenuKB 0x1008FF65-
197#define XF86XK_MenuPB 0x1008FF66-
198#define XF86XK_MySites 0x1008FF67-
199#define XF86XK_New 0x1008FF68-
200#define XF86XK_News 0x1008FF69-
201#define XF86XK_OfficeHome 0x1008FF6A-
202#define XF86XK_Open 0x1008FF6B-
203#define XF86XK_Option 0x1008FF6C-
204#define XF86XK_Paste 0x1008FF6D-
205#define XF86XK_Phone 0x1008FF6E-
206#define XF86XK_Reply 0x1008FF72-
207#define XF86XK_Reload 0x1008FF73-
208#define XF86XK_RotateWindows 0x1008FF74-
209#define XF86XK_RotationPB 0x1008FF75-
210#define XF86XK_RotationKB 0x1008FF76-
211#define XF86XK_Save 0x1008FF77-
212#define XF86XK_Send 0x1008FF7B-
213#define XF86XK_Spell 0x1008FF7C-
214#define XF86XK_SplitScreen 0x1008FF7D-
215#define XF86XK_Support 0x1008FF7E-
216#define XF86XK_TaskPane 0x1008FF7F-
217#define XF86XK_Terminal 0x1008FF80-
218#define XF86XK_Tools 0x1008FF81-
219#define XF86XK_Travel 0x1008FF82-
220#define XF86XK_Video 0x1008FF87-
221#define XF86XK_Word 0x1008FF89-
222#define XF86XK_Xfer 0x1008FF8A-
223#define XF86XK_ZoomIn 0x1008FF8B-
224#define XF86XK_ZoomOut 0x1008FF8C-
225#define XF86XK_Away 0x1008FF8D-
226#define XF86XK_Messenger 0x1008FF8E-
227#define XF86XK_WebCam 0x1008FF8F-
228#define XF86XK_MailForward 0x1008FF90-
229#define XF86XK_Pictures 0x1008FF91-
230#define XF86XK_Music 0x1008FF92-
231#define XF86XK_Battery 0x1008FF93-
232#define XF86XK_Bluetooth 0x1008FF94-
233#define XF86XK_WLAN 0x1008FF95-
234#define XF86XK_UWB 0x1008FF96-
235#define XF86XK_AudioForward 0x1008FF97-
236#define XF86XK_AudioRepeat 0x1008FF98-
237#define XF86XK_AudioRandomPlay 0x1008FF99-
238#define XF86XK_Subtitle 0x1008FF9A-
239#define XF86XK_AudioCycleTrack 0x1008FF9B-
240#define XF86XK_Time 0x1008FF9F-
241#define XF86XK_Select 0x1008FFA0-
242#define XF86XK_View 0x1008FFA1-
243#define XF86XK_TopMenu 0x1008FFA2-
244#define XF86XK_Red 0x1008FFA3-
245#define XF86XK_Green 0x1008FFA4-
246#define XF86XK_Yellow 0x1008FFA5-
247#define XF86XK_Blue 0x1008FFA6-
248#define XF86XK_Suspend 0x1008FFA7-
249#define XF86XK_Hibernate 0x1008FFA8-
250#define XF86XK_TouchpadToggle 0x1008FFA9-
251#define XF86XK_TouchpadOn 0x1008FFB0-
252#define XF86XK_TouchpadOff 0x1008FFB1-
253#define XF86XK_AudioMicMute 0x1008FFB2-
254-
255-
256// end of XF86keysyms.h-
257-
258QT_BEGIN_NAMESPACE-
259-
260// keyboard mapping table-
261static const unsigned int KeyTbl[] = {-
262-
263 // misc keys-
264-
265 XK_Escape, Qt::Key_Escape,-
266 XK_Tab, Qt::Key_Tab,-
267 XK_ISO_Left_Tab, Qt::Key_Backtab,-
268 XK_BackSpace, Qt::Key_Backspace,-
269 XK_Return, Qt::Key_Return,-
270 XK_Insert, Qt::Key_Insert,-
271 XK_Delete, Qt::Key_Delete,-
272 XK_Clear, Qt::Key_Delete,-
273 XK_Pause, Qt::Key_Pause,-
274 XK_Print, Qt::Key_Print,-
275 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq-
276 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq-
277-
278 // cursor movement-
279-
280 XK_Home, Qt::Key_Home,-
281 XK_End, Qt::Key_End,-
282 XK_Left, Qt::Key_Left,-
283 XK_Up, Qt::Key_Up,-
284 XK_Right, Qt::Key_Right,-
285 XK_Down, Qt::Key_Down,-
286 XK_Prior, Qt::Key_PageUp,-
287 XK_Next, Qt::Key_PageDown,-
288-
289 // modifiers-
290-
291 XK_Shift_L, Qt::Key_Shift,-
292 XK_Shift_R, Qt::Key_Shift,-
293 XK_Shift_Lock, Qt::Key_Shift,-
294 XK_Control_L, Qt::Key_Control,-
295 XK_Control_R, Qt::Key_Control,-
296 XK_Meta_L, Qt::Key_Meta,-
297 XK_Meta_R, Qt::Key_Meta,-
298 XK_Alt_L, Qt::Key_Alt,-
299 XK_Alt_R, Qt::Key_Alt,-
300 XK_Caps_Lock, Qt::Key_CapsLock,-
301 XK_Num_Lock, Qt::Key_NumLock,-
302 XK_Scroll_Lock, Qt::Key_ScrollLock,-
303 XK_Super_L, Qt::Key_Super_L,-
304 XK_Super_R, Qt::Key_Super_R,-
305 XK_Menu, Qt::Key_Menu,-
306 XK_Hyper_L, Qt::Key_Hyper_L,-
307 XK_Hyper_R, Qt::Key_Hyper_R,-
308 XK_Help, Qt::Key_Help,-
309 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab-
310 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11)-
311 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12)-
312-
313 // numeric and function keypad keys-
314-
315 XK_KP_Space, Qt::Key_Space,-
316 XK_KP_Tab, Qt::Key_Tab,-
317 XK_KP_Enter, Qt::Key_Enter,-
318 //XK_KP_F1, Qt::Key_F1,-
319 //XK_KP_F2, Qt::Key_F2,-
320 //XK_KP_F3, Qt::Key_F3,-
321 //XK_KP_F4, Qt::Key_F4,-
322 XK_KP_Home, Qt::Key_Home,-
323 XK_KP_Left, Qt::Key_Left,-
324 XK_KP_Up, Qt::Key_Up,-
325 XK_KP_Right, Qt::Key_Right,-
326 XK_KP_Down, Qt::Key_Down,-
327 XK_KP_Prior, Qt::Key_PageUp,-
328 XK_KP_Next, Qt::Key_PageDown,-
329 XK_KP_End, Qt::Key_End,-
330 XK_KP_Begin, Qt::Key_Clear,-
331 XK_KP_Insert, Qt::Key_Insert,-
332 XK_KP_Delete, Qt::Key_Delete,-
333 XK_KP_Equal, Qt::Key_Equal,-
334 XK_KP_Multiply, Qt::Key_Asterisk,-
335 XK_KP_Add, Qt::Key_Plus,-
336 XK_KP_Separator, Qt::Key_Comma,-
337 XK_KP_Subtract, Qt::Key_Minus,-
338 XK_KP_Decimal, Qt::Key_Period,-
339 XK_KP_Divide, Qt::Key_Slash,-
340-
341 // International input method support keys-
342-
343 // International & multi-key character composition-
344 XK_ISO_Level3_Shift, Qt::Key_AltGr,-
345 XK_Multi_key, Qt::Key_Multi_key,-
346 XK_Codeinput, Qt::Key_Codeinput,-
347 XK_SingleCandidate, Qt::Key_SingleCandidate,-
348 XK_MultipleCandidate, Qt::Key_MultipleCandidate,-
349 XK_PreviousCandidate, Qt::Key_PreviousCandidate,-
350-
351 // Misc Functions-
352 XK_Mode_switch, Qt::Key_Mode_switch,-
353 XK_script_switch, Qt::Key_Mode_switch,-
354-
355 // Japanese keyboard support-
356 XK_Kanji, Qt::Key_Kanji,-
357 XK_Muhenkan, Qt::Key_Muhenkan,-
358 //XK_Henkan_Mode, Qt::Key_Henkan_Mode,-
359 XK_Henkan_Mode, Qt::Key_Henkan,-
360 XK_Henkan, Qt::Key_Henkan,-
361 XK_Romaji, Qt::Key_Romaji,-
362 XK_Hiragana, Qt::Key_Hiragana,-
363 XK_Katakana, Qt::Key_Katakana,-
364 XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana,-
365 XK_Zenkaku, Qt::Key_Zenkaku,-
366 XK_Hankaku, Qt::Key_Hankaku,-
367 XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku,-
368 XK_Touroku, Qt::Key_Touroku,-
369 XK_Massyo, Qt::Key_Massyo,-
370 XK_Kana_Lock, Qt::Key_Kana_Lock,-
371 XK_Kana_Shift, Qt::Key_Kana_Shift,-
372 XK_Eisu_Shift, Qt::Key_Eisu_Shift,-
373 XK_Eisu_toggle, Qt::Key_Eisu_toggle,-
374 //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou,-
375 //XK_Zen_Koho, Qt::Key_Zen_Koho,-
376 //XK_Mae_Koho, Qt::Key_Mae_Koho,-
377 XK_Kanji_Bangou, Qt::Key_Codeinput,-
378 XK_Zen_Koho, Qt::Key_MultipleCandidate,-
379 XK_Mae_Koho, Qt::Key_PreviousCandidate,-
380-
381#ifdef XK_KOREAN-
382 // Korean keyboard support-
383 XK_Hangul, Qt::Key_Hangul,-
384 XK_Hangul_Start, Qt::Key_Hangul_Start,-
385 XK_Hangul_End, Qt::Key_Hangul_End,-
386 XK_Hangul_Hanja, Qt::Key_Hangul_Hanja,-
387 XK_Hangul_Jamo, Qt::Key_Hangul_Jamo,-
388 XK_Hangul_Romaja, Qt::Key_Hangul_Romaja,-
389 //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput,-
390 XK_Hangul_Codeinput, Qt::Key_Codeinput,-
391 XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja,-
392 XK_Hangul_Banja, Qt::Key_Hangul_Banja,-
393 XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja,-
394 XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja,-
395 //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate,-
396 //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate,-
397 //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate,-
398 XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate,-
399 XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate,-
400 XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate,-
401 XK_Hangul_Special, Qt::Key_Hangul_Special,-
402 //XK_Hangul_switch, Qt::Key_Hangul_switch,-
403 XK_Hangul_switch, Qt::Key_Mode_switch,-
404#endif // XK_KOREAN-
405-
406 // dead keys-
407 XK_dead_grave, Qt::Key_Dead_Grave,-
408 XK_dead_acute, Qt::Key_Dead_Acute,-
409 XK_dead_circumflex, Qt::Key_Dead_Circumflex,-
410 XK_dead_tilde, Qt::Key_Dead_Tilde,-
411 XK_dead_macron, Qt::Key_Dead_Macron,-
412 XK_dead_breve, Qt::Key_Dead_Breve,-
413 XK_dead_abovedot, Qt::Key_Dead_Abovedot,-
414 XK_dead_diaeresis, Qt::Key_Dead_Diaeresis,-
415 XK_dead_abovering, Qt::Key_Dead_Abovering,-
416 XK_dead_doubleacute, Qt::Key_Dead_Doubleacute,-
417 XK_dead_caron, Qt::Key_Dead_Caron,-
418 XK_dead_cedilla, Qt::Key_Dead_Cedilla,-
419 XK_dead_ogonek, Qt::Key_Dead_Ogonek,-
420 XK_dead_iota, Qt::Key_Dead_Iota,-
421 XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound,-
422 XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound,-
423 XK_dead_belowdot, Qt::Key_Dead_Belowdot,-
424 XK_dead_hook, Qt::Key_Dead_Hook,-
425 XK_dead_horn, Qt::Key_Dead_Horn,-
426-
427 // Special keys from X.org - This include multimedia keys,-
428 // wireless/bluetooth/uwb keys, special launcher keys, etc.-
429 XF86XK_Back, Qt::Key_Back,-
430 XF86XK_Forward, Qt::Key_Forward,-
431 XF86XK_Stop, Qt::Key_Stop,-
432 XF86XK_Refresh, Qt::Key_Refresh,-
433 XF86XK_Favorites, Qt::Key_Favorites,-
434 XF86XK_AudioMedia, Qt::Key_LaunchMedia,-
435 XF86XK_OpenURL, Qt::Key_OpenUrl,-
436 XF86XK_HomePage, Qt::Key_HomePage,-
437 XF86XK_Search, Qt::Key_Search,-
438 XF86XK_AudioLowerVolume, Qt::Key_VolumeDown,-
439 XF86XK_AudioMute, Qt::Key_VolumeMute,-
440 XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp,-
441 XF86XK_AudioPlay, Qt::Key_MediaPlay,-
442 XF86XK_AudioStop, Qt::Key_MediaStop,-
443 XF86XK_AudioPrev, Qt::Key_MediaPrevious,-
444 XF86XK_AudioNext, Qt::Key_MediaNext,-
445 XF86XK_AudioRecord, Qt::Key_MediaRecord,-
446 XF86XK_AudioPause, Qt::Key_MediaPause,-
447 XF86XK_Mail, Qt::Key_LaunchMail,-
448 XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 6: remap properly-
449 XF86XK_Calculator, Qt::Key_Launch1,-
450 XF86XK_Memo, Qt::Key_Memo,-
451 XF86XK_ToDoList, Qt::Key_ToDoList,-
452 XF86XK_Calendar, Qt::Key_Calendar,-
453 XF86XK_PowerDown, Qt::Key_PowerDown,-
454 XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust,-
455 XF86XK_Standby, Qt::Key_Standby,-
456 XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp,-
457 XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown,-
458 XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff,-
459 XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp,-
460 XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown,-
461 XF86XK_PowerOff, Qt::Key_PowerOff,-
462 XF86XK_WakeUp, Qt::Key_WakeUp,-
463 XF86XK_Eject, Qt::Key_Eject,-
464 XF86XK_ScreenSaver, Qt::Key_ScreenSaver,-
465 XF86XK_WWW, Qt::Key_WWW,-
466 XF86XK_Sleep, Qt::Key_Sleep,-
467 XF86XK_LightBulb, Qt::Key_LightBulb,-
468 XF86XK_Shop, Qt::Key_Shop,-
469 XF86XK_History, Qt::Key_History,-
470 XF86XK_AddFavorite, Qt::Key_AddFavorite,-
471 XF86XK_HotLinks, Qt::Key_HotLinks,-
472 XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust,-
473 XF86XK_Finance, Qt::Key_Finance,-
474 XF86XK_Community, Qt::Key_Community,-
475 XF86XK_AudioRewind, Qt::Key_AudioRewind,-
476 XF86XK_BackForward, Qt::Key_BackForward,-
477 XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft,-
478 XF86XK_ApplicationRight, Qt::Key_ApplicationRight,-
479 XF86XK_Book, Qt::Key_Book,-
480 XF86XK_CD, Qt::Key_CD,-
481 XF86XK_Calculater, Qt::Key_Calculator,-
482 XF86XK_Clear, Qt::Key_Clear,-
483 XF86XK_ClearGrab, Qt::Key_ClearGrab,-
484 XF86XK_Close, Qt::Key_Close,-
485 XF86XK_Copy, Qt::Key_Copy,-
486 XF86XK_Cut, Qt::Key_Cut,-
487 XF86XK_Display, Qt::Key_Display,-
488 XF86XK_DOS, Qt::Key_DOS,-
489 XF86XK_Documents, Qt::Key_Documents,-
490 XF86XK_Excel, Qt::Key_Excel,-
491 XF86XK_Explorer, Qt::Key_Explorer,-
492 XF86XK_Game, Qt::Key_Game,-
493 XF86XK_Go, Qt::Key_Go,-
494 XF86XK_iTouch, Qt::Key_iTouch,-
495 XF86XK_LogOff, Qt::Key_LogOff,-
496 XF86XK_Market, Qt::Key_Market,-
497 XF86XK_Meeting, Qt::Key_Meeting,-
498 XF86XK_MenuKB, Qt::Key_MenuKB,-
499 XF86XK_MenuPB, Qt::Key_MenuPB,-
500 XF86XK_MySites, Qt::Key_MySites,-
501 XF86XK_New, Qt::Key_New,-
502 XF86XK_News, Qt::Key_News,-
503 XF86XK_OfficeHome, Qt::Key_OfficeHome,-
504 XF86XK_Open, Qt::Key_Open,-
505 XF86XK_Option, Qt::Key_Option,-
506 XF86XK_Paste, Qt::Key_Paste,-
507 XF86XK_Phone, Qt::Key_Phone,-
508 XF86XK_Reply, Qt::Key_Reply,-
509 XF86XK_Reload, Qt::Key_Reload,-
510 XF86XK_RotateWindows, Qt::Key_RotateWindows,-
511 XF86XK_RotationPB, Qt::Key_RotationPB,-
512 XF86XK_RotationKB, Qt::Key_RotationKB,-
513 XF86XK_Save, Qt::Key_Save,-
514 XF86XK_Send, Qt::Key_Send,-
515 XF86XK_Spell, Qt::Key_Spell,-
516 XF86XK_SplitScreen, Qt::Key_SplitScreen,-
517 XF86XK_Support, Qt::Key_Support,-
518 XF86XK_TaskPane, Qt::Key_TaskPane,-
519 XF86XK_Terminal, Qt::Key_Terminal,-
520 XF86XK_Tools, Qt::Key_Tools,-
521 XF86XK_Travel, Qt::Key_Travel,-
522 XF86XK_Video, Qt::Key_Video,-
523 XF86XK_Word, Qt::Key_Word,-
524 XF86XK_Xfer, Qt::Key_Xfer,-
525 XF86XK_ZoomIn, Qt::Key_ZoomIn,-
526 XF86XK_ZoomOut, Qt::Key_ZoomOut,-
527 XF86XK_Away, Qt::Key_Away,-
528 XF86XK_Messenger, Qt::Key_Messenger,-
529 XF86XK_WebCam, Qt::Key_WebCam,-
530 XF86XK_MailForward, Qt::Key_MailForward,-
531 XF86XK_Pictures, Qt::Key_Pictures,-
532 XF86XK_Music, Qt::Key_Music,-
533 XF86XK_Battery, Qt::Key_Battery,-
534 XF86XK_Bluetooth, Qt::Key_Bluetooth,-
535 XF86XK_WLAN, Qt::Key_WLAN,-
536 XF86XK_UWB, Qt::Key_UWB,-
537 XF86XK_AudioForward, Qt::Key_AudioForward,-
538 XF86XK_AudioRepeat, Qt::Key_AudioRepeat,-
539 XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay,-
540 XF86XK_Subtitle, Qt::Key_Subtitle,-
541 XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack,-
542 XF86XK_Time, Qt::Key_Time,-
543 XF86XK_Select, Qt::Key_Select,-
544 XF86XK_View, Qt::Key_View,-
545 XF86XK_TopMenu, Qt::Key_TopMenu,-
546 XF86XK_Red, Qt::Key_Red,-
547 XF86XK_Green, Qt::Key_Green,-
548 XF86XK_Yellow, Qt::Key_Yellow,-
549 XF86XK_Blue, Qt::Key_Blue,-
550 XF86XK_Bluetooth, Qt::Key_Bluetooth,-
551 XF86XK_Suspend, Qt::Key_Suspend,-
552 XF86XK_Hibernate, Qt::Key_Hibernate,-
553 XF86XK_TouchpadToggle, Qt::Key_TouchpadToggle,-
554 XF86XK_TouchpadOn, Qt::Key_TouchpadOn,-
555 XF86XK_TouchpadOff, Qt::Key_TouchpadOff,-
556 XF86XK_AudioMicMute, Qt::Key_MicMute,-
557 XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 6: remap properly-
558 XF86XK_Launch1, Qt::Key_Launch3,-
559 XF86XK_Launch2, Qt::Key_Launch4,-
560 XF86XK_Launch3, Qt::Key_Launch5,-
561 XF86XK_Launch4, Qt::Key_Launch6,-
562 XF86XK_Launch5, Qt::Key_Launch7,-
563 XF86XK_Launch6, Qt::Key_Launch8,-
564 XF86XK_Launch7, Qt::Key_Launch9,-
565 XF86XK_Launch8, Qt::Key_LaunchA,-
566 XF86XK_Launch9, Qt::Key_LaunchB,-
567 XF86XK_LaunchA, Qt::Key_LaunchC,-
568 XF86XK_LaunchB, Qt::Key_LaunchD,-
569 XF86XK_LaunchC, Qt::Key_LaunchE,-
570 XF86XK_LaunchD, Qt::Key_LaunchF,-
571 XF86XK_LaunchE, Qt::Key_LaunchG,-
572 XF86XK_LaunchF, Qt::Key_LaunchH,-
573-
574 0, 0-
575};-
576-
577// Possible modifier states.-
578static const Qt::KeyboardModifiers ModsTbl[] = {-
579 Qt::NoModifier, // 0-
580 Qt::ShiftModifier, // 1-
581 Qt::ControlModifier, // 2-
582 Qt::ControlModifier | Qt::ShiftModifier, // 3-
583 Qt::AltModifier, // 4-
584 Qt::AltModifier | Qt::ShiftModifier, // 5-
585 Qt::AltModifier | Qt::ControlModifier, // 6-
586 Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7-
587 Qt::NoModifier // Fall-back to raw Key_*, for non-latin1 kb layouts-
588};-
589-
590Qt::KeyboardModifiers QXcbKeyboard::translateModifiers(int s) const-
591{-
592 Qt::KeyboardModifiers ret = 0;-
593 if (s & XCB_MOD_MASK_SHIFT)
s & XCB_MOD_MASK_SHIFTDescription
TRUEnever evaluated
FALSEevaluated 386 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QItemView
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QStackedLayout
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QWidget
  • tst_QWindow
0-386
594 ret |= Qt::ShiftModifier;
never executed: ret |= Qt::ShiftModifier;
0
595 if (s & XCB_MOD_MASK_CONTROL)
s & XCB_MOD_MASK_CONTROLDescription
TRUEnever evaluated
FALSEevaluated 386 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QItemView
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QStackedLayout
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QWidget
  • tst_QWindow
0-386
596 ret |= Qt::ControlModifier;
never executed: ret |= Qt::ControlModifier;
0
597 if (s & rmod_masks.alt)
s & rmod_masks.altDescription
TRUEnever evaluated
FALSEevaluated 386 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QItemView
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QStackedLayout
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QWidget
  • tst_QWindow
0-386
598 ret |= Qt::AltModifier;
never executed: ret |= Qt::AltModifier;
0
599 if (s & rmod_masks.meta)
s & rmod_masks.metaDescription
TRUEnever evaluated
FALSEevaluated 386 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QItemView
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QStackedLayout
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QWidget
  • tst_QWindow
0-386
600 ret |= Qt::MetaModifier;
never executed: ret |= Qt::MetaModifier;
0
601 if (s & rmod_masks.altgr)
s & rmod_masks.altgrDescription
TRUEnever evaluated
FALSEevaluated 386 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QItemView
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QStackedLayout
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QWidget
  • tst_QWindow
0-386
602 ret |= Qt::GroupSwitchModifier;
never executed: ret |= Qt::GroupSwitchModifier;
0
603 return ret;
executed 386 times by 17 tests: return ret;
Executed by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QItemView
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QStackedLayout
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QWidget
  • tst_QWindow
386
604}-
605-
606void QXcbKeyboard::readXKBConfig()-
607{-
608 clearXKBConfig();-
609 xcb_generic_error_t *error;-
610 xcb_get_property_cookie_t cookie;-
611 xcb_get_property_reply_t *config_reply;-
612-
613 xcb_connection_t *c = xcb_connection();-
614 xcb_window_t rootWindow = connection()->rootWindow();-
615-
616 cookie = xcb_get_property(c, 0, rootWindow,-
617 atom(QXcbAtom::_XKB_RULES_NAMES), XCB_ATOM_STRING, 0, 1024);-
618-
619 config_reply = xcb_get_property_reply(c, cookie, &error);-
620 if (!config_reply) {
!config_replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
621 qWarning("Qt: Couldn't interpret the _XKB_RULES_NAMES property");-
622 return;
never executed: return;
0
623 }-
624 char *xkb_config = (char *)xcb_get_property_value(config_reply);-
625 int length = xcb_get_property_value_length(config_reply);-
626-
627 // on old X servers xkb_config can be 0 even if config_reply indicates a succesfull read-
628 if (!xkb_config || length == 0)
!xkb_configDescription
TRUEnever evaluated
FALSEnever evaluated
length == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
629 return;
never executed: return;
0
630 // ### TODO some X servers don't set _XKB_RULES_NAMES at all, in these cases it is filled-
631 // with gibberish, we would need to do some kind of sanity check-
632-
633 char *names[5] = { 0, 0, 0, 0, 0 };-
634 char *p = xkb_config, *end = p + length;-
635 int i = 0;-
636 // The result from xcb_get_property_value() is not necessarily \0-terminated,-
637 // we need to make sure that too many or missing '\0' symbols are handled safely.-
638 do {-
639 uint len = qstrnlen(p, length);-
640 names[i++] = p;-
641 p += len + 1;-
642 length -= len + 1;-
643 } while (p < end || i < 5);
never executed: end of block
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
i < 5Description
TRUEnever evaluated
FALSEnever evaluated
0
644-
645 xkb_names.rules = qstrdup(names[0]);-
646 xkb_names.model = qstrdup(names[1]);-
647 xkb_names.layout = qstrdup(names[2]);-
648 xkb_names.variant = qstrdup(names[3]);-
649 xkb_names.options = qstrdup(names[4]);-
650-
651 free(config_reply);-
652}
never executed: end of block
0
653-
654void QXcbKeyboard::clearXKBConfig()-
655{-
656 if (xkb_names.rules)
xkb_names.rulesDescription
TRUEnever evaluated
FALSEevaluated 341 times by 220 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
0-341
657 delete[] xkb_names.rules;
never executed: delete[] xkb_names.rules;
0
658 if (xkb_names.model)
xkb_names.modelDescription
TRUEnever evaluated
FALSEevaluated 341 times by 220 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
0-341
659 delete[] xkb_names.model;
never executed: delete[] xkb_names.model;
0
660 if (xkb_names.layout)
xkb_names.layoutDescription
TRUEnever evaluated
FALSEevaluated 341 times by 220 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
0-341
661 delete[] xkb_names.layout;
never executed: delete[] xkb_names.layout;
0
662 if (xkb_names.variant)
xkb_names.variantDescription
TRUEnever evaluated
FALSEevaluated 341 times by 220 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
0-341
663 delete[] xkb_names.variant;
never executed: delete[] xkb_names.variant;
0
664 if (xkb_names.options)
xkb_names.optionsDescription
TRUEnever evaluated
FALSEevaluated 341 times by 220 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
0-341
665 delete[] xkb_names.options;
never executed: delete[] xkb_names.options;
0
666 memset(&xkb_names, 0, sizeof(xkb_names));-
667}
executed 341 times by 220 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
341
668-
669void QXcbKeyboard::printKeymapError(const char *error) const-
670{-
671 qWarning() << error;-
672 if (xkb_context) {
xkb_contextDescription
TRUEnever evaluated
FALSEnever evaluated
0
673 qWarning() << "Current XKB configuration data search paths are: ";-
674 for (unsigned int i = 0; i < xkb_context_num_include_paths(xkb_context); ++i)
i < xkb_contex...s(xkb_context)Description
TRUEnever evaluated
FALSEnever evaluated
0
675 qWarning() << xkb_context_include_path_get(xkb_context, i);
never executed: QMessageLogger(__FILE__, 675, __PRETTY_FUNCTION__).warning() << xkb_context_include_path_get(xkb_context, i);
0
676 }
never executed: end of block
0
677 qWarning() << "Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, "-
678 "add ':' as separator to provide several search paths and/or make sure that XKB configuration data "-
679 "directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .";-
680}
never executed: end of block
0
681-
682void QXcbKeyboard::updateKeymap()-
683{-
684 m_config = true;-
685 // set xkb context object-
686 if (!xkb_context) {
!xkb_contextDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-129
687 if (qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")) {
qEnvironmentVa..._CONFIG_ROOT")Description
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
688 xkb_context = xkb_context_new((xkb_context_flags)XKB_CONTEXT_NO_DEFAULT_INCLUDES);-
689 QList<QByteArray> xkbRootList = QByteArray(qgetenv("QT_XKB_CONFIG_ROOT")).split(':');-
690 foreach (const QByteArray &xkbRoot, xkbRootList)-
691 xkb_context_include_path_append(xkb_context, xkbRoot.constData());
never executed: xkb_context_include_path_append(xkb_context, xkbRoot.constData());
0
692 } else {
never executed: end of block
0
693 xkb_context = xkb_context_new((xkb_context_flags)0);-
694 }
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
695 if (!xkb_context) {
!xkb_contextDescription
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
696 printKeymapError("Qt: Failed to create XKB context!");-
697 m_config = false;-
698 return;
never executed: return;
0
699 }-
700 // log only critical errors, we do our own error logging from printKeymapError()-
701 xkb_context_set_log_level(xkb_context, (xkb_log_level)XKB_LOG_LEVEL_CRITICAL);-
702 }
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
703 // update xkb keymap object-
704 xkb_keymap_unref(xkb_keymap);-
705 xkb_keymap = 0;-
706-
707 struct xkb_state *new_state = 0;-
708#ifndef QT_NO_XKB-
709 if (connection()->hasXKB()) {
connection()->hasXKB()Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-129
710 xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0);-
711 if (xkb_keymap) {
xkb_keymapDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-129
712 // Create a new keyboard state object for a keymap-
713 new_state = xkb_x11_state_new_from_device(xkb_keymap, xcb_connection(), core_device_id);-
714 }
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
715 }
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
716#endif-
717 if (!xkb_keymap) {
!xkb_keymapDescription
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
718 // Compile a keymap from RMLVO (rules, models, layouts, variants and options) names-
719 readXKBConfig();-
720 xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);-
721 if (!xkb_keymap) {
!xkb_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
722 // last fallback is to used hard-coded keymap name, see DEFAULT_XKB_* in xkbcommon.pri-
723 qWarning() << "Qt: Could not determine keyboard configuration data"-
724 " from X server, will use hard-coded keymap configuration.";-
725 clearXKBConfig();-
726 xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);-
727 }
never executed: end of block
0
728 if (xkb_keymap) {
xkb_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
729 new_state = xkb_state_new(xkb_keymap);-
730 } else {
never executed: end of block
0
731 printKeymapError("Qt: Failed to compile a keymap!");-
732 m_config = false;-
733 return;
never executed: return;
0
734 }-
735-
736 }-
737 if (!new_state) {
!new_stateDescription
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
738 qWarning("Qt: Failed to create xkb state!");-
739 m_config = false;-
740 return;
never executed: return;
0
741 }-
742 // update xkb state object-
743 xkb_state_unref(xkb_state);-
744 xkb_state = new_state;-
745 updateXKBMods();-
746-
747 checkForLatinLayout();-
748}
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
749-
750#ifndef QT_NO_XKB-
751void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state)-
752{-
753 if (m_config && connection()->hasXKB()) {
m_configDescription
TRUEnever evaluated
FALSEnever evaluated
connection()->hasXKB()Description
TRUEnever evaluated
FALSEnever evaluated
0
754 const xkb_state_component newState-
755 = xkb_state_update_mask(xkb_state,-
756 state->baseMods,-
757 state->latchedMods,-
758 state->lockedMods,-
759 state->baseGroup,-
760 state->latchedGroup,-
761 state->lockedGroup);-
762-
763 if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
0
764 //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");-
765 }
never executed: end of block
0
766 }
never executed: end of block
0
767}
never executed: end of block
0
768#endif-
769-
770void QXcbKeyboard::updateXKBStateFromState(struct xkb_state *kb_state, quint16 state)-
771{-
772 const quint32 modsDepressed = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_DEPRESSED);-
773 const quint32 modsLatched = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LATCHED);-
774 const quint32 modsLocked = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LOCKED);-
775 const quint32 xkbMask = xkbModMask(state);-
776-
777 const quint32 latched = modsLatched & xkbMask;-
778 const quint32 locked = modsLocked & xkbMask;-
779 quint32 depressed = modsDepressed & xkbMask;-
780 // set modifiers in depressed if they don't appear in any of the final masks-
781 depressed |= ~(depressed | latched | locked) & xkbMask;-
782-
783 const xkb_state_component newState-
784 = xkb_state_update_mask(kb_state,-
785 depressed,-
786 latched,-
787 locked,-
788 0,-
789 0,-
790 (state >> 13) & 3); // bits 13 and 14 report the state keyboard group-
791-
792 if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
0
793 //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");-
794 }
never executed: end of block
0
795}
never executed: end of block
0
796-
797void QXcbKeyboard::updateXKBStateFromCore(quint16 state)-
798{-
799 if (m_config && !connection()->hasXKB()) {
m_configDescription
TRUEnever evaluated
FALSEnever evaluated
!connection()->hasXKB()Description
TRUEnever evaluated
FALSEnever evaluated
0
800 updateXKBStateFromState(xkb_state, state);-
801 }
never executed: end of block
0
802}
never executed: end of block
0
803-
804#ifdef XCB_USE_XINPUT22-
805void QXcbKeyboard::updateXKBStateFromXI(void *modInfo, void *groupInfo)-
806{-
807 if (m_config && !connection()->hasXKB()) {
m_configDescription
TRUEevaluated 521 times by 32 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGridLayout
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QOpenGLWidget
  • tst_QPushButton
  • ...
FALSEnever evaluated
!connection()->hasXKB()Description
TRUEnever evaluated
FALSEevaluated 521 times by 32 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGridLayout
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QOpenGLWidget
  • tst_QPushButton
  • ...
0-521
808 xXIModifierInfo *mods = static_cast<xXIModifierInfo *>(modInfo);-
809 xXIGroupInfo *group = static_cast<xXIGroupInfo *>(groupInfo);-
810 const xkb_state_component newState = xkb_state_update_mask(xkb_state,-
811 mods->base_mods,-
812 mods->latched_mods,-
813 mods->locked_mods,-
814 group->base_group,-
815 group->latched_group,-
816 group->locked_group);-
817-
818 if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) {
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
0
819 //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)");-
820 }
never executed: end of block
0
821 }
never executed: end of block
0
822}
executed 521 times by 32 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGridLayout
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMainWindow
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QOpenGLWidget
  • tst_QPushButton
  • ...
521
823#endif-
824-
825quint32 QXcbKeyboard::xkbModMask(quint16 state)-
826{-
827 quint32 xkb_mask = 0;-
828-
829 if ((state & XCB_MOD_MASK_SHIFT) && xkb_mods.shift != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_SHIFT)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.shift != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
830 xkb_mask |= (1 << xkb_mods.shift);
never executed: xkb_mask |= (1 << xkb_mods.shift);
0
831 if ((state & XCB_MOD_MASK_LOCK) && xkb_mods.lock != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_LOCK)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.lock != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
832 xkb_mask |= (1 << xkb_mods.lock);
never executed: xkb_mask |= (1 << xkb_mods.lock);
0
833 if ((state & XCB_MOD_MASK_CONTROL) && xkb_mods.control != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_CONTROL)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.contr...= (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
834 xkb_mask |= (1 << xkb_mods.control);
never executed: xkb_mask |= (1 << xkb_mods.control);
0
835 if ((state & XCB_MOD_MASK_1) && xkb_mods.mod1 != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_1)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.mod1 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
836 xkb_mask |= (1 << xkb_mods.mod1);
never executed: xkb_mask |= (1 << xkb_mods.mod1);
0
837 if ((state & XCB_MOD_MASK_2) && xkb_mods.mod2 != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_2)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.mod2 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
838 xkb_mask |= (1 << xkb_mods.mod2);
never executed: xkb_mask |= (1 << xkb_mods.mod2);
0
839 if ((state & XCB_MOD_MASK_3) && xkb_mods.mod3 != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_3)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.mod3 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
840 xkb_mask |= (1 << xkb_mods.mod3);
never executed: xkb_mask |= (1 << xkb_mods.mod3);
0
841 if ((state & XCB_MOD_MASK_4) && xkb_mods.mod4 != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_4)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.mod4 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
842 xkb_mask |= (1 << xkb_mods.mod4);
never executed: xkb_mask |= (1 << xkb_mods.mod4);
0
843 if ((state & XCB_MOD_MASK_5) && xkb_mods.mod5 != XKB_MOD_INVALID)
(state & XCB_MOD_MASK_5)Description
TRUEnever evaluated
FALSEnever evaluated
xkb_mods.mod5 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
844 xkb_mask |= (1 << xkb_mods.mod5);
never executed: xkb_mask |= (1 << xkb_mods.mod5);
0
845-
846 return xkb_mask;
never executed: return xkb_mask;
0
847}-
848-
849void QXcbKeyboard::updateXKBMods()-
850{-
851 xkb_mods.shift = xkb_keymap_mod_get_index(xkb_keymap, XKB_MOD_NAME_SHIFT);-
852 xkb_mods.lock = xkb_keymap_mod_get_index(xkb_keymap, XKB_MOD_NAME_CAPS);-
853 xkb_mods.control = xkb_keymap_mod_get_index(xkb_keymap, XKB_MOD_NAME_CTRL);-
854 xkb_mods.mod1 = xkb_keymap_mod_get_index(xkb_keymap, "Mod1");-
855 xkb_mods.mod2 = xkb_keymap_mod_get_index(xkb_keymap, "Mod2");-
856 xkb_mods.mod3 = xkb_keymap_mod_get_index(xkb_keymap, "Mod3");-
857 xkb_mods.mod4 = xkb_keymap_mod_get_index(xkb_keymap, "Mod4");-
858 xkb_mods.mod5 = xkb_keymap_mod_get_index(xkb_keymap, "Mod5");-
859}
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
860-
861static bool isLatin(xkb_keysym_t sym)-
862{-
863 return ((sym >= 'a' && sym <= 'z') || (sym >= 'A' && sym <= 'Z'));
never executed: return ((sym >= 'a' && sym <= 'z') || (sym >= 'A' && sym <= 'Z'));
sym >= 'a'Description
TRUEnever evaluated
FALSEnever evaluated
sym <= 'z'Description
TRUEnever evaluated
FALSEnever evaluated
sym >= 'A'Description
TRUEnever evaluated
FALSEnever evaluated
sym <= 'Z'Description
TRUEnever evaluated
FALSEnever evaluated
0
864}-
865-
866void QXcbKeyboard::checkForLatinLayout()-
867{-
868 m_hasLatinLayout = false;-
869 const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts(xkb_keymap);-
870 const xcb_keycode_t minKeycode = connection()->setup()->min_keycode;-
871 const xcb_keycode_t maxKeycode = connection()->setup()->max_keycode;-
872 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
873 for (xkb_layout_index_t layout = 0; layout < layoutCount; ++layout) {
layout < layoutCountDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-129
874 xkb_state_update_mask(kb_state, 0, 0, 0, 0, 0, layout);-
875 for (xcb_keycode_t code = minKeycode; code < maxKeycode; ++code) {
code < maxKeycodeDescription
TRUEevaluated 2193 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-2193
876 xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code);-
877 // if layout can produce any of these latin letters (chosen-
878 // arbitrarily) then it must be a latin key based layout-
879 if (sym == XK_q || sym == XK_a || sym == XK_e) {
sym == 0x0071Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 2064 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
sym == 0x0061Description
TRUEnever evaluated
FALSEevaluated 2064 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
sym == 0x0065Description
TRUEnever evaluated
FALSEevaluated 2064 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-2064
880 m_hasLatinLayout = true;-
881 xkb_state_unref(kb_state);-
882 return;
executed 129 times by 5 tests: return;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
883 }-
884 }
executed 2064 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
2064
885 }
never executed: end of block
0
886 xkb_state_unref(kb_state);-
887}
never executed: end of block
0
888-
889xkb_keysym_t QXcbKeyboard::lookupLatinKeysym(xkb_keycode_t keycode) const-
890{-
891 xkb_layout_index_t layout;-
892 xkb_keysym_t sym = XKB_KEY_NoSymbol;-
893 const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts_for_key(xkb_keymap, keycode);-
894 const xkb_layout_index_t currentLayout = xkb_state_key_get_layout(xkb_state, keycode);-
895 // Look at user layouts in the order in which they are defined in system-
896 // settings to find a latin keysym.-
897 for (layout = 0; layout < layoutCount; ++layout) {
layout < layoutCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
898 if (layout == currentLayout)
layout == currentLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
899 continue;
never executed: continue;
0
900 const xkb_keysym_t *syms;-
901 xkb_level_index_t level = xkb_state_key_get_level(xkb_state, keycode, layout);-
902 if (xkb_keymap_key_get_syms_by_level(xkb_keymap, keycode, layout, level, &syms) != 1)
xkb_keymap_key...l, &syms) != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
903 continue;
never executed: continue;
0
904 if (isLatin(syms[0])) {
isLatin(syms[0])Description
TRUEnever evaluated
FALSEnever evaluated
0
905 sym = syms[0];-
906 break;
never executed: break;
0
907 }-
908 }
never executed: end of block
0
909 // If user layouts don't contain any layout that results in a latin key, we query a-
910 // key from "US" layout, this allows for latin-key-based shorcuts to work even when-
911 // users have only one (non-latin) layout set.-
912 xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);-
913 xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);-
914 if (sym == XKB_KEY_NoSymbol && !m_hasLatinLayout) {
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
!m_hasLatinLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
915 if (!latin_keymap) {
!latin_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
916 const struct xkb_rule_names names = { xkb_names.rules, xkb_names.model, "us", 0, 0 };-
917 latin_keymap = xkb_keymap_new_from_names(xkb_context, &names, (xkb_keymap_compile_flags)0);-
918 static bool printFailure = true;-
919 if (!latin_keymap && printFailure) {
!latin_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
printFailureDescription
TRUEnever evaluated
FALSEnever evaluated
0
920 // print message about failure to compile US keymap only once,-
921 // no need to do this on every key press.-
922 printFailure = false;-
923 printKeymapError("Qt: Failed to compile US keymap, shortcut handling with "-
924 "non-Latin keyboard layouts may not be fully functional!");-
925 }
never executed: end of block
0
926 }
never executed: end of block
0
927 if (latin_keymap) {
latin_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
0
928 struct xkb_state *latin_state = xkb_state_new(latin_keymap);-
929 if (latin_state) {
latin_stateDescription
TRUEnever evaluated
FALSEnever evaluated
0
930 xkb_state_update_mask(latin_state, 0, latchedMods, lockedMods, 0, 0, 0);-
931 sym = xkb_state_key_get_one_sym(latin_state, keycode);-
932 xkb_state_unref(latin_state);-
933 } else {
never executed: end of block
0
934 qWarning("QXcbKeyboard: failed to create a state for US keymap!");-
935 }
never executed: end of block
0
936 }-
937 }
never executed: end of block
0
938 if (sym == XKB_KEY_NoSymbol)
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
0
939 return sym;
never executed: return sym;
0
940 // Check for uniqueness, consider the following setup:-
941 // setxkbmap -layout us,ru,us -variant dvorak,, -option 'grp:ctrl_alt_toggle' (set 'ru' as active).-
942 // In this setup, the user would expect to trigger a ctrl+q shortcut by pressing ctrl+<physical x key>,-
943 // because "US dvorak" is higher up in the layout settings list. This check verifies that an obtained-
944 // 'sym' can not be acquired by any other layout higher up in the user's layout list. If it can be acquired-
945 // then the obtained key is not unique. This prevents ctrl+<physical q key> from generating a ctrl+q-
946 // shortcut in the above described setup. We don't want ctrl+<physical x key> and ctrl+<physical q key> to-
947 // generate the same shortcut event in this case.-
948 const xcb_keycode_t minKeycode = connection()->setup()->min_keycode;-
949 const xcb_keycode_t maxKeycode = connection()->setup()->max_keycode;-
950 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
951 for (xkb_layout_index_t prevLayout = 0; prevLayout < layout; ++prevLayout) {
prevLayout < layoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
952 xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, prevLayout);-
953 for (xcb_keycode_t code = minKeycode; code < maxKeycode; ++code) {
code < maxKeycodeDescription
TRUEnever evaluated
FALSEnever evaluated
0
954 xkb_keysym_t prevSym = xkb_state_key_get_one_sym(kb_state, code);-
955 if (prevSym == sym) {
prevSym == symDescription
TRUEnever evaluated
FALSEnever evaluated
0
956 sym = XKB_KEY_NoSymbol;-
957 break;
never executed: break;
0
958 }-
959 }
never executed: end of block
0
960 }
never executed: end of block
0
961 xkb_state_unref(kb_state);-
962 return sym;
never executed: return sym;
0
963}-
964-
965QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const-
966{-
967 // turn off the modifier bits which doesn't participate in shortcuts-
968 Qt::KeyboardModifiers notNeeded = Qt::KeypadModifier | Qt::GroupSwitchModifier;-
969 Qt::KeyboardModifiers modifiers = event->modifiers() &= ~notNeeded;-
970 // create a fresh kb state and test against the relevant modifier combinations-
971 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
972 if (!kb_state) {
!kb_stateDescription
TRUEnever evaluated
FALSEnever evaluated
0
973 qWarning("QXcbKeyboard: failed to compile xkb keymap!");-
974 return QList<int>();
never executed: return QList<int>();
0
975 }-
976 // get kb state from the master xkb_state and update the temporary kb_state-
977 xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LOCKED);-
978 xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);-
979 xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);-
980 xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED);-
981-
982 xkb_state_update_mask(kb_state, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout);-
983 quint32 keycode = event->nativeScanCode();-
984 // handle shortcuts for level three and above-
985 xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(kb_state, keycode);-
986 xkb_level_index_t levelIndex = 0;-
987 if (layoutIndex != XKB_LAYOUT_INVALID) {
layoutIndex != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
988 levelIndex = xkb_state_key_get_level(kb_state, keycode, layoutIndex);-
989 if (levelIndex == XKB_LEVEL_INVALID)
levelIndex == (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
0
990 levelIndex = 0;
never executed: levelIndex = 0;
0
991 }
never executed: end of block
0
992 if (levelIndex <= 1)
levelIndex <= 1Description
TRUEnever evaluated
FALSEnever evaluated
0
993 xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout);
never executed: xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout);
0
994-
995 xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, keycode);-
996 if (sym == XKB_KEY_NoSymbol) {
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
0
997 xkb_state_unref(kb_state);-
998 return QList<int>();
never executed: return QList<int>();
0
999 }-
1000-
1001 QList<int> result;-
1002 int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, keycode));-
1003 if (baseQtKey)
baseQtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
0
1004 result += (baseQtKey + modifiers);
never executed: result += (baseQtKey + modifiers);
0
1005-
1006 xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift");-
1007 xkb_mod_index_t altMod = xkb_keymap_mod_get_index(xkb_keymap, "Alt");-
1008 xkb_mod_index_t controlMod = xkb_keymap_mod_get_index(xkb_keymap, "Control");-
1009 xkb_mod_index_t metaMod = xkb_keymap_mod_get_index(xkb_keymap, "Meta");-
1010-
1011 Q_ASSERT(shiftMod < 32);-
1012 Q_ASSERT(altMod < 32);-
1013 Q_ASSERT(controlMod < 32);-
1014-
1015 xkb_mod_mask_t depressed;-
1016 int qtKey = 0;-
1017 // obtain a list of possible shortcuts for the given key event-
1018 for (uint i = 1; i < sizeof(ModsTbl) / sizeof(*ModsTbl) ; ++i) {
i < sizeof(Mod...zeof(*ModsTbl)Description
TRUEnever evaluated
FALSEnever evaluated
0
1019 Qt::KeyboardModifiers neededMods = ModsTbl[i];-
1020 if ((modifiers & neededMods) == neededMods) {
(modifiers & n... == neededModsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1021 if (i == 8) {
i == 8Description
TRUEnever evaluated
FALSEnever evaluated
0
1022 if (isLatin(baseQtKey))
isLatin(baseQtKey)Description
TRUEnever evaluated
FALSEnever evaluated
0
1023 continue;
never executed: continue;
0
1024 // add a latin key as a fall back key-
1025 sym = lookupLatinKeysym(keycode);-
1026 } else {
never executed: end of block
0
1027 depressed = 0;-
1028 if (neededMods & Qt::AltModifier)
neededMods & Qt::AltModifierDescription
TRUEnever evaluated
FALSEnever evaluated
0
1029 depressed |= (1 << altMod);
never executed: depressed |= (1 << altMod);
0
1030 if (neededMods & Qt::ShiftModifier)
neededMods & Qt::ShiftModifierDescription
TRUEnever evaluated
FALSEnever evaluated
0
1031 depressed |= (1 << shiftMod);
never executed: depressed |= (1 << shiftMod);
0
1032 if (neededMods & Qt::ControlModifier)
neededMods & Q...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
0
1033 depressed |= (1 << controlMod);
never executed: depressed |= (1 << controlMod);
0
1034 if (metaMod < 32 && neededMods & Qt::MetaModifier)
metaMod < 32Description
TRUEnever evaluated
FALSEnever evaluated
neededMods & Qt::MetaModifierDescription
TRUEnever evaluated
FALSEnever evaluated
0
1035 depressed |= (1 << metaMod);
never executed: depressed |= (1 << metaMod);
0
1036 xkb_state_update_mask(kb_state, depressed, latchedMods, lockedMods, 0, 0, lockedLayout);-
1037 sym = xkb_state_key_get_one_sym(kb_state, keycode);-
1038 }
never executed: end of block
0
1039 if (sym == XKB_KEY_NoSymbol)
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
0
1040 continue;
never executed: continue;
0
1041-
1042 Qt::KeyboardModifiers mods = modifiers & ~neededMods;-
1043 qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, keycode));-
1044 if (!qtKey || qtKey == baseQtKey)
!qtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
qtKey == baseQtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
0
1045 continue;
never executed: continue;
0
1046-
1047 // catch only more specific shortcuts, i.e. Ctrl+Shift+= also generates Ctrl++ and +,-
1048 // but Ctrl++ is more specific than +, so we should skip the last one-
1049 bool ambiguous = false;-
1050 foreach (int shortcut, result) {-
1051 if (int(shortcut & ~Qt::KeyboardModifierMask) == qtKey && (shortcut & mods) == mods) {
int(shortcut &...Mask) == qtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
(shortcut & mods) == modsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1052 ambiguous = true;-
1053 break;
never executed: break;
0
1054 }-
1055 }
never executed: end of block
0
1056 if (ambiguous)
ambiguousDescription
TRUEnever evaluated
FALSEnever evaluated
0
1057 continue;
never executed: continue;
0
1058-
1059 result += (qtKey + mods);-
1060 }
never executed: end of block
0
1061 }
never executed: end of block
0
1062 xkb_state_unref(kb_state);-
1063 return result;
never executed: return result;
0
1064 }-
1065-
1066int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const-
1067{-
1068 int code = 0;-
1069 int i = 0;-
1070 while (KeyTbl[i]) {
KeyTbl[i]Description
TRUEnever evaluated
FALSEnever evaluated
0
1071 if (key == KeyTbl[i]) {
key == KeyTbl[i]Description
TRUEnever evaluated
FALSEnever evaluated
0
1072 code = (int)KeyTbl[i+1];-
1073 break;
never executed: break;
0
1074 }-
1075 i += 2;-
1076 }
never executed: end of block
0
1077-
1078 if (rmod_masks.meta) {
rmod_masks.metaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1079 // translate Super/Hyper keys to Meta if we're using them as the MetaModifier-
1080 if (rmod_masks.meta == rmod_masks.super && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) {
rmod_masks.met...od_masks.superDescription
TRUEnever evaluated
FALSEnever evaluated
code == Qt::Key_Super_LDescription
TRUEnever evaluated
FALSEnever evaluated
code == Qt::Key_Super_RDescription
TRUEnever evaluated
FALSEnever evaluated
0
1081 code = Qt::Key_Meta;-
1082 } else if (rmod_masks.meta == rmod_masks.hyper && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) {
never executed: end of block
rmod_masks.met...od_masks.hyperDescription
TRUEnever evaluated
FALSEnever evaluated
code == Qt::Key_Hyper_LDescription
TRUEnever evaluated
FALSEnever evaluated
code == Qt::Key_Hyper_RDescription
TRUEnever evaluated
FALSEnever evaluated
0
1083 code = Qt::Key_Meta;-
1084 }
never executed: end of block
0
1085 }
never executed: end of block
0
1086-
1087 return code;
never executed: return code;
0
1088}-
1089-
1090int QXcbKeyboard::keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) const-
1091{-
1092 int code = 0;-
1093#ifndef QT_NO_TEXTCODEC-
1094 QTextCodec *systemCodec = QTextCodec::codecForLocale();-
1095#endif-
1096 // Commentary in X11/keysymdef says that X codes match ASCII, so it-
1097 // is safe to use the locale functions to process X codes in ISO8859-1.-
1098 // This is mainly for compatibility - applications should not use the-
1099 // Qt keycodes between 128 and 255 (extended ACSII codes), but should-
1100 // rather use the QKeyEvent::text().-
1101 if (keysym < 128 || (keysym < 256
keysym < 128Description
TRUEnever evaluated
FALSEnever evaluated
keysym < 256Description
TRUEnever evaluated
FALSEnever evaluated
0
1102#ifndef QT_NO_TEXTCODEC-
1103 && systemCodec->mibEnum() == 4
systemCodec->mibEnum() == 4Description
TRUEnever evaluated
FALSEnever evaluated
0
1104#endif-
1105 )) {-
1106 // upper-case key, if known-
1107 code = isprint((int)keysym) ? toupper((int)keysym) : 0;
isprint((int)keysym)Description
TRUEnever evaluated
FALSEnever evaluated
0
1108 } else if (keysym >= XK_F1 && keysym <= XK_F35) {
never executed: end of block
keysym >= 0xffbeDescription
TRUEnever evaluated
FALSEnever evaluated
keysym <= 0xffe0Description
TRUEnever evaluated
FALSEnever evaluated
0
1109 // function keys-
1110 code = Qt::Key_F1 + ((int)keysym - XK_F1);-
1111 } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) {
never executed: end of block
keysym >= 0xff80Description
TRUEnever evaluated
FALSEnever evaluated
keysym <= 0xffb9Description
TRUEnever evaluated
FALSEnever evaluated
0
1112 if (keysym >= XK_KP_0) {
keysym >= 0xffb0Description
TRUEnever evaluated
FALSEnever evaluated
0
1113 // numeric keypad keys-
1114 code = Qt::Key_0 + ((int)keysym - XK_KP_0);-
1115 } else {
never executed: end of block
0
1116 code = keysymToQtKey(keysym);-
1117 }
never executed: end of block
0
1118 modifiers |= Qt::KeypadModifier;-
1119 } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f
never executed: end of block
text.length() == 1Description
TRUEnever evaluated
FALSEnever evaluated
text.unicode()...icode() > 0x1fDescription
TRUEnever evaluated
FALSEnever evaluated
0
1120 && text.unicode()->unicode() != 0x7f
text.unicode()...code() != 0x7fDescription
TRUEnever evaluated
FALSEnever evaluated
0
1121 && !(keysym >= XK_dead_grave && keysym <= XK_dead_currency)) {
keysym >= 0xfe50Description
TRUEnever evaluated
FALSEnever evaluated
keysym <= 0xfe6fDescription
TRUEnever evaluated
FALSEnever evaluated
0
1122 code = text.unicode()->toUpper().unicode();-
1123 } else {
never executed: end of block
0
1124 // any other keys-
1125 code = keysymToQtKey(keysym);-
1126 }
never executed: end of block
0
1127-
1128 return code;
never executed: return code;
0
1129}-
1130-
1131QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)-
1132 : QXcbObject(connection)-
1133 , m_autorepeat_code(0)-
1134 , xkb_context(0)-
1135 , xkb_keymap(0)-
1136 , xkb_state(0)-
1137 , latin_keymap(0)-
1138 , m_hasLatinLayout(false)-
1139{-
1140 memset(&xkb_names, 0, sizeof(xkb_names));-
1141#ifndef QT_NO_XKB-
1142 core_device_id = 0;-
1143 if (connection->hasXKB()) {
connection->hasXKB()Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-129
1144 updateVModMapping();-
1145 updateVModToRModMapping();-
1146 core_device_id = xkb_x11_get_core_keyboard_device_id(xcb_connection());-
1147 if (core_device_id == -1) {
core_device_id == -1Description
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
1148 qWarning("Qt: couldn't get core keyboard device info");-
1149 return;
never executed: return;
0
1150 }-
1151 } else {
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1152#endif-
1153 m_key_symbols = xcb_key_symbols_alloc(xcb_connection());-
1154 updateModifiers();-
1155#ifndef QT_NO_XKB-
1156 }
never executed: end of block
0
1157#endif-
1158 updateKeymap();-
1159}
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1160-
1161QXcbKeyboard::~QXcbKeyboard()-
1162{-
1163 xkb_state_unref(xkb_state);-
1164 xkb_keymap_unref(xkb_keymap);-
1165 xkb_context_unref(xkb_context);-
1166 xkb_keymap_unref(latin_keymap);-
1167 if (!connection()->hasXKB())
!connection()->hasXKB()Description
TRUEnever evaluated
FALSEevaluated 341 times by 220 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
0-341
1168 xcb_key_symbols_free(m_key_symbols);
never executed: xcb_key_symbols_free(m_key_symbols);
0
1169 clearXKBConfig();-
1170}
executed 341 times by 220 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
341
1171-
1172void QXcbKeyboard::updateVModMapping()-
1173{-
1174#ifndef QT_NO_XKB-
1175 xcb_xkb_get_names_cookie_t names_cookie;-
1176 xcb_xkb_get_names_reply_t *name_reply;-
1177 xcb_xkb_get_names_value_list_t names_list;-
1178-
1179 memset(&vmod_masks, 0, sizeof(vmod_masks));-
1180-
1181 names_cookie = xcb_xkb_get_names(xcb_connection(),-
1182 XCB_XKB_ID_USE_CORE_KBD,-
1183 XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES);-
1184-
1185 name_reply = xcb_xkb_get_names_reply(xcb_connection(), names_cookie, 0);-
1186 if (!name_reply) {
!name_replyDescription
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
1187 qWarning("Qt: failed to retrieve the virtual modifier names from XKB");-
1188 return;
never executed: return;
0
1189 }-
1190-
1191 const void *buffer = xcb_xkb_get_names_value_list(name_reply);-
1192 xcb_xkb_get_names_value_list_unpack(buffer,-
1193 name_reply->nTypes,-
1194 name_reply->indicators,-
1195 name_reply->virtualMods,-
1196 name_reply->groupNames,-
1197 name_reply->nKeys,-
1198 name_reply->nKeyAliases,-
1199 name_reply->nRadioGroups,-
1200 name_reply->which,-
1201 &names_list);-
1202-
1203 int count = 0;-
1204 uint vmod_mask, bit;-
1205 char *vmod_name;-
1206 vmod_mask = name_reply->virtualMods;-
1207 // find the virtual modifiers for which names are defined.-
1208 for (bit = 1; vmod_mask; bit <<= 1) {
vmod_maskDescription
TRUEevaluated 1677 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1677
1209 vmod_name = 0;-
1210-
1211 if (!(vmod_mask & bit))
!(vmod_mask & bit)Description
TRUEnever evaluated
FALSEevaluated 1677 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-1677
1212 continue;
never executed: continue;
0
1213-
1214 vmod_mask &= ~bit;-
1215 // virtualModNames - the list of virtual modifier atoms beginning with the lowest-numbered-
1216 // virtual modifier for which a name is defined and proceeding to the highest.-
1217 QByteArray atomName = connection()->atomName(names_list.virtualModNames[count]);-
1218 vmod_name = atomName.data();-
1219 count++;-
1220-
1221 if (!vmod_name)
!vmod_nameDescription
TRUEnever evaluated
FALSEevaluated 1677 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-1677
1222 continue;
never executed: continue;
0
1223-
1224 // similarly we could retrieve NumLock, Super, Hyper modifiers if needed.-
1225 if (qstrcmp(vmod_name, "Alt") == 0)
qstrcmp(vmod_name, "Alt") == 0Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1548 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1548
1226 vmod_masks.alt = bit;
executed 129 times by 5 tests: vmod_masks.alt = bit;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1227 else if (qstrcmp(vmod_name, "Meta") == 0)
qstrcmp(vmod_n..., "Meta") == 0Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1419 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1419
1228 vmod_masks.meta = bit;
executed 129 times by 5 tests: vmod_masks.meta = bit;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1229 else if (qstrcmp(vmod_name, "AltGr") == 0)
qstrcmp(vmod_n... "AltGr") == 0Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1290 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1290
1230 vmod_masks.altgr = bit;
executed 129 times by 5 tests: vmod_masks.altgr = bit;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1231 else if (qstrcmp(vmod_name, "Super") == 0)
qstrcmp(vmod_n... "Super") == 0Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1161 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1161
1232 vmod_masks.super = bit;
executed 129 times by 5 tests: vmod_masks.super = bit;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1233 else if (qstrcmp(vmod_name, "Hyper") == 0)
qstrcmp(vmod_n... "Hyper") == 0Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1032 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1032
1234 vmod_masks.hyper = bit;
executed 129 times by 5 tests: vmod_masks.hyper = bit;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1235 }
executed 1677 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
1677
1236-
1237 free(name_reply);-
1238#endif-
1239}
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1240-
1241void QXcbKeyboard::updateVModToRModMapping()-
1242{-
1243#ifndef QT_NO_XKB-
1244 xcb_xkb_get_map_cookie_t map_cookie;-
1245 xcb_xkb_get_map_reply_t *map_reply;-
1246 xcb_xkb_get_map_map_t map;-
1247-
1248 memset(&rmod_masks, 0, sizeof(rmod_masks));-
1249-
1250 map_cookie = xcb_xkb_get_map(xcb_connection(),-
1251 XCB_XKB_ID_USE_CORE_KBD,-
1252 XCB_XKB_MAP_PART_VIRTUAL_MODS,-
1253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);-
1254-
1255 map_reply = xcb_xkb_get_map_reply(xcb_connection(), map_cookie, 0);-
1256 if (!map_reply) {
!map_replyDescription
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
1257 qWarning("Qt: failed to retrieve the virtual modifier map from XKB");-
1258 return;
never executed: return;
0
1259 }-
1260-
1261 const void *buffer = xcb_xkb_get_map_map(map_reply);-
1262 xcb_xkb_get_map_map_unpack(buffer,-
1263 map_reply->nTypes,-
1264 map_reply->nKeySyms,-
1265 map_reply->nKeyActions,-
1266 map_reply->totalActions,-
1267 map_reply->totalKeyBehaviors,-
1268 map_reply->nVModMapKeys,-
1269 map_reply->totalKeyExplicit,-
1270 map_reply->totalModMapKeys,-
1271 map_reply->totalVModMapKeys,-
1272 map_reply->present,-
1273 &map);-
1274-
1275 uint vmod_mask, bit;-
1276 // the virtual modifiers mask for which a set of corresponding-
1277 // real modifiers is to be returned-
1278 vmod_mask = map_reply->virtualMods;-
1279 int count = 0;-
1280-
1281 for (bit = 1; vmod_mask; bit <<= 1) {
vmod_maskDescription
TRUEevaluated 2064 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-2064
1282 uint modmap;-
1283-
1284 if (!(vmod_mask & bit))
!(vmod_mask & bit)Description
TRUEnever evaluated
FALSEevaluated 2064 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-2064
1285 continue;
never executed: continue;
0
1286-
1287 vmod_mask &= ~bit;-
1288 // real modifier bindings for the specified virtual modifiers-
1289 modmap = map.vmods_rtrn[count];-
1290 count++;-
1291-
1292 if (vmod_masks.alt == bit)
vmod_masks.alt == bitDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1935 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1935
1293 rmod_masks.alt = modmap;
executed 129 times by 5 tests: rmod_masks.alt = modmap;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1294 else if (vmod_masks.meta == bit)
vmod_masks.meta == bitDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1806 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1806
1295 rmod_masks.meta = modmap;
executed 129 times by 5 tests: rmod_masks.meta = modmap;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1296 else if (vmod_masks.altgr == bit)
vmod_masks.altgr == bitDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1677 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1677
1297 rmod_masks.altgr = modmap;
executed 129 times by 5 tests: rmod_masks.altgr = modmap;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1298 else if (vmod_masks.super == bit)
vmod_masks.super == bitDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1548 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1548
1299 rmod_masks.super = modmap;
executed 129 times by 5 tests: rmod_masks.super = modmap;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1300 else if (vmod_masks.hyper == bit)
vmod_masks.hyper == bitDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1419 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129-1419
1301 rmod_masks.hyper = modmap;
executed 129 times by 5 tests: rmod_masks.hyper = modmap;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1302 }
executed 2064 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
2064
1303-
1304 free(map_reply);-
1305 resolveMaskConflicts();-
1306#endif-
1307}
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1308-
1309void QXcbKeyboard::updateModifiers()-
1310{-
1311 // The core protocol does not provide a convenient way to determine the mapping-
1312 // of modifier bits. Clients must retrieve and search the modifier map to determine-
1313 // the keycodes bound to each modifier, and then retrieve and search the keyboard-
1314 // mapping to determine the keysyms bound to the keycodes. They must repeat this-
1315 // process for all modifiers whenever any part of the modifier mapping is changed.-
1316 memset(&rmod_masks, 0, sizeof(rmod_masks));-
1317-
1318 xcb_generic_error_t *error = 0;-
1319 xcb_connection_t *conn = xcb_connection();-
1320 xcb_get_modifier_mapping_cookie_t modMapCookie = xcb_get_modifier_mapping(conn);-
1321 xcb_get_modifier_mapping_reply_t *modMapReply =-
1322 xcb_get_modifier_mapping_reply(conn, modMapCookie, &error);-
1323 if (error) {
errorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1324 qWarning("Qt: failed to get modifier mapping");-
1325 free(error);-
1326 return;
never executed: return;
0
1327 }-
1328-
1329 // for Alt and Meta L and R are the same-
1330 static const xcb_keysym_t symbols[] = {-
1331 XK_Alt_L, XK_Meta_L, XK_Mode_switch, XK_Super_L, XK_Super_R,-
1332 XK_Hyper_L, XK_Hyper_R-
1333 };-
1334 static const size_t numSymbols = sizeof symbols / sizeof *symbols;-
1335-
1336 // Figure out the modifier mapping, ICCCM 6.6-
1337 xcb_keycode_t* modKeyCodes[numSymbols];-
1338 for (size_t i = 0; i < numSymbols; ++i)
i < numSymbolsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1339 modKeyCodes[i] = xcb_key_symbols_get_keycode(m_key_symbols, symbols[i]);
never executed: modKeyCodes[i] = xcb_key_symbols_get_keycode(m_key_symbols, symbols[i]);
0
1340-
1341 xcb_keycode_t *modMap = xcb_get_modifier_mapping_keycodes(modMapReply);-
1342 const int w = modMapReply->keycodes_per_modifier;-
1343 for (size_t i = 0; i < numSymbols; ++i) {
i < numSymbolsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1344 for (int bit = 0; bit < 8; ++bit) {
bit < 8Description
TRUEnever evaluated
FALSEnever evaluated
0
1345 uint mask = 1 << bit;-
1346 for (int x = 0; x < w; ++x) {
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
0
1347 xcb_keycode_t keyCode = modMap[x + bit * w];-
1348 xcb_keycode_t *itk = modKeyCodes[i];-
1349 while (itk && *itk != XCB_NO_SYMBOL)
itkDescription
TRUEnever evaluated
FALSEnever evaluated
*itk != 0LDescription
TRUEnever evaluated
FALSEnever evaluated
0
1350 if (*itk++ == keyCode) {
*itk++ == keyCodeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1351 uint sym = symbols[i];-
1352 if ((sym == XK_Alt_L || sym == XK_Alt_R))
sym == 0xffe9Description
TRUEnever evaluated
FALSEnever evaluated
sym == 0xffeaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1353 rmod_masks.alt = mask;
never executed: rmod_masks.alt = mask;
0
1354 if ((sym == XK_Meta_L || sym == XK_Meta_R))
sym == 0xffe7Description
TRUEnever evaluated
FALSEnever evaluated
sym == 0xffe8Description
TRUEnever evaluated
FALSEnever evaluated
0
1355 rmod_masks.meta = mask;
never executed: rmod_masks.meta = mask;
0
1356 if (sym == XK_Mode_switch)
sym == 0xff7eDescription
TRUEnever evaluated
FALSEnever evaluated
0
1357 rmod_masks.altgr = mask;
never executed: rmod_masks.altgr = mask;
0
1358 if ((sym == XK_Super_L) || (sym == XK_Super_R))
(sym == 0xffeb)Description
TRUEnever evaluated
FALSEnever evaluated
(sym == 0xffec)Description
TRUEnever evaluated
FALSEnever evaluated
0
1359 rmod_masks.super = mask;
never executed: rmod_masks.super = mask;
0
1360 if ((sym == XK_Hyper_L) || (sym == XK_Hyper_R))
(sym == 0xffed)Description
TRUEnever evaluated
FALSEnever evaluated
(sym == 0xffee)Description
TRUEnever evaluated
FALSEnever evaluated
0
1361 rmod_masks.hyper = mask;
never executed: rmod_masks.hyper = mask;
0
1362 }
never executed: end of block
0
1363 }
never executed: end of block
0
1364 }
never executed: end of block
0
1365 }
never executed: end of block
0
1366-
1367 for (size_t i = 0; i < numSymbols; ++i)
i < numSymbolsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1368 free(modKeyCodes[i]);
never executed: free(modKeyCodes[i]);
0
1369 free(modMapReply);-
1370 resolveMaskConflicts();-
1371}
never executed: end of block
0
1372-
1373void QXcbKeyboard::resolveMaskConflicts()-
1374{-
1375 // if we don't have a meta key (or it's hidden behind alt), use super or hyper to generate-
1376 // Qt::Key_Meta and Qt::MetaModifier, since most newer XFree86/Xorg installations map the Windows-
1377 // key to Super-
1378 if (rmod_masks.alt == rmod_masks.meta)
rmod_masks.alt...mod_masks.metaDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-129
1379 rmod_masks.meta = 0;
executed 129 times by 5 tests: rmod_masks.meta = 0;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1380-
1381 if (rmod_masks.meta == 0) {
rmod_masks.meta == 0Description
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-129
1382 // no meta keys... s/meta/super,-
1383 rmod_masks.meta = rmod_masks.super;-
1384 if (rmod_masks.meta == 0) {
rmod_masks.meta == 0Description
TRUEnever evaluated
FALSEevaluated 129 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-129
1385 // no super keys either? guess we'll use hyper then-
1386 rmod_masks.meta = rmod_masks.hyper;-
1387 }
never executed: end of block
0
1388 }
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1389}
executed 129 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
129
1390-
1391class KeyChecker-
1392{-
1393public:-
1394 KeyChecker(xcb_window_t window, xcb_keycode_t code, xcb_timestamp_t time)-
1395 : m_window(window)-
1396 , m_code(code)-
1397 , m_time(time)-
1398 , m_error(false)-
1399 , m_release(true)-
1400 {-
1401 }
never executed: end of block
0
1402-
1403 bool checkEvent(xcb_generic_event_t *ev)-
1404 {-
1405 if (m_error || !ev)
m_errorDescription
TRUEnever evaluated
FALSEnever evaluated
!evDescription
TRUEnever evaluated
FALSEnever evaluated
0
1406 return false;
never executed: return false;
0
1407-
1408 int type = ev->response_type & ~0x80;-
1409 if (type != XCB_KEY_PRESS && type != XCB_KEY_RELEASE)
type != 2Description
TRUEnever evaluated
FALSEnever evaluated
type != 3Description
TRUEnever evaluated
FALSEnever evaluated
0
1410 return false;
never executed: return false;
0
1411-
1412 xcb_key_press_event_t *event = (xcb_key_press_event_t *)ev;-
1413-
1414 if (event->event != m_window || event->detail != m_code) {
event->event != m_windowDescription
TRUEnever evaluated
FALSEnever evaluated
event->detail != m_codeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1415 m_error = true;-
1416 return false;
never executed: return false;
0
1417 }-
1418-
1419 if (type == XCB_KEY_PRESS) {
type == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
1420 m_error = !m_release || event->time - m_time > 10;
!m_releaseDescription
TRUEnever evaluated
FALSEnever evaluated
event->time - m_time > 10Description
TRUEnever evaluated
FALSEnever evaluated
0
1421 return !m_error;
never executed: return !m_error;
0
1422 }-
1423-
1424 if (m_release) {
m_releaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1425 m_error = true;-
1426 return false;
never executed: return false;
0
1427 }-
1428-
1429 m_release = true;-
1430 m_time = event->time;-
1431-
1432 return false;
never executed: return false;
0
1433 }-
1434-
1435 bool release() const { return m_release; }
never executed: return m_release;
0
1436 xcb_timestamp_t time() const { return m_time; }
never executed: return m_time;
0
1437-
1438private:-
1439 xcb_window_t m_window;-
1440 xcb_keycode_t m_code;-
1441 xcb_timestamp_t m_time;-
1442-
1443 bool m_error;-
1444 bool m_release;-
1445};-
1446-
1447void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code,-
1448 quint16 state, xcb_timestamp_t time)-
1449{-
1450 Q_XCB_NOOP(connection());-
1451-
1452 if (!m_config)
!m_configDescription
TRUEnever evaluated
FALSEnever evaluated
0
1453 return;
never executed: return;
0
1454-
1455 QXcbWindow *source = connection()->platformWindowFromId(sourceWindow);-
1456 QXcbWindow *targetWindow = connection()->focusWindow() ? connection()->focusWindow() : source;
connection()->focusWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
1457 if (!targetWindow || !source)
!targetWindowDescription
TRUEnever evaluated
FALSEnever evaluated
!sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
1458 return;
never executed: return;
0
1459 if (type == QEvent::KeyPress)
type == QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
0
1460 targetWindow->updateNetWmUserTime(time);
never executed: targetWindow->updateNetWmUserTime(time);
0
1461-
1462 // Have a temporary keyboard state filled in from state-
1463 // this way we allow for synthetic events to have different state-
1464 // from the current state i.e. you can have Alt+Ctrl pressed-
1465 // and receive a synthetic key event that has neither Alt nor Ctrl pressed-
1466 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
1467 if (!kb_state)
!kb_stateDescription
TRUEnever evaluated
FALSEnever evaluated
0
1468 return;
never executed: return;
0
1469 updateXKBStateFromState(kb_state, state);-
1470-
1471 xcb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code);-
1472-
1473 QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();-
1474 QMetaMethod method;-
1475-
1476 if (inputContext) {
inputContextDescription
TRUEnever evaluated
FALSEnever evaluated
0
1477 int methodIndex = inputContext->metaObject()->indexOfMethod("x11FilterEvent(uint,uint,uint,bool)");-
1478 if (methodIndex != -1)
methodIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1479 method = inputContext->metaObject()->method(methodIndex);
never executed: method = inputContext->metaObject()->method(methodIndex);
0
1480 }
never executed: end of block
0
1481-
1482 if (method.isValid()) {
method.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1483 bool retval = false;-
1484 method.invoke(inputContext, Qt::DirectConnection,-
1485 Q_RETURN_ARG(bool, retval),-
1486 Q_ARG(uint, sym),-
1487 Q_ARG(uint, code),-
1488 Q_ARG(uint, state),-
1489 Q_ARG(bool, type == QEvent::KeyPress));-
1490 if (retval) {
retvalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1491 xkb_state_unref(kb_state);-
1492 return;
never executed: return;
0
1493 }-
1494 }
never executed: end of block
0
1495-
1496 QString string = lookupString(kb_state, code);-
1497-
1498 // Ιf control modifier is set we should prefer latin character, this is-
1499 // used for standard shortcuts in checks like "key == QKeySequence::Copy",-
1500 // users can still see the actual X11 keysym with QKeyEvent::nativeVirtualKey-
1501 Qt::KeyboardModifiers modifiers = translateModifiers(state);-
1502 xcb_keysym_t translatedSym = XKB_KEY_NoSymbol;-
1503 if (modifiers & Qt::ControlModifier && !isLatin(sym))
modifiers & Qt...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
!isLatin(sym)Description
TRUEnever evaluated
FALSEnever evaluated
0
1504 translatedSym = lookupLatinKeysym(code);
never executed: translatedSym = lookupLatinKeysym(code);
0
1505 if (translatedSym == XKB_KEY_NoSymbol)
translatedSym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
0
1506 translatedSym = sym;
never executed: translatedSym = sym;
0
1507 int qtcode = keysymToQtKey(translatedSym, modifiers, string);-
1508-
1509 bool isAutoRepeat = false;-
1510 if (type == QEvent::KeyPress) {
type == QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
0
1511 if (m_autorepeat_code == code) {
m_autorepeat_code == codeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1512 isAutoRepeat = true;-
1513 m_autorepeat_code = 0;-
1514 }
never executed: end of block
0
1515 } else {
never executed: end of block
0
1516 // look ahead for auto-repeat-
1517 KeyChecker checker(source->xcb_window(), code, time);-
1518 xcb_generic_event_t *event = connection()->checkEvent(checker);-
1519 if (event) {
eventDescription
TRUEnever evaluated
FALSEnever evaluated
0
1520 isAutoRepeat = true;-
1521 free(event);-
1522 }
never executed: end of block
0
1523 m_autorepeat_code = isAutoRepeat ? code : 0;
isAutoRepeatDescription
TRUEnever evaluated
FALSEnever evaluated
0
1524 }
never executed: end of block
0
1525-
1526 bool filtered = false;-
1527 if (inputContext) {
inputContextDescription
TRUEnever evaluated
FALSEnever evaluated
0
1528 QKeyEvent event(type, qtcode, modifiers, code, sym, state, string, isAutoRepeat, string.length());-
1529 event.setTimestamp(time);-
1530 filtered = inputContext->filterEvent(&event);-
1531 }
never executed: end of block
0
1532-
1533 QWindow *window = targetWindow->window();-
1534 if (!filtered) {
!filteredDescription
TRUEnever evaluated
FALSEnever evaluated
0
1535 if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu) {
type == QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
qtcode == Qt::Key_MenuDescription
TRUEnever evaluated
FALSEnever evaluated
0
1536 const QPoint globalPos = window->screen()->handle()->cursor()->pos();-
1537 const QPoint pos = window->mapFromGlobal(globalPos);-
1538 QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers);-
1539 }
never executed: end of block
0
1540 QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,-
1541 code, sym, state, string, isAutoRepeat);-
1542 }
never executed: end of block
0
1543-
1544 if (isAutoRepeat && type == QEvent::KeyRelease) {
isAutoRepeatDescription
TRUEnever evaluated
FALSEnever evaluated
type == QEvent::KeyReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1545 // since we removed it from the event queue using checkEvent we need to send the key press here-
1546 filtered = false;-
1547 if (method.isValid()) {
method.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1548 method.invoke(inputContext, Qt::DirectConnection,-
1549 Q_RETURN_ARG(bool, filtered),-
1550 Q_ARG(uint, sym),-
1551 Q_ARG(uint, code),-
1552 Q_ARG(uint, state),-
1553 Q_ARG(bool, true));-
1554 }
never executed: end of block
0
1555-
1556 if (!filtered && inputContext) {
!filteredDescription
TRUEnever evaluated
FALSEnever evaluated
inputContextDescription
TRUEnever evaluated
FALSEnever evaluated
0
1557 QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat, string.length());-
1558 event.setTimestamp(time);-
1559 filtered = inputContext->filterEvent(&event);-
1560 }
never executed: end of block
0
1561 if (!filtered)
!filteredDescription
TRUEnever evaluated
FALSEnever evaluated
0
1562 QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers,
never executed: QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat);
0
1563 code, sym, state, string, isAutoRepeat);
never executed: QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat);
0
1564 }
never executed: end of block
0
1565 xkb_state_unref(kb_state);-
1566}
never executed: end of block
0
1567-
1568QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const-
1569{-
1570 QVarLengthArray<char, 32> chars(32);-
1571 const int size = xkb_state_key_get_utf8(state, code, chars.data(), chars.size());-
1572 if (Q_UNLIKELY(size + 1 > chars.size())) { // +1 for NUL
__builtin_expe...ize()), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
1573 chars.resize(size + 1);-
1574 xkb_state_key_get_utf8(state, code, chars.data(), chars.size());-
1575 }
never executed: end of block
0
1576 return QString::fromUtf8(chars.constData(), size);
never executed: return QString::fromUtf8(chars.constData(), size);
0
1577}-
1578-
1579void QXcbKeyboard::handleKeyPressEvent(const xcb_key_press_event_t *event)-
1580{-
1581 handleKeyEvent(event->event, QEvent::KeyPress, event->detail, event->state, event->time);-
1582}
never executed: end of block
0
1583-
1584void QXcbKeyboard::handleKeyReleaseEvent(const xcb_key_release_event_t *event)-
1585{-
1586 handleKeyEvent(event->event, QEvent::KeyRelease, event->detail, event->state, event->time);-
1587}
never executed: end of block
0
1588-
1589void QXcbKeyboard::handleMappingNotifyEvent(const void *event)-
1590{-
1591 updateKeymap();-
1592 if (connection()->hasXKB()) {
connection()->hasXKB()Description
TRUEnever evaluated
FALSEnever evaluated
0
1593 updateVModMapping();-
1594 updateVModToRModMapping();-
1595 } else {
never executed: end of block
0
1596 void *ev = const_cast<void *>(event);-
1597 xcb_refresh_keyboard_mapping(m_key_symbols, static_cast<xcb_mapping_notify_event_t *>(ev));-
1598 updateModifiers();-
1599 }
never executed: end of block
0
1600}-
1601-
1602QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9