From 19c6b8c4ae0590e494b94de7c995bc1efbbd10dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 13 Jun 2020 13:29:16 +0200 Subject: [PATCH] test if XKeysymToKeycode returns zero --- server/internal/xorg/xorg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/internal/xorg/xorg.c b/server/internal/xorg/xorg.c index a835f7a..17733c0 100644 --- a/server/internal/xorg/xorg.c +++ b/server/internal/xorg/xorg.c @@ -97,8 +97,11 @@ void XButton(unsigned int button, int down) { void XKey(unsigned long key, int down) { Display *display = getXDisplay(); KeyCode code = XKeysymToKeycode(display, key); - XTestFakeKeyEvent(display, code, down, CurrentTime); - XSync(display, 0); + + if (code != 0) { + XTestFakeKeyEvent(display, code, down, CurrentTime); + XSync(display, 0); + } } void XClipboardSet(char *src) {