MCPcopy Create free account
hub / github.com/deskflow/deskflow / fakeKey

Method fakeKey

src/lib/platform/XWindowsKeyState.cpp:265–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265void XWindowsKeyState::fakeKey(const Keystroke &keystroke)
266{
267 switch (keystroke.m_type) {
268 case Keystroke::KeyType::Button:
269 if (keystroke.m_data.m_button.m_repeat) {
270 int c = keystroke.m_data.m_button.m_button;
271 int i = (c >> 3);
272 int b = 1 << (c & 7);
273 if (m_keyboardState.global_auto_repeat == AutoRepeatModeOff ||
274 (c != 113 && c != 116 && (m_keyboardState.auto_repeats[i] & b) == 0)) {
275 LOG_DEBUG1(" discard autorepeat");
276 break;
277 }
278 }
279 XTestFakeKeyEvent(
280 m_display, keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_press ? True : False, CurrentTime
281 );
282 break;
283
284 case Keystroke::KeyType::Group:
285 if (keystroke.m_data.m_group.m_restore) {
286 break;
287 }
288
289 if (keystroke.m_data.m_group.m_absolute) {
290
291#ifndef __APPLE__
292 if (setCurrentLanguageWithDBus(keystroke.m_data.m_group.m_group)) {
293 break;
294 }
295#endif
296#if HAVE_XKB_EXTENSION
297 if (m_xkb != nullptr) {
298 if (XkbLockGroup(m_display, XkbUseCoreKbd, keystroke.m_data.m_group.m_group) == False) {
299 LOG_DEBUG1("xkb lock group request not sent");
300 }
301 } else
302#endif
303 {
304 LOG_DEBUG1(" ignored");
305 }
306 } else {
307
308#ifndef __APPLE__
309 if (setCurrentLanguageWithDBus(keystroke.m_data.m_group.m_group)) {
310 break;
311 }
312#endif
313#if HAVE_XKB_EXTENSION
314 if (m_xkb != nullptr) {
315 if (XkbLockGroup(
316 m_display, XkbUseCoreKbd, getEffectiveGroup(pollActiveGroup(), keystroke.m_data.m_group.m_group)
317 ) == False) {
318 LOG_DEBUG1("xkb lock group request not sent");
319 }
320 } else
321#endif
322 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected