From 82062637aeb2188afc96d918fe72d650740c7507 Mon Sep 17 00:00:00 2001 From: mbattista Date: Sat, 10 Apr 2021 23:33:58 +0000 Subject: [PATCH] duplicated code --- server/internal/xorg/xorg.c | 45 +++++++++++-------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/server/internal/xorg/xorg.c b/server/internal/xorg/xorg.c index b076f47b..885dbd48 100644 --- a/server/internal/xorg/xorg.c +++ b/server/internal/xorg/xorg.c @@ -130,40 +130,21 @@ int XKey(unsigned long key, int down) { Display *display = getXDisplay(); KeyCode code = -2; - if (down) { - code = XkbKeysymToKeycode(key); - if (!code) { - int min, max, numcodes; - XDisplayKeycodes(display, &min, &max); - XGetKeyboardMapping(display, min, max-min, &numcodes); + code = XkbKeysymToKeycode(key); + if (!code) { + int min, max, numcodes; + XDisplayKeycodes(display, &min, &max); + XGetKeyboardMapping(display, min, max-min, &numcodes); - code = (max-min+1)*numcodes; - KeySym keysym_list[numcodes]; - for(int i=0;i