qxcbkeyboard.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbkeyboard.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10static const unsigned int KeyTbl[] = {-
11-
12-
13-
14 0xff1b, Qt::Key_Escape,-
15 0xff09, Qt::Key_Tab,-
16 0xfe20, Qt::Key_Backtab,-
17 0xff08, Qt::Key_Backspace,-
18 0xff0d, Qt::Key_Return,-
19 0xff63, Qt::Key_Insert,-
20 0xffff, Qt::Key_Delete,-
21 0xff0b, Qt::Key_Delete,-
22 0xff13, Qt::Key_Pause,-
23 0xff61, Qt::Key_Print,-
24 0x1005FF60, Qt::Key_SysReq,-
25 0x1007ff00, Qt::Key_SysReq,-
26-
27-
28-
29 0xff50, Qt::Key_Home,-
30 0xff57, Qt::Key_End,-
31 0xff51, Qt::Key_Left,-
32 0xff52, Qt::Key_Up,-
33 0xff53, Qt::Key_Right,-
34 0xff54, Qt::Key_Down,-
35 0xff55, Qt::Key_PageUp,-
36 0xff56, Qt::Key_PageDown,-
37-
38-
39-
40 0xffe1, Qt::Key_Shift,-
41 0xffe2, Qt::Key_Shift,-
42 0xffe6, Qt::Key_Shift,-
43 0xffe3, Qt::Key_Control,-
44 0xffe4, Qt::Key_Control,-
45 0xffe7, Qt::Key_Meta,-
46 0xffe8, Qt::Key_Meta,-
47 0xffe9, Qt::Key_Alt,-
48 0xffea, Qt::Key_Alt,-
49 0xffe5, Qt::Key_CapsLock,-
50 0xff7f, Qt::Key_NumLock,-
51 0xff14, Qt::Key_ScrollLock,-
52 0xffeb, Qt::Key_Super_L,-
53 0xffec, Qt::Key_Super_R,-
54 0xff67, Qt::Key_Menu,-
55 0xffed, Qt::Key_Hyper_L,-
56 0xffee, Qt::Key_Hyper_R,-
57 0xff6a, Qt::Key_Help,-
58 0x1000FF74, Qt::Key_Backtab,-
59 0x1005FF10, Qt::Key_F11,-
60 0x1005FF11, Qt::Key_F12,-
61-
62-
63-
64 0xff80, Qt::Key_Space,-
65 0xff89, Qt::Key_Tab,-
66 0xff8d, Qt::Key_Enter,-
67-
68-
69-
70-
71 0xff95, Qt::Key_Home,-
72 0xff96, Qt::Key_Left,-
73 0xff97, Qt::Key_Up,-
74 0xff98, Qt::Key_Right,-
75 0xff99, Qt::Key_Down,-
76 0xff9a, Qt::Key_PageUp,-
77 0xff9b, Qt::Key_PageDown,-
78 0xff9c, Qt::Key_End,-
79 0xff9d, Qt::Key_Clear,-
80 0xff9e, Qt::Key_Insert,-
81 0xff9f, Qt::Key_Delete,-
82 0xffbd, Qt::Key_Equal,-
83 0xffaa, Qt::Key_Asterisk,-
84 0xffab, Qt::Key_Plus,-
85 0xffac, Qt::Key_Comma,-
86 0xffad, Qt::Key_Minus,-
87 0xffae, Qt::Key_Period,-
88 0xffaf, Qt::Key_Slash,-
89-
90-
91-
92-
93 0xfe03, Qt::Key_AltGr,-
94 0xff20, Qt::Key_Multi_key,-
95 0xff37, Qt::Key_Codeinput,-
96 0xff3c, Qt::Key_SingleCandidate,-
97 0xff3d, Qt::Key_MultipleCandidate,-
98 0xff3e, Qt::Key_PreviousCandidate,-
99-
100-
101 0xff7e, Qt::Key_Mode_switch,-
102 0xff7e, Qt::Key_Mode_switch,-
103-
104-
105 0xff21, Qt::Key_Kanji,-
106 0xff22, Qt::Key_Muhenkan,-
107-
108 0xff23, Qt::Key_Henkan,-
109 0xff23, Qt::Key_Henkan,-
110 0xff24, Qt::Key_Romaji,-
111 0xff25, Qt::Key_Hiragana,-
112 0xff26, Qt::Key_Katakana,-
113 0xff27, Qt::Key_Hiragana_Katakana,-
114 0xff28, Qt::Key_Zenkaku,-
115 0xff29, Qt::Key_Hankaku,-
116 0xff2a, Qt::Key_Zenkaku_Hankaku,-
117 0xff2b, Qt::Key_Touroku,-
118 0xff2c, Qt::Key_Massyo,-
119 0xff2d, Qt::Key_Kana_Lock,-
120 0xff2e, Qt::Key_Kana_Shift,-
121 0xff2f, Qt::Key_Eisu_Shift,-
122 0xff30, Qt::Key_Eisu_toggle,-
123-
124-
125-
126 0xff37, Qt::Key_Codeinput,-
127 0xff3d, Qt::Key_MultipleCandidate,-
128 0xff3e, Qt::Key_PreviousCandidate,-
129-
130-
131-
132 0xff31, Qt::Key_Hangul,-
133 0xff32, Qt::Key_Hangul_Start,-
134 0xff33, Qt::Key_Hangul_End,-
135 0xff34, Qt::Key_Hangul_Hanja,-
136 0xff35, Qt::Key_Hangul_Jamo,-
137 0xff36, Qt::Key_Hangul_Romaja,-
138-
139 0xff37, Qt::Key_Codeinput,-
140 0xff38, Qt::Key_Hangul_Jeonja,-
141 0xff39, Qt::Key_Hangul_Banja,-
142 0xff3a, Qt::Key_Hangul_PreHanja,-
143 0xff3b, Qt::Key_Hangul_PostHanja,-
144-
145-
146-
147 0xff3c, Qt::Key_SingleCandidate,-
148 0xff3d,Qt::Key_MultipleCandidate,-
149 0xff3e,Qt::Key_PreviousCandidate,-
150 0xff3f, Qt::Key_Hangul_Special,-
151-
152 0xff7e, Qt::Key_Mode_switch,-
153-
154-
155-
156 0xfe50, Qt::Key_Dead_Grave,-
157 0xfe51, Qt::Key_Dead_Acute,-
158 0xfe52, Qt::Key_Dead_Circumflex,-
159 0xfe53, Qt::Key_Dead_Tilde,-
160 0xfe54, Qt::Key_Dead_Macron,-
161 0xfe55, Qt::Key_Dead_Breve,-
162 0xfe56, Qt::Key_Dead_Abovedot,-
163 0xfe57, Qt::Key_Dead_Diaeresis,-
164 0xfe58, Qt::Key_Dead_Abovering,-
165 0xfe59, Qt::Key_Dead_Doubleacute,-
166 0xfe5a, Qt::Key_Dead_Caron,-
167 0xfe5b, Qt::Key_Dead_Cedilla,-
168 0xfe5c, Qt::Key_Dead_Ogonek,-
169 0xfe5d, Qt::Key_Dead_Iota,-
170 0xfe5e, Qt::Key_Dead_Voiced_Sound,-
171 0xfe5f, Qt::Key_Dead_Semivoiced_Sound,-
172 0xfe60, Qt::Key_Dead_Belowdot,-
173 0xfe61, Qt::Key_Dead_Hook,-
174 0xfe62, Qt::Key_Dead_Horn,-
175-
176-
177-
178 0x1008FF26, Qt::Key_Back,-
179 0x1008FF27, Qt::Key_Forward,-
180 0x1008FF28, Qt::Key_Stop,-
181 0x1008FF29, Qt::Key_Refresh,-
182 0x1008FF30, Qt::Key_Favorites,-
183 0x1008FF32, Qt::Key_LaunchMedia,-
184 0x1008FF38, Qt::Key_OpenUrl,-
185 0x1008FF18, Qt::Key_HomePage,-
186 0x1008FF1B, Qt::Key_Search,-
187 0x1008FF11, Qt::Key_VolumeDown,-
188 0x1008FF12, Qt::Key_VolumeMute,-
189 0x1008FF13, Qt::Key_VolumeUp,-
190 0x1008FF14, Qt::Key_MediaPlay,-
191 0x1008FF15, Qt::Key_MediaStop,-
192 0x1008FF16, Qt::Key_MediaPrevious,-
193 0x1008FF17, Qt::Key_MediaNext,-
194 0x1008FF1C, Qt::Key_MediaRecord,-
195 0x1008FF31, Qt::Key_MediaPause,-
196 0x1008FF19, Qt::Key_LaunchMail,-
197 0x1008FF33, Qt::Key_Launch0,-
198 0x1008FF1D, Qt::Key_Launch1,-
199 0x1008FF1E, Qt::Key_Memo,-
200 0x1008FF1F, Qt::Key_ToDoList,-
201 0x1008FF20, Qt::Key_Calendar,-
202 0x1008FF21, Qt::Key_PowerDown,-
203 0x1008FF22, Qt::Key_ContrastAdjust,-
204 0x1008FF10, Qt::Key_Standby,-
205 0x1008FF02, Qt::Key_MonBrightnessUp,-
206 0x1008FF03, Qt::Key_MonBrightnessDown,-
207 0x1008FF04, Qt::Key_KeyboardLightOnOff,-
208 0x1008FF05, Qt::Key_KeyboardBrightnessUp,-
209 0x1008FF06, Qt::Key_KeyboardBrightnessDown,-
210 0x1008FF2A, Qt::Key_PowerOff,-
211 0x1008FF2B, Qt::Key_WakeUp,-
212 0x1008FF2C, Qt::Key_Eject,-
213 0x1008FF2D, Qt::Key_ScreenSaver,-
214 0x1008FF2E, Qt::Key_WWW,-
215 0x1008FF2F, Qt::Key_Sleep,-
216 0x1008FF35, Qt::Key_LightBulb,-
217 0x1008FF36, Qt::Key_Shop,-
218 0x1008FF37, Qt::Key_History,-
219 0x1008FF39, Qt::Key_AddFavorite,-
220 0x1008FF3A, Qt::Key_HotLinks,-
221 0x1008FF3B, Qt::Key_BrightnessAdjust,-
222 0x1008FF3C, Qt::Key_Finance,-
223 0x1008FF3D, Qt::Key_Community,-
224 0x1008FF3E, Qt::Key_AudioRewind,-
225 0x1008FF3F, Qt::Key_BackForward,-
226 0x1008FF50, Qt::Key_ApplicationLeft,-
227 0x1008FF51, Qt::Key_ApplicationRight,-
228 0x1008FF52, Qt::Key_Book,-
229 0x1008FF53, Qt::Key_CD,-
230 0x1008FF54, Qt::Key_Calculator,-
231 0x1008FF55, Qt::Key_Clear,-
232 0x1008FE21, Qt::Key_ClearGrab,-
233 0x1008FF56, Qt::Key_Close,-
234 0x1008FF57, Qt::Key_Copy,-
235 0x1008FF58, Qt::Key_Cut,-
236 0x1008FF59, Qt::Key_Display,-
237 0x1008FF5A, Qt::Key_DOS,-
238 0x1008FF5B, Qt::Key_Documents,-
239 0x1008FF5C, Qt::Key_Excel,-
240 0x1008FF5D, Qt::Key_Explorer,-
241 0x1008FF5E, Qt::Key_Game,-
242 0x1008FF5F, Qt::Key_Go,-
243 0x1008FF60, Qt::Key_iTouch,-
244 0x1008FF61, Qt::Key_LogOff,-
245 0x1008FF62, Qt::Key_Market,-
246 0x1008FF63, Qt::Key_Meeting,-
247 0x1008FF65, Qt::Key_MenuKB,-
248 0x1008FF66, Qt::Key_MenuPB,-
249 0x1008FF67, Qt::Key_MySites,-
250 0x1008FF68, Qt::Key_New,-
251 0x1008FF69, Qt::Key_News,-
252 0x1008FF6A, Qt::Key_OfficeHome,-
253 0x1008FF6B, Qt::Key_Open,-
254 0x1008FF6C, Qt::Key_Option,-
255 0x1008FF6D, Qt::Key_Paste,-
256 0x1008FF6E, Qt::Key_Phone,-
257 0x1008FF72, Qt::Key_Reply,-
258 0x1008FF73, Qt::Key_Reload,-
259 0x1008FF74, Qt::Key_RotateWindows,-
260 0x1008FF75, Qt::Key_RotationPB,-
261 0x1008FF76, Qt::Key_RotationKB,-
262 0x1008FF77, Qt::Key_Save,-
263 0x1008FF7B, Qt::Key_Send,-
264 0x1008FF7C, Qt::Key_Spell,-
265 0x1008FF7D, Qt::Key_SplitScreen,-
266 0x1008FF7E, Qt::Key_Support,-
267 0x1008FF7F, Qt::Key_TaskPane,-
268 0x1008FF80, Qt::Key_Terminal,-
269 0x1008FF81, Qt::Key_Tools,-
270 0x1008FF82, Qt::Key_Travel,-
271 0x1008FF87, Qt::Key_Video,-
272 0x1008FF89, Qt::Key_Word,-
273 0x1008FF8A, Qt::Key_Xfer,-
274 0x1008FF8B, Qt::Key_ZoomIn,-
275 0x1008FF8C, Qt::Key_ZoomOut,-
276 0x1008FF8D, Qt::Key_Away,-
277 0x1008FF8E, Qt::Key_Messenger,-
278 0x1008FF8F, Qt::Key_WebCam,-
279 0x1008FF90, Qt::Key_MailForward,-
280 0x1008FF91, Qt::Key_Pictures,-
281 0x1008FF92, Qt::Key_Music,-
282 0x1008FF93, Qt::Key_Battery,-
283 0x1008FF94, Qt::Key_Bluetooth,-
284 0x1008FF95, Qt::Key_WLAN,-
285 0x1008FF96, Qt::Key_UWB,-
286 0x1008FF97, Qt::Key_AudioForward,-
287 0x1008FF98, Qt::Key_AudioRepeat,-
288 0x1008FF99, Qt::Key_AudioRandomPlay,-
289 0x1008FF9A, Qt::Key_Subtitle,-
290 0x1008FF9B, Qt::Key_AudioCycleTrack,-
291 0x1008FF9F, Qt::Key_Time,-
292 0x1008FFA0, Qt::Key_Select,-
293 0x1008FFA1, Qt::Key_View,-
294 0x1008FFA2, Qt::Key_TopMenu,-
295 0x1008FFA3, Qt::Key_Red,-
296 0x1008FFA4, Qt::Key_Green,-
297 0x1008FFA5, Qt::Key_Yellow,-
298 0x1008FFA6, Qt::Key_Blue,-
299 0x1008FF94, Qt::Key_Bluetooth,-
300 0x1008FFA7, Qt::Key_Suspend,-
301 0x1008FFA8, Qt::Key_Hibernate,-
302 0x1008FFA9, Qt::Key_TouchpadToggle,-
303 0x1008FFB0, Qt::Key_TouchpadOn,-
304 0x1008FFB1, Qt::Key_TouchpadOff,-
305 0x1008FFB2, Qt::Key_MicMute,-
306 0x1008FF40, Qt::Key_Launch2,-
307 0x1008FF41, Qt::Key_Launch3,-
308 0x1008FF42, Qt::Key_Launch4,-
309 0x1008FF43, Qt::Key_Launch5,-
310 0x1008FF44, Qt::Key_Launch6,-
311 0x1008FF45, Qt::Key_Launch7,-
312 0x1008FF46, Qt::Key_Launch8,-
313 0x1008FF47, Qt::Key_Launch9,-
314 0x1008FF48, Qt::Key_LaunchA,-
315 0x1008FF49, Qt::Key_LaunchB,-
316 0x1008FF4A, Qt::Key_LaunchC,-
317 0x1008FF4B, Qt::Key_LaunchD,-
318 0x1008FF4C, Qt::Key_LaunchE,-
319 0x1008FF4D, Qt::Key_LaunchF,-
320 0x1008FF4E, Qt::Key_LaunchG,-
321 0x1008FF4F, Qt::Key_LaunchH,-
322-
323 0, 0-
324};-
325-
326-
327static const Qt::KeyboardModifiers ModsTbl[] = {-
328 Qt::NoModifier,-
329 Qt::ShiftModifier,-
330 Qt::ControlModifier,-
331 Qt::ControlModifier | Qt::ShiftModifier,-
332 Qt::AltModifier,-
333 Qt::AltModifier | Qt::ShiftModifier,-
334 Qt::AltModifier | Qt::ControlModifier,-
335 Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier,-
336 Qt::NoModifier-
337};-
338-
339Qt::KeyboardModifiers QXcbKeyboard::translateModifiers(int s) const-
340{-
341 Qt::KeyboardModifiers ret = 0;-
342 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
343 ret |= Qt::ShiftModifier;
never executed: ret |= Qt::ShiftModifier;
0
344 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
345 ret |= Qt::ControlModifier;
never executed: ret |= Qt::ControlModifier;
0
346 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
347 ret |= Qt::AltModifier;
never executed: ret |= Qt::AltModifier;
0
348 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
349 ret |= Qt::MetaModifier;
never executed: ret |= Qt::MetaModifier;
0
350 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
351 ret |= Qt::GroupSwitchModifier;
never executed: ret |= Qt::GroupSwitchModifier;
0
352 return
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
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
353}-
354-
355void QXcbKeyboard::readXKBConfig()-
356{-
357 clearXKBConfig();-
358 xcb_generic_error_t *error;-
359 xcb_get_property_cookie_t cookie;-
360 xcb_get_property_reply_t *config_reply;-
361-
362 xcb_connection_t *c = xcb_connection();-
363 xcb_window_t rootWindow = connection()->rootWindow();-
364-
365 cookie = xcb_get_property(c, 0, rootWindow,-
366 atom(QXcbAtom::_XKB_RULES_NAMES), XCB_ATOM_STRING, 0, 1024);-
367-
368 config_reply = xcb_get_property_reply(c, cookie, &error);-
369 if (!config_reply
!config_replyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
370 QMessageLogger(__FILE__, 627, __PRETTY_FUNCTION__).warning("Qt: Couldn't interpret the _XKB_RULES_NAMES property");-
371 return;
never executed: return;
0
372 }-
373 char *xkb_config = (char *)xcb_get_property_value(config_reply);-
374 int length = xcb_get_property_value_length(config_reply);-
375-
376-
377 if (!xkb_config
!xkb_configDescription
TRUEnever evaluated
FALSEnever evaluated
|| length == 0
length == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
378 return;
never executed: return;
0
379-
380-
381-
382 char *names[5] = { 0, 0, 0, 0, 0 };-
383 char *p = xkb_config, *end = p + length;-
384 int i = 0;-
385-
386-
387 do {-
388 uint len = qstrnlen(p, length);-
389 names[i++] = p;-
390 p += len + 1;-
391 length -= len + 1;-
392 }
never executed: end of block
while (p < end
p < endDescription
TRUEnever evaluated
FALSEnever evaluated
|| i < 5
i < 5Description
TRUEnever evaluated
FALSEnever evaluated
);
0
393-
394 xkb_names.rules = qstrdup(names[0]);-
395 xkb_names.model = qstrdup(names[1]);-
396 xkb_names.layout = qstrdup(names[2]);-
397 xkb_names.variant = qstrdup(names[3]);-
398 xkb_names.options = qstrdup(names[4]);-
399-
400 free(config_reply);-
401}
never executed: end of block
0
402-
403void QXcbKeyboard::clearXKBConfig()-
404{-
405 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
406 delete[] xkb_names.rules;
never executed: delete[] xkb_names.rules;
0
407 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
408 delete[] xkb_names.model;
never executed: delete[] xkb_names.model;
0
409 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
410 delete[] xkb_names.layout;
never executed: delete[] xkb_names.layout;
0
411 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
412 delete[] xkb_names.variant;
never executed: delete[] xkb_names.variant;
0
413 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
414 delete[] xkb_names.options;
never executed: delete[] xkb_names.options;
0
415 memset(&xkb_names, 0, sizeof(xkb_names));-
416}
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
417-
418void QXcbKeyboard::printKeymapError(const char *error) const-
419{-
420 QMessageLogger(__FILE__, 677, __PRETTY_FUNCTION__).warning() << error;-
421 if (xkb_context
xkb_contextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
422 QMessageLogger(__FILE__, 679, __PRETTY_FUNCTION__).warning("Current XKB configuration data search paths are: ");-
423 for (unsigned int i = 0; i < xkb_context_num_include_paths(xkb_context)
i < xkb_contex...s(xkb_context)Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
424 QMessageLogger(__FILE__, 681, __PRETTY_FUNCTION__).warning() << 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
425 }
never executed: end of block
0
426 QMessageLogger(__FILE__, 683, __PRETTY_FUNCTION__).warning("Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, "-
427 "add ':' as separator to provide several search paths and/or make sure that XKB configuration data "-
428 "directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .");-
429}
never executed: end of block
0
430-
431void QXcbKeyboard::updateKeymap()-
432{-
433 m_config = true;-
434-
435 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
436 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
437 xkb_context = xkb_context_new((xkb_context_flags)XKB_CONTEXT_NO_DEFAULT_INCLUDES);-
438 const QList<QByteArray> xkbRootList = QByteArray(qgetenv("QT_XKB_CONFIG_ROOT")).split(':');-
439 for (const QByteArray &xkbRoot : xkbRootList)-
440 xkb_context_include_path_append(xkb_context, xkbRoot.constData());
never executed: xkb_context_include_path_append(xkb_context, xkbRoot.constData());
0
441 }
never executed: end of block
else {
0
442 xkb_context = xkb_context_new((xkb_context_flags)0);-
443 }
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
444 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
445 printKeymapError("Qt: Failed to create XKB context!");-
446 m_config = false;-
447 return;
never executed: return;
0
448 }-
449-
450 xkb_context_set_log_level(xkb_context, (xkb_log_level)XKB_LOG_LEVEL_CRITICAL);-
451 }
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
452-
453 xkb_keymap_unref(xkb_keymap);-
454 xkb_keymap = 0;-
455-
456 struct xkb_state *new_state = 0;-
457-
458 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
459 xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0);-
460 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
461-
462 new_state = xkb_x11_state_new_from_device(xkb_keymap, xcb_connection(), core_device_id);-
463 }
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
464 }
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
465-
466 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
467-
468 readXKBConfig();-
469 xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);-
470 if (!xkb_keymap
!xkb_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
471-
472 QMessageLogger(__FILE__, 729, __PRETTY_FUNCTION__).warning() << "Qt: Could not determine keyboard configuration data"-
473 " from X server, will use hard-coded keymap configuration.";-
474 clearXKBConfig();-
475 xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0);-
476 }
never executed: end of block
0
477 if (xkb_keymap
xkb_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
478 new_state = xkb_state_new(xkb_keymap);-
479 }
never executed: end of block
else {
0
480 printKeymapError("Qt: Failed to compile a keymap!");-
481 m_config = false;-
482 return;
never executed: return;
0
483 }-
484-
485 }-
486 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
487 QMessageLogger(__FILE__, 744, __PRETTY_FUNCTION__).warning("Qt: Failed to create xkb state!");-
488 m_config = false;-
489 return;
never executed: return;
0
490 }-
491-
492 xkb_state_unref(xkb_state);-
493 xkb_state = new_state;-
494 updateXKBMods();-
495-
496 checkForLatinLayout();-
497}
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
498-
499-
500void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state)-
501{-
502 if (m_config
m_configDescription
TRUEnever evaluated
FALSEnever evaluated
&& connection()->hasXKB()
connection()->hasXKB()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
503 const xkb_state_component newState-
504 = xkb_state_update_mask(xkb_state,-
505 state->baseMods,-
506 state->latchedMods,-
507 state->lockedMods,-
508 state->baseGroup,-
509 state->latchedGroup,-
510 state->lockedGroup);-
511-
512 if ((
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
513-
514 }
never executed: end of block
0
515 }
never executed: end of block
0
516}
never executed: end of block
0
517-
518-
519void QXcbKeyboard::updateXKBStateFromState(struct xkb_state *kb_state, quint16 state)-
520{-
521 const quint32 modsDepressed = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_DEPRESSED);-
522 const quint32 modsLatched = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LATCHED);-
523 const quint32 modsLocked = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LOCKED);-
524 const quint32 xkbMask = xkbModMask(state);-
525-
526 const quint32 latched = modsLatched & xkbMask;-
527 const quint32 locked = modsLocked & xkbMask;-
528 quint32 depressed = modsDepressed & xkbMask;-
529-
530 depressed |= ~(depressed | latched | locked) & xkbMask;-
531-
532 const xkb_state_component newState-
533 = xkb_state_update_mask(kb_state,-
534 depressed,-
535 latched,-
536 locked,-
537 0,-
538 0,-
539 (state >> 13) & 3);-
540-
541 if ((
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
542-
543 }
never executed: end of block
0
544}
never executed: end of block
0
545-
546void QXcbKeyboard::updateXKBStateFromCore(quint16 state)-
547{-
548 if (m_config
m_configDescription
TRUEnever evaluated
FALSEnever evaluated
&& !connection()->hasXKB()
!connection()->hasXKB()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
549 updateXKBStateFromState(xkb_state, state);-
550 }
never executed: end of block
0
551}
never executed: end of block
0
552-
553-
554void QXcbKeyboard::updateXKBStateFromXI(void *modInfo, void *groupInfo)-
555{-
556 if (m_config
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()
!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
557 xXIModifierInfo *mods = static_cast<xXIModifierInfo *>(modInfo);-
558 xXIGroupInfo *group = static_cast<xXIGroupInfo *>(groupInfo);-
559 const xkb_state_component newState = xkb_state_update_mask(xkb_state,-
560 mods->base_mods,-
561 mods->latched_mods,-
562 mods->locked_mods,-
563 group->base_group,-
564 group->latched_group,-
565 group->locked_group);-
566-
567 if ((
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE
(newState & XK...YOUT_EFFECTIVEDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
568-
569 }
never executed: end of block
0
570 }
never executed: end of block
0
571}
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
572-
573-
574quint32 QXcbKeyboard::xkbModMask(quint16 state)-
575{-
576 quint32 xkb_mask = 0;-
577-
578 if ((
(state & XCB_MOD_MASK_SHIFT)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_SHIFT)
(state & XCB_MOD_MASK_SHIFT)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.shift != (0xffffffff)
xkb_mods.shift != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
579 xkb_mask |= (1 << xkb_mods.shift);
never executed: xkb_mask |= (1 << xkb_mods.shift);
0
580 if ((
(state & XCB_MOD_MASK_LOCK)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_LOCK)
(state & XCB_MOD_MASK_LOCK)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.lock != (0xffffffff)
xkb_mods.lock != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
581 xkb_mask |= (1 << xkb_mods.lock);
never executed: xkb_mask |= (1 << xkb_mods.lock);
0
582 if ((
(state & XCB_MOD_MASK_CONTROL)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_CONTROL)
(state & XCB_MOD_MASK_CONTROL)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.control != (0xffffffff)
xkb_mods.contr...= (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
583 xkb_mask |= (1 << xkb_mods.control);
never executed: xkb_mask |= (1 << xkb_mods.control);
0
584 if ((
(state & XCB_MOD_MASK_1)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_1)
(state & XCB_MOD_MASK_1)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.mod1 != (0xffffffff)
xkb_mods.mod1 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
585 xkb_mask |= (1 << xkb_mods.mod1);
never executed: xkb_mask |= (1 << xkb_mods.mod1);
0
586 if ((
(state & XCB_MOD_MASK_2)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_2)
(state & XCB_MOD_MASK_2)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.mod2 != (0xffffffff)
xkb_mods.mod2 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
587 xkb_mask |= (1 << xkb_mods.mod2);
never executed: xkb_mask |= (1 << xkb_mods.mod2);
0
588 if ((
(state & XCB_MOD_MASK_3)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_3)
(state & XCB_MOD_MASK_3)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.mod3 != (0xffffffff)
xkb_mods.mod3 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
589 xkb_mask |= (1 << xkb_mods.mod3);
never executed: xkb_mask |= (1 << xkb_mods.mod3);
0
590 if ((
(state & XCB_MOD_MASK_4)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_4)
(state & XCB_MOD_MASK_4)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.mod4 != (0xffffffff)
xkb_mods.mod4 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
591 xkb_mask |= (1 << xkb_mods.mod4);
never executed: xkb_mask |= (1 << xkb_mods.mod4);
0
592 if ((
(state & XCB_MOD_MASK_5)Description
TRUEnever evaluated
FALSEnever evaluated
state & XCB_MOD_MASK_5)
(state & XCB_MOD_MASK_5)Description
TRUEnever evaluated
FALSEnever evaluated
&& xkb_mods.mod5 != (0xffffffff)
xkb_mods.mod5 != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
593 xkb_mask |= (1 << xkb_mods.mod5);
never executed: xkb_mask |= (1 << xkb_mods.mod5);
0
594-
595 return
never executed: return xkb_mask;
xkb_mask;
never executed: return xkb_mask;
0
596}-
597-
598void QXcbKeyboard::updateXKBMods()-
599{-
600 xkb_mods.shift = xkb_keymap_mod_get_index(xkb_keymap, "Shift");-
601 xkb_mods.lock = xkb_keymap_mod_get_index(xkb_keymap, "Lock");-
602 xkb_mods.control = xkb_keymap_mod_get_index(xkb_keymap, "Control");-
603 xkb_mods.mod1 = xkb_keymap_mod_get_index(xkb_keymap, "Mod1");-
604 xkb_mods.mod2 = xkb_keymap_mod_get_index(xkb_keymap, "Mod2");-
605 xkb_mods.mod3 = xkb_keymap_mod_get_index(xkb_keymap, "Mod3");-
606 xkb_mods.mod4 = xkb_keymap_mod_get_index(xkb_keymap, "Mod4");-
607 xkb_mods.mod5 = xkb_keymap_mod_get_index(xkb_keymap, "Mod5");-
608}
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
609-
610static bool isLatin(xkb_keysym_t sym)-
611{-
612 return
never executed: return ((sym >= 'a' && sym <= 'z') || (sym >= 'A' && sym <= 'Z'));
((sym >= 'a' && sym <= 'z') || (sym >= 'A' && sym <= 'Z'));
never executed: return ((sym >= 'a' && sym <= 'z') || (sym >= 'A' && sym <= 'Z'));
0
613}-
614-
615void QXcbKeyboard::checkForLatinLayout()-
616{-
617 m_hasLatinLayout = false;-
618 const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts(xkb_keymap);-
619 const xcb_keycode_t minKeycode = connection()->setup()->min_keycode;-
620 const xcb_keycode_t maxKeycode = connection()->setup()->max_keycode;-
621 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
622 for (xkb_layout_index_t layout = 0; layout < layoutCount
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
; ++layout) {
0-135
623 xkb_state_update_mask(kb_state, 0, 0, 0, 0, 0, layout);-
624 for (xcb_keycode_t code = minKeycode; code < maxKeycode
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
; ++code) {
0-2295
625 xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code);-
626-
627-
628 if (sym == 0x0071
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 == 0x0061
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 == 0x0065
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
629 m_hasLatinLayout = true;-
630 xkb_state_unref(kb_state);-
631 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
632 }-
633 }
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
634 }
never executed: end of block
0
635 xkb_state_unref(kb_state);-
636}
never executed: end of block
0
637-
638xkb_keysym_t QXcbKeyboard::lookupLatinKeysym(xkb_keycode_t keycode) const-
639{-
640 xkb_layout_index_t layout;-
641 xkb_keysym_t sym = 0x000000;-
642 const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts_for_key(xkb_keymap, keycode);-
643 const xkb_layout_index_t currentLayout = xkb_state_key_get_layout(xkb_state, keycode);-
644-
645-
646 for (layout = 0; layout < layoutCount
layout < layoutCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++layout) {
0
647 if (layout == currentLayout
layout == currentLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
648 continue;
never executed: continue;
0
649 const xkb_keysym_t *syms;-
650 xkb_level_index_t level = xkb_state_key_get_level(xkb_state, keycode, layout);-
651 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
652 continue;
never executed: continue;
0
653 if (isLatin(syms[0])
isLatin(syms[0])Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
654 sym = syms[0];-
655 break;
never executed: break;
0
656 }-
657 }
never executed: end of block
0
658-
659-
660-
661 xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);-
662 xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);-
663 if (sym == 0x000000
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
&& !m_hasLatinLayout
!m_hasLatinLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
664 if (!latin_keymap
!latin_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
665 const struct xkb_rule_names names = { xkb_names.rules, xkb_names.model, "us", 0, 0 };-
666 latin_keymap = xkb_keymap_new_from_names(xkb_context, &names, (xkb_keymap_compile_flags)0);-
667 static bool printFailure = true;-
668 if (!latin_keymap
!latin_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
&& printFailure
printFailureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
669-
670-
671 printFailure = false;-
672 printKeymapError("Qt: Failed to compile US keymap, shortcut handling with "-
673 "non-Latin keyboard layouts may not be fully functional!");-
674 }
never executed: end of block
0
675 }
never executed: end of block
0
676 if (latin_keymap
latin_keymapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
677 struct xkb_state *latin_state = xkb_state_new(latin_keymap);-
678 if (latin_state
latin_stateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
679 xkb_state_update_mask(latin_state, 0, latchedMods, lockedMods, 0, 0, 0);-
680 sym = xkb_state_key_get_one_sym(latin_state, keycode);-
681 xkb_state_unref(latin_state);-
682 }
never executed: end of block
else {
0
683 QMessageLogger(__FILE__, 940, __PRETTY_FUNCTION__).warning("QXcbKeyboard: failed to create a state for US keymap!");-
684 }
never executed: end of block
0
685 }-
686 }
never executed: end of block
0
687 if (sym == 0x000000
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
)
0
688 return
never executed: return sym;
sym;
never executed: return sym;
0
689 const xcb_keycode_t minKeycode = connection()->setup()->min_keycode;-
690 const xcb_keycode_t maxKeycode = connection()->setup()->max_keycode;-
691 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
692 for (xkb_layout_index_t prevLayout = 0; prevLayout < layout
prevLayout < layoutDescription
TRUEnever evaluated
FALSEnever evaluated
; ++prevLayout) {
0
693 xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, prevLayout);-
694 for (xcb_keycode_t code = minKeycode; code < maxKeycode
code < maxKeycodeDescription
TRUEnever evaluated
FALSEnever evaluated
; ++code) {
0
695 xkb_keysym_t prevSym = xkb_state_key_get_one_sym(kb_state, code);-
696 if (prevSym == sym
prevSym == symDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
697 sym = 0x000000;-
698 break;
never executed: break;
0
699 }-
700 }
never executed: end of block
0
701 }
never executed: end of block
0
702 xkb_state_unref(kb_state);-
703 return
never executed: return sym;
sym;
never executed: return sym;
0
704}-
705-
706QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const-
707{-
708-
709 Qt::KeyboardModifiers notNeeded = Qt::KeypadModifier | Qt::GroupSwitchModifier;-
710 Qt::KeyboardModifiers modifiers = event->modifiers() &= ~notNeeded;-
711-
712 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
713 if (!kb_state
!kb_stateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
714 QMessageLogger(__FILE__, 979, __PRETTY_FUNCTION__).warning("QXcbKeyboard: failed to compile xkb keymap!");-
715 return
never executed: return QList<int>();
QList<int>();
never executed: return QList<int>();
0
716 }-
717-
718 xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LOCKED);-
719 xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);-
720 xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);-
721 xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED);-
722-
723 xkb_state_update_mask(kb_state, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout);-
724 quint32 keycode = event->nativeScanCode();-
725-
726 xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(kb_state, keycode);-
727 xkb_level_index_t levelIndex = 0;-
728 if (layoutIndex != (0xffffffff)
layoutIndex != (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
729 levelIndex = xkb_state_key_get_level(kb_state, keycode, layoutIndex);-
730 if (levelIndex == (0xffffffff)
levelIndex == (0xffffffff)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
731 levelIndex = 0;
never executed: levelIndex = 0;
0
732 }
never executed: end of block
0
733 if (levelIndex <= 1
levelIndex <= 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
734 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
735-
736 xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, keycode);-
737 if (sym == 0x000000
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
738 xkb_state_unref(kb_state);-
739 return
never executed: return QList<int>();
QList<int>();
never executed: return QList<int>();
0
740 }-
741-
742 QList<int> result;-
743 int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, keycode));-
744 if (baseQtKey
baseQtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
745 result += (baseQtKey + modifiers);
never executed: result += (baseQtKey + modifiers);
0
746-
747 xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift");-
748 xkb_mod_index_t altMod = xkb_keymap_mod_get_index(xkb_keymap, "Alt");-
749 xkb_mod_index_t controlMod = xkb_keymap_mod_get_index(xkb_keymap, "Control");-
750 xkb_mod_index_t metaMod = xkb_keymap_mod_get_index(xkb_keymap, "Meta");-
751-
752 ((!(shiftMod < 32)) ? qt_assert("shiftMod < 32",__FILE__,1017) : qt_noop());-
753 ((!(altMod < 32)) ? qt_assert("altMod < 32",__FILE__,1018) : qt_noop());-
754 ((!(controlMod < 32)) ? qt_assert("controlMod < 32",__FILE__,1019) : qt_noop());-
755-
756 xkb_mod_mask_t depressed;-
757 int qtKey = 0;-
758-
759 for (uint i = 1; i < sizeof(ModsTbl) / sizeof(*ModsTbl)
i < sizeof(Mod...zeof(*ModsTbl)Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
760 Qt::KeyboardModifiers neededMods = ModsTbl[i];-
761 if ((
(modifiers & n... == neededModsDescription
TRUEnever evaluated
FALSEnever evaluated
modifiers & neededMods) == neededMods
(modifiers & n... == neededModsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
762 if (i == 8
i == 8Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
763 if (isLatin(baseQtKey)
isLatin(baseQtKey)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
764 continue;
never executed: continue;
0
765-
766 sym = lookupLatinKeysym(keycode);-
767 }
never executed: end of block
else {
0
768 depressed = 0;-
769 if (neededMods & Qt::AltModifier
neededMods & Qt::AltModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
770 depressed |= (1 << altMod);
never executed: depressed |= (1 << altMod);
0
771 if (neededMods & Qt::ShiftModifier
neededMods & Qt::ShiftModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
772 depressed |= (1 << shiftMod);
never executed: depressed |= (1 << shiftMod);
0
773 if (neededMods & Qt::ControlModifier
neededMods & Q...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
774 depressed |= (1 << controlMod);
never executed: depressed |= (1 << controlMod);
0
775 if (metaMod < 32
metaMod < 32Description
TRUEnever evaluated
FALSEnever evaluated
&& neededMods & Qt::MetaModifier
neededMods & Qt::MetaModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
776 depressed |= (1 << metaMod);
never executed: depressed |= (1 << metaMod);
0
777 xkb_state_update_mask(kb_state, depressed, latchedMods, lockedMods, 0, 0, lockedLayout);-
778 sym = xkb_state_key_get_one_sym(kb_state, keycode);-
779 }
never executed: end of block
0
780 if (sym == 0x000000
sym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
)
0
781 continue;
never executed: continue;
0
782-
783 Qt::KeyboardModifiers mods = modifiers & ~neededMods;-
784 qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, keycode));-
785 if (!qtKey
!qtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
|| qtKey == baseQtKey
qtKey == baseQtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
786 continue;
never executed: continue;
0
787-
788-
789-
790 bool ambiguous = false;-
791 for (int shortcut : qAsConst(result)) {-
792 if (int(shortcut & ~Qt::KeyboardModifierMask) == qtKey
int(shortcut &...Mask) == qtKeyDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(shortcut & mods) == modsDescription
TRUEnever evaluated
FALSEnever evaluated
shortcut & mods) == mods
(shortcut & mods) == modsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
793 ambiguous = true;-
794 break;
never executed: break;
0
795 }-
796 }
never executed: end of block
0
797 if (ambiguous
ambiguousDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
798 continue;
never executed: continue;
0
799-
800 result += (qtKey + mods);-
801 }
never executed: end of block
0
802 }
never executed: end of block
0
803 xkb_state_unref(kb_state);-
804 return
never executed: return result;
result;
never executed: return result;
0
805 }-
806-
807int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const-
808{-
809 int code = 0;-
810 int i = 0;-
811 while (KeyTbl[i]
KeyTbl[i]Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
812 if (key == KeyTbl[i]
key == KeyTbl[i]Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
813 code = (int)KeyTbl[i+1];-
814 break;
never executed: break;
0
815 }-
816 i += 2;-
817 }
never executed: end of block
0
818-
819 if (rmod_masks.meta
rmod_masks.metaDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
820-
821 if (rmod_masks.meta == rmod_masks.super
rmod_masks.met...od_masks.superDescription
TRUEnever evaluated
FALSEnever evaluated
&& (code == Qt::Key_Super_L
code == Qt::Key_Super_LDescription
TRUEnever evaluated
FALSEnever evaluated
|| code == Qt::Key_Super_R
code == Qt::Key_Super_RDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
822 code = Qt::Key_Meta;-
823 }
never executed: end of block
else if (rmod_masks.meta == rmod_masks.hyper
rmod_masks.met...od_masks.hyperDescription
TRUEnever evaluated
FALSEnever evaluated
&& (code == Qt::Key_Hyper_L
code == Qt::Key_Hyper_LDescription
TRUEnever evaluated
FALSEnever evaluated
|| code == Qt::Key_Hyper_R
code == Qt::Key_Hyper_RDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
824 code = Qt::Key_Meta;-
825 }
never executed: end of block
0
826 }
never executed: end of block
0
827-
828 return
never executed: return code;
code;
never executed: return code;
0
829}-
830-
831int QXcbKeyboard::keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) const-
832{-
833 int code = 0;-
834-
835 QTextCodec *systemCodec = QTextCodec::codecForLocale();-
836-
837-
838-
839-
840-
841-
842 if (keysym < 128
keysym < 128Description
TRUEnever evaluated
FALSEnever evaluated
|| (keysym < 256
keysym < 256Description
TRUEnever evaluated
FALSEnever evaluated
0
843-
844 && systemCodec->mibEnum() == 4
systemCodec->mibEnum() == 4Description
TRUEnever evaluated
FALSEnever evaluated
0
845-
846 )) {-
847-
848 code = isprint((int)keysym)
isprint((int)keysym)Description
TRUEnever evaluated
FALSEnever evaluated
? toupper((int)keysym) : 0;
0
849 }
never executed: end of block
else if (keysym >= 0xffbe
keysym >= 0xffbeDescription
TRUEnever evaluated
FALSEnever evaluated
&& keysym <= 0xffe0
keysym <= 0xffe0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
850-
851 code = Qt::Key_F1 + ((int)keysym - 0xffbe);-
852 }
never executed: end of block
else if (keysym >= 0xff80
keysym >= 0xff80Description
TRUEnever evaluated
FALSEnever evaluated
&& keysym <= 0xffb9
keysym <= 0xffb9Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
853 if (keysym >= 0xffb0
keysym >= 0xffb0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
854-
855 code = Qt::Key_0 + ((int)keysym - 0xffb0);-
856 }
never executed: end of block
else {
0
857 code = keysymToQtKey(keysym);-
858 }
never executed: end of block
0
859 modifiers |= Qt::KeypadModifier;-
860 }
never executed: end of block
else if (text.length() == 1
text.length() == 1Description
TRUEnever evaluated
FALSEnever evaluated
&& text.unicode()->unicode() > 0x1f
text.unicode()...icode() > 0x1fDescription
TRUEnever evaluated
FALSEnever evaluated
0
861 && text.unicode()->unicode() != 0x7f
text.unicode()...code() != 0x7fDescription
TRUEnever evaluated
FALSEnever evaluated
0
862 && !(keysym >= 0xfe50
keysym >= 0xfe50Description
TRUEnever evaluated
FALSEnever evaluated
&& keysym <= 0xfe6f
keysym <= 0xfe6fDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
863 code = text.unicode()->toUpper().unicode();-
864 }
never executed: end of block
else {
0
865-
866 code = keysymToQtKey(keysym);-
867 }
never executed: end of block
0
868-
869 return
never executed: return code;
code;
never executed: return code;
0
870}-
871-
872QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)-
873 : QXcbObject(connection)-
874 , m_autorepeat_code(0)-
875 , xkb_context(0)-
876 , xkb_keymap(0)-
877 , xkb_state(0)-
878 , latin_keymap(0)-
879 , m_hasLatinLayout(false)-
880{-
881 memset(&xkb_names, 0, sizeof(xkb_names));-
882-
883 core_device_id = 0;-
884 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
885 updateVModMapping();-
886 updateVModToRModMapping();-
887 core_device_id = xkb_x11_get_core_keyboard_device_id(xcb_connection());-
888 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
889 QMessageLogger(__FILE__, 1154, __PRETTY_FUNCTION__).warning("Qt: couldn't get core keyboard device info");-
890 return;
never executed: return;
0
891 }-
892 }
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
else {
135
893-
894 m_key_symbols = xcb_key_symbols_alloc(xcb_connection());-
895 updateModifiers();-
896-
897 }
never executed: end of block
0
898-
899 updateKeymap();-
900}
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
901-
902QXcbKeyboard::~QXcbKeyboard()-
903{-
904 xkb_state_unref(xkb_state);-
905 xkb_keymap_unref(xkb_keymap);-
906 xkb_context_unref(xkb_context);-
907 xkb_keymap_unref(latin_keymap);-
908 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
909 xcb_key_symbols_free(m_key_symbols);
never executed: xcb_key_symbols_free(m_key_symbols);
0
910 clearXKBConfig();-
911}
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
912-
913void QXcbKeyboard::updateVModMapping()-
914{-
915-
916 xcb_xkb_get_names_cookie_t names_cookie;-
917 xcb_xkb_get_names_reply_t *name_reply;-
918 xcb_xkb_get_names_value_list_t names_list;-
919-
920 memset(&vmod_masks, 0, sizeof(vmod_masks));-
921-
922 names_cookie = xcb_xkb_get_names(xcb_connection(),-
923 XCB_XKB_ID_USE_CORE_KBD,-
924 XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES);-
925-
926 name_reply = xcb_xkb_get_names_reply(xcb_connection(), names_cookie, 0);-
927 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
928 QMessageLogger(__FILE__, 1193, __PRETTY_FUNCTION__).warning("Qt: failed to retrieve the virtual modifier names from XKB");-
929 return;
never executed: return;
0
930 }-
931-
932 const void *buffer = xcb_xkb_get_names_value_list(name_reply);-
933 xcb_xkb_get_names_value_list_unpack(buffer,-
934 name_reply->nTypes,-
935 name_reply->indicators,-
936 name_reply->virtualMods,-
937 name_reply->groupNames,-
938 name_reply->nKeys,-
939 name_reply->nKeyAliases,-
940 name_reply->nRadioGroups,-
941 name_reply->which,-
942 &names_list);-
943-
944 int count = 0;-
945 uint vmod_mask, bit;-
946 char *vmod_name;-
947 vmod_mask = name_reply->virtualMods;-
948-
949 for (bit = 1; vmod_mask
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
; bit <<= 1) {
135-1755
950 vmod_name = 0;-
951-
952 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
953 continue;
never executed: continue;
0
954-
955 vmod_mask &= ~bit;-
956-
957-
958 QByteArray atomName = connection()->atomName(names_list.virtualModNames[count]);-
959 vmod_name = atomName.data();-
960 count++;-
961-
962 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
963 continue;
never executed: continue;
0
964-
965-
966 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
967 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
968 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
969 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
970 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
971 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
972 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
973 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
974 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
975 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
976 }
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
977-
978 free(name_reply);-
979-
980}
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
981-
982void QXcbKeyboard::updateVModToRModMapping()-
983{-
984-
985 xcb_xkb_get_map_cookie_t map_cookie;-
986 xcb_xkb_get_map_reply_t *map_reply;-
987 xcb_xkb_get_map_map_t map;-
988-
989 memset(&rmod_masks, 0, sizeof(rmod_masks));-
990-
991 map_cookie = xcb_xkb_get_map(xcb_connection(),-
992 XCB_XKB_ID_USE_CORE_KBD,-
993 XCB_XKB_MAP_PART_VIRTUAL_MODS,-
994 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);-
995-
996 map_reply = xcb_xkb_get_map_reply(xcb_connection(), map_cookie, 0);-
997 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
998 QMessageLogger(__FILE__, 1263, __PRETTY_FUNCTION__).warning("Qt: failed to retrieve the virtual modifier map from XKB");-
999 return;
never executed: return;
0
1000 }-
1001-
1002 const void *buffer = xcb_xkb_get_map_map(map_reply);-
1003 xcb_xkb_get_map_map_unpack(buffer,-
1004 map_reply->nTypes,-
1005 map_reply->nKeySyms,-
1006 map_reply->nKeyActions,-
1007 map_reply->totalActions,-
1008 map_reply->totalKeyBehaviors,-
1009 map_reply->nVModMapKeys,-
1010 map_reply->totalKeyExplicit,-
1011 map_reply->totalModMapKeys,-
1012 map_reply->totalVModMapKeys,-
1013 map_reply->present,-
1014 &map);-
1015-
1016 uint vmod_mask, bit;-
1017-
1018-
1019 vmod_mask = map_reply->virtualMods;-
1020 int count = 0;-
1021-
1022 for (bit = 1; vmod_mask
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
; bit <<= 1) {
135-2160
1023 uint modmap;-
1024-
1025 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
1026 continue;
never executed: continue;
0
1027-
1028 vmod_mask &= ~bit;-
1029-
1030 modmap = map.vmods_rtrn[count];-
1031 count++;-
1032-
1033 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
1034 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
1035 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
1036 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
1037 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
1038 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
1039 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
1040 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
1041 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
1042 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
1043 }
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
1044-
1045 free(map_reply);-
1046 resolveMaskConflicts();-
1047-
1048}
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
1049-
1050void QXcbKeyboard::updateModifiers()-
1051{-
1052-
1053-
1054-
1055-
1056-
1057 memset(&rmod_masks, 0, sizeof(rmod_masks));-
1058-
1059 xcb_generic_error_t *error = 0;-
1060 xcb_connection_t *conn = xcb_connection();-
1061 xcb_get_modifier_mapping_cookie_t modMapCookie = xcb_get_modifier_mapping(conn);-
1062 xcb_get_modifier_mapping_reply_t *modMapReply =-
1063 xcb_get_modifier_mapping_reply(conn, modMapCookie, &error);-
1064 if (error
errorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1065 QMessageLogger(__FILE__, 1330, __PRETTY_FUNCTION__).warning("Qt: failed to get modifier mapping");-
1066 free(error);-
1067 return;
never executed: return;
0
1068 }-
1069-
1070-
1071 static const xcb_keysym_t symbols[] = {-
1072 0xffe9, 0xffe7, 0xff7e, 0xffeb, 0xffec,-
1073 0xffed, 0xffee-
1074 };-
1075 static const size_t numSymbols = sizeof symbols / sizeof *symbols;-
1076-
1077-
1078 xcb_keycode_t* modKeyCodes[numSymbols];-
1079 for (size_t i = 0; i < numSymbols
i < numSymbolsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1080 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
1081-
1082 xcb_keycode_t *modMap = xcb_get_modifier_mapping_keycodes(modMapReply);-
1083 const int w = modMapReply->keycodes_per_modifier;-
1084 for (size_t i = 0; i < numSymbols
i < numSymbolsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1085 for (int bit = 0; bit < 8
bit < 8Description
TRUEnever evaluated
FALSEnever evaluated
; ++bit) {
0
1086 uint mask = 1 << bit;-
1087 for (int x = 0; x < w
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
1088 xcb_keycode_t keyCode = modMap[x + bit * w];-
1089 xcb_keycode_t *itk = modKeyCodes[i];-
1090 while (itk
itkDescription
TRUEnever evaluated
FALSEnever evaluated
&& *
*itk != 0LDescription
TRUEnever evaluated
FALSEnever evaluated
itk != 0L
*itk != 0LDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1091 if (*
*itk++ == keyCodeDescription
TRUEnever evaluated
FALSEnever evaluated
itk++ == keyCode
*itk++ == keyCodeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1092 uint sym = symbols[i];-
1093 if ((sym == 0xffe9
sym == 0xffe9Description
TRUEnever evaluated
FALSEnever evaluated
|| sym == 0xffea
sym == 0xffeaDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
1094 rmod_masks.alt = mask;
never executed: rmod_masks.alt = mask;
0
1095 if ((sym == 0xffe7
sym == 0xffe7Description
TRUEnever evaluated
FALSEnever evaluated
|| sym == 0xffe8
sym == 0xffe8Description
TRUEnever evaluated
FALSEnever evaluated
))
0
1096 rmod_masks.meta = mask;
never executed: rmod_masks.meta = mask;
0
1097 if (sym == 0xff7e
sym == 0xff7eDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1098 rmod_masks.altgr = mask;
never executed: rmod_masks.altgr = mask;
0
1099 if ((
(sym == 0xffeb)Description
TRUEnever evaluated
FALSEnever evaluated
sym == 0xffeb)
(sym == 0xffeb)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(sym == 0xffec)Description
TRUEnever evaluated
FALSEnever evaluated
sym == 0xffec)
(sym == 0xffec)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1100 rmod_masks.super = mask;
never executed: rmod_masks.super = mask;
0
1101 if ((
(sym == 0xffed)Description
TRUEnever evaluated
FALSEnever evaluated
sym == 0xffed)
(sym == 0xffed)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(sym == 0xffee)Description
TRUEnever evaluated
FALSEnever evaluated
sym == 0xffee)
(sym == 0xffee)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1102 rmod_masks.hyper = mask;
never executed: rmod_masks.hyper = mask;
0
1103 }
never executed: end of block
0
1104 }
never executed: end of block
0
1105 }
never executed: end of block
0
1106 }
never executed: end of block
0
1107-
1108 for (size_t i = 0; i < numSymbols
i < numSymbolsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1109 free(modKeyCodes[i]);
never executed: free(modKeyCodes[i]);
0
1110 free(modMapReply);-
1111 resolveMaskConflicts();-
1112}
never executed: end of block
0
1113-
1114void QXcbKeyboard::resolveMaskConflicts()-
1115{-
1116-
1117-
1118-
1119 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
1120 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
1121-
1122 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
1123-
1124 rmod_masks.meta = rmod_masks.super;-
1125 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
1126-
1127 rmod_masks.meta = rmod_masks.hyper;-
1128 }
never executed: end of block
0
1129 }
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
1130}
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
1131-
1132class KeyChecker-
1133{-
1134public:-
1135 KeyChecker(xcb_window_t window, xcb_keycode_t code, xcb_timestamp_t time, quint16 state)-
1136 : m_window(window)-
1137 , m_code(code)-
1138 , m_time(time)-
1139 , m_state(state)-
1140 , m_error(false)-
1141 , m_release(true)-
1142 {-
1143 }
never executed: end of block
0
1144-
1145 bool checkEvent(xcb_generic_event_t *ev)-
1146 {-
1147 if (m_error
m_errorDescription
TRUEnever evaluated
FALSEnever evaluated
|| !ev
!evDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1148 return
never executed: return false;
false;
never executed: return false;
0
1149-
1150 int type = ev->response_type & ~0x80;-
1151 if (type != 2
type != 2Description
TRUEnever evaluated
FALSEnever evaluated
&& type != 3
type != 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1152 return
never executed: return false;
false;
never executed: return false;
0
1153-
1154 xcb_key_press_event_t *event = (xcb_key_press_event_t *)ev;-
1155-
1156 if (event->event != m_window
event->event != m_windowDescription
TRUEnever evaluated
FALSEnever evaluated
|| event->detail != m_code
event->detail != m_codeDescription
TRUEnever evaluated
FALSEnever evaluated
|| event->state != m_state
event->state != m_stateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1157 m_error = true;-
1158 return
never executed: return false;
false;
never executed: return false;
0
1159 }-
1160-
1161 if (type == 2
type == 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1162 m_error = !m_release
!m_releaseDescription
TRUEnever evaluated
FALSEnever evaluated
|| event->time - m_time > 10
event->time - m_time > 10Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1163 return
never executed: return !m_error;
!m_error;
never executed: return !m_error;
0
1164 }-
1165-
1166 if (m_release
m_releaseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1167 m_error = true;-
1168 return
never executed: return false;
false;
never executed: return false;
0
1169 }-
1170-
1171 m_release = true;-
1172 m_time = event->time;-
1173-
1174 return
never executed: return false;
false;
never executed: return false;
0
1175 }-
1176-
1177 bool release() const { return
never executed: return m_release;
m_release;
never executed: return m_release;
}
0
1178 xcb_timestamp_t time() const { return
never executed: return m_time;
m_time;
never executed: return m_time;
}
0
1179-
1180private:-
1181 xcb_window_t m_window;-
1182 xcb_keycode_t m_code;-
1183 xcb_timestamp_t m_time;-
1184 quint16 m_state;-
1185-
1186 bool m_error;-
1187 bool m_release;-
1188};-
1189-
1190void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code,-
1191 quint16 state, xcb_timestamp_t time)-
1192{-
1193 (void)connection();;-
1194-
1195 if (!m_config
!m_configDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1196 return;
never executed: return;
0
1197-
1198 QXcbWindow *source = connection()->platformWindowFromId(sourceWindow);-
1199 QXcbWindow *targetWindow = connection()->focusWindow()
connection()->focusWindow()Description
TRUEnever evaluated
FALSEnever evaluated
? connection()->focusWindow() : source;
0
1200 if (!targetWindow
!targetWindowDescription
TRUEnever evaluated
FALSEnever evaluated
|| !source
!sourceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1201 return;
never executed: return;
0
1202 if (type == QEvent::KeyPress
type == QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1203 targetWindow->updateNetWmUserTime(time);
never executed: targetWindow->updateNetWmUserTime(time);
0
1204-
1205-
1206-
1207-
1208-
1209 struct xkb_state *kb_state = xkb_state_new(xkb_keymap);-
1210 if (!kb_state
!kb_stateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1211 return;
never executed: return;
0
1212 updateXKBStateFromState(kb_state, state);-
1213-
1214 xcb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code);-
1215-
1216 QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();-
1217 QMetaMethod method;-
1218-
1219 if (inputContext
inputContextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1220 int methodIndex = inputContext->metaObject()->indexOfMethod("x11FilterEvent(uint,uint,uint,bool)");-
1221 if (methodIndex != -1
methodIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1222 method = inputContext->metaObject()->method(methodIndex);
never executed: method = inputContext->metaObject()->method(methodIndex);
0
1223 }
never executed: end of block
0
1224-
1225 if (method.isValid()
method.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1226 bool retval = false;-
1227 method.invoke(inputContext, Qt::DirectConnection,-
1228 QReturnArgument<bool >("bool", retval),-
1229 QArgument<uint >("uint", sym),-
1230 QArgument<uint >("uint", code),-
1231 QArgument<uint >("uint", state),-
1232 QArgument<bool >("bool", type == QEvent::KeyPress));-
1233 if (retval
retvalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1234 xkb_state_unref(kb_state);-
1235 return;
never executed: return;
0
1236 }-
1237 }
never executed: end of block
0
1238-
1239 QString string = lookupString(kb_state, code);-
1240-
1241-
1242-
1243-
1244 Qt::KeyboardModifiers modifiers = translateModifiers(state);-
1245 xcb_keysym_t translatedSym = 0x000000;-
1246 if (modifiers & Qt::ControlModifier
modifiers & Qt...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
&& !isLatin(sym)
!isLatin(sym)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1247 translatedSym = lookupLatinKeysym(code);
never executed: translatedSym = lookupLatinKeysym(code);
0
1248 if (translatedSym == 0x000000
translatedSym == 0x000000Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1249 translatedSym = sym;
never executed: translatedSym = sym;
0
1250 int qtcode = keysymToQtKey(translatedSym, modifiers, string);-
1251-
1252 bool isAutoRepeat = false;-
1253 if (type == QEvent::KeyPress
type == QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1254 if (m_autorepeat_code == code
m_autorepeat_code == codeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1255 isAutoRepeat = true;-
1256 m_autorepeat_code = 0;-
1257 }
never executed: end of block
0
1258 }
never executed: end of block
else {
0
1259-
1260 KeyChecker checker(source->xcb_window(), code, time, state);-
1261 xcb_generic_event_t *event = connection()->checkEvent(checker);-
1262 if (event
eventDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1263 isAutoRepeat = true;-
1264 free(event);-
1265 }
never executed: end of block
0
1266 m_autorepeat_code = isAutoRepeat
isAutoRepeatDescription
TRUEnever evaluated
FALSEnever evaluated
? code : 0;
0
1267 }
never executed: end of block
0
1268-
1269 bool filtered = false;-
1270 if (inputContext
inputContextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1271 QKeyEvent event(type, qtcode, modifiers, code, sym, state, string, isAutoRepeat, string.length());-
1272 event.setTimestamp(time);-
1273 filtered = inputContext->filterEvent(&event);-
1274 }
never executed: end of block
0
1275-
1276 QWindow *window = targetWindow->window();-
1277 if (!filtered
!filteredDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1278-
1279 if (type == QEvent::KeyPress
type == QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
&& qtcode == Qt::Key_Menu
qtcode == Qt::Key_MenuDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1280 const QPoint globalPos = window->screen()->handle()->cursor()->pos();-
1281 const QPoint pos = window->mapFromGlobal(globalPos);-
1282 QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers);-
1283 }
never executed: end of block
0
1284-
1285 QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,-
1286 code, sym, state, string, isAutoRepeat);-
1287 }
never executed: end of block
0
1288-
1289 if (isAutoRepeat
isAutoRepeatDescription
TRUEnever evaluated
FALSEnever evaluated
&& type == QEvent::KeyRelease
type == QEvent::KeyReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1290-
1291 filtered = false;-
1292 if (method.isValid()
method.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1293 method.invoke(inputContext, Qt::DirectConnection,-
1294 QReturnArgument<bool >("bool", filtered),-
1295 QArgument<uint >("uint", sym),-
1296 QArgument<uint >("uint", code),-
1297 QArgument<uint >("uint", state),-
1298 QArgument<bool >("bool", true));-
1299 }
never executed: end of block
0
1300-
1301 if (!filtered
!filteredDescription
TRUEnever evaluated
FALSEnever evaluated
&& inputContext
inputContextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1302 QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat, string.length());-
1303 event.setTimestamp(time);-
1304 filtered = inputContext->filterEvent(&event);-
1305 }
never executed: end of block
0
1306 if (!filtered
!filteredDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1307 QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers,
never executed: QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat);
0
1308 code, sym, state, string, isAutoRepeat);
never executed: QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat);
0
1309 }
never executed: end of block
0
1310 xkb_state_unref(kb_state);-
1311}
never executed: end of block
0
1312-
1313QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const-
1314{-
1315 QVarLengthArray<char, 32> chars(32);-
1316 const int size = xkb_state_key_get_utf8(state, code, chars.data(), chars.size());-
1317 if (__builtin_expect(!!(size + 1 > chars.size()), false)
__builtin_expe...ize()), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1318 chars.resize(size + 1);-
1319 xkb_state_key_get_utf8(state, code, chars.data(), chars.size());-
1320 }
never executed: end of block
0
1321 return
never executed: return QString::fromUtf8(chars.constData(), size);
QString::fromUtf8(chars.constData(), size);
never executed: return QString::fromUtf8(chars.constData(), size);
0
1322}-
1323-
1324void QXcbKeyboard::handleKeyPressEvent(const xcb_key_press_event_t *event)-
1325{-
1326 handleKeyEvent(event->event, QEvent::KeyPress, event->detail, event->state, event->time);-
1327}
never executed: end of block
0
1328-
1329void QXcbKeyboard::handleKeyReleaseEvent(const xcb_key_release_event_t *event)-
1330{-
1331 handleKeyEvent(event->event, QEvent::KeyRelease, event->detail, event->state, event->time);-
1332}
never executed: end of block
0
1333-
1334void QXcbKeyboard::handleMappingNotifyEvent(const void *event)-
1335{-
1336 updateKeymap();-
1337 if (connection()->hasXKB()
connection()->hasXKB()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1338 updateVModMapping();-
1339 updateVModToRModMapping();-
1340 }
never executed: end of block
else {
0
1341 void *ev = const_cast<void *>(event);-
1342 xcb_refresh_keyboard_mapping(m_key_symbols, static_cast<xcb_mapping_notify_event_t *>(ev));-
1343 updateModifiers();-
1344 }
never executed: end of block
0
1345}-
1346-
1347-
Switch to Source codePreprocessed file

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