OpenCoverage

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

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