MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / x11SendKey

Function x11SendKey

src/gui/UBKeyboardPalette_linux.cpp:68–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void x11SendKey(Display *display, int keyCode, int modifiers)
69{
70
71// Get the root window for the current display.
72 Window winRoot = XDefaultRootWindow(display);
73 if (winRoot==0)
74 return;
75
76// Find the window which has the current keyboard focus.
77 Window winFocus;
78 int revert;
79 XGetInputFocus(display, &winFocus, &revert);
80
81// Send a fake key press event to the window.
82 XKeyEvent event = createKeyEvent(display, winFocus, winRoot, true, keyCode, modifiers);
83 XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event);
84
85// Send a fake key release event to the window.
86 event = createKeyEvent(display, winFocus, winRoot, false, keyCode, modifiers);
87 XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event);
88
89}
90
91/*
92void traceKeyCodes()

Callers 2

sendUnicodeSymbolMethod · 0.85
sendControlSymbolMethod · 0.85

Calls 1

createKeyEventFunction · 0.85

Tested by

no test coverage detected