From d610e9c3c878e39ae908f04843ed563b4669732f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 22 Jul 2017 17:34:22 +0200 Subject: Keyboard.c: move keyboard file creation to extra function --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 108 ++++++++++++++------------ 1 file changed, 57 insertions(+), 51 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index c2c36ad23..0b4e26953 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -83,6 +83,8 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout, static void nxagentKeycodeConversionSetup(void); +void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, char *layout, char *variant, char *options); + #endif /* XKB */ /* @@ -1557,6 +1559,56 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout, return n; } +void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, char *layout, char *variant, char *options) +{ + if (ruleslen) + { + char *sessionpath = nxagentGetSessionPath(); + if (sessionpath) + { + char *keyboard_file_path = NULL; + FILE *keyboard_file; + if ((asprintf(&keyboard_file_path, "%s/keyboard", sessionpath) == -1)) + { + free(sessionpath); + FatalError("malloc for keyboard file path failed."); + } + free(sessionpath); + if ((keyboard_file = fopen(keyboard_file_path, "w"))) + { + if (rules) + fprintf(keyboard_file, "rules=\"%s\"\n", rules[0] == '\0' ? "," : rules); + if (model) + fprintf(keyboard_file, "model=\"%s\"\n", model[0] == '\0' ? "," : model); + if (layout) + fprintf(keyboard_file, "layout=\"%s\"\n", layout[0] == '\0' ? "," : layout); + /* FIXME: this is not correct. We need to match the number of + comma separated values between variant and layout */ + if (variant) + fprintf(keyboard_file, "variant=\"%s\"\n", variant[0] == '\0' ? "," : variant); + if (options) + fprintf(keyboard_file, "options=\"%s\"\n", options[0] == '\0' ? "," : options); + fclose(keyboard_file); + fprintf(stderr, "Info: keyboard file created: '%s'\n", keyboard_file_path); + } + else + { + int save_err = errno; + fprintf(stderr, "Error: keyboard file not created: %s\n", strerror(save_err)); + } + free(keyboard_file_path); + } + else + { + fprintf(stderr, "Warning: Failed to create keyboard file: SessionPath not defined\n"); + } + } + else + { + fprintf(stderr, "Warning: Failed to create the keyboard file\n"); + } +} + void nxagentKeycodeConversionSetup(void) { char *drules = NULL; @@ -1587,69 +1639,23 @@ void nxagentKeycodeConversionSetup(void) #ifdef DEBUG if (drulesLen != 0 && drules && dmodel) { - fprintf(stderr, "nxagentKeycodeConversionSetup: " - "Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", - drules, dmodel, dlayout, dvariant, doptions); + fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", + __func__, drules, dmodel, dlayout, dvariant, doptions); } else { - fprintf(stderr, "nxagentKeycodeConversionSetup: " - "Failed to retrieve remote rules.\n"); + fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); } #endif - if (drulesLen != 0) - { - char *sessionpath = nxagentGetSessionPath(); - if (sessionpath) - { - char *keyboard_file_path = NULL; - FILE *keyboard_file; - if ((asprintf(&keyboard_file_path, "%s/keyboard", sessionpath) == -1)) - { - free(sessionpath); - FatalError("malloc for keyboard file path failed."); - } - free(sessionpath); - if ((keyboard_file = fopen(keyboard_file_path, "w"))) - { - if (drules) - fprintf(keyboard_file, "rules=\"%s\"\n", drules[0] == '\0' ? "," : drules); - if (dmodel) - fprintf(keyboard_file, "model=\"%s\"\n", dmodel[0] == '\0' ? "," : dmodel); - if (dlayout) - fprintf(keyboard_file, "layout=\"%s\"\n", dlayout[0] == '\0' ? "," : dlayout); - if (dvariant) - fprintf(keyboard_file, "variant=\"%s\"\n", dvariant[0] == '\0' ? "," : dvariant); - if (doptions) - fprintf(keyboard_file, "options=\"%s\"\n", doptions[0] == '\0' ? "," : doptions); - fclose(keyboard_file); - fprintf(stderr, "Info: keyboard file created: '%s'\n", keyboard_file_path); - } - else - { - int save_err = errno; - fprintf(stderr, "Error: keyboard file not created: %s\n", strerror(save_err)); - } - free(keyboard_file_path); - } - else - { - fprintf(stderr, "Warning: SessionPath not defined\n"); - } - } - else - { - fprintf(stderr, "Warning: Failed to create the keyboard file\n"); - } + nxagentWriteKeyboardFile(drulesLen, drules, dmodel, dlayout, dvariant, doptions); if (drules && dmodel && (strcmp(drules, "evdev") == 0 || strcmp(dmodel, "evdev") == 0)) { #ifdef DEBUG - fprintf(stderr, "nxagentKeycodeConversionSetup: " - "Activating KeyCode conversion.\n"); + fprintf(stderr, "%s: Activating KeyCode conversion.\n", __func__); #endif fprintf(stderr, "Info: Keycode conversion auto-determined as on\n"); -- cgit v1.2.3 From 269a352ff493f2f41e81afa5485dec39d2d5dbf4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 22 Jul 2017 18:56:13 +0200 Subject: Keyboard.c: refactor keycode conversion we'll need the remote xkb in KeyboardProc in future so let's move it up. --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 94 ++++++++++++++++----------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 0b4e26953..3410e09b0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -81,7 +81,7 @@ is" without express or implied warranty. static int nxagentXkbGetNames(char **rules, char **model, char **layout, char **variant, char **options); -static void nxagentKeycodeConversionSetup(void); +static void nxagentKeycodeConversionSetup(char *rules, char *model); void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, char *layout, char *variant, char *options); @@ -818,9 +818,38 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: Init XKB extension.\n"); #endif - xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); + { + char *drules = NULL; + char *dmodel = NULL; + char *dlayout = NULL; + char *dvariant = NULL; + char *doptions = NULL; + + unsigned int drulesLen = nxagentXkbGetNames(&drules, &dmodel, &dlayout, + &dvariant, &doptions); + + #ifdef DEBUG + if (drulesLen && drules && dmodel) + { + fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", + __func__, drules, dmodel, dlayout, dvariant, doptions); + } + else + { + fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); + } + #endif - nxagentKeycodeConversionSetup(); + nxagentWriteKeyboardFile(drulesLen, drules, dmodel, dlayout, dvariant, doptions); + nxagentKeycodeConversionSetup(drules, dmodel); + + if (drules) + { + XFree(drules); + } + } + + xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); if (xkb && xkb->geom) { @@ -1609,15 +1638,8 @@ void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, c } } -void nxagentKeycodeConversionSetup(void) +void nxagentKeycodeConversionSetup(char * rules, char * model) { - char *drules = NULL; - char *dmodel = NULL; - char *dlayout = NULL; - char *dvariant = NULL; - char *doptions = NULL; - unsigned int drulesLen; - if (nxagentOption(KeycodeConversion) == KeycodeConversionOff) { fprintf(stderr, "Info: Keycode conversion is off\n"); @@ -1631,28 +1653,9 @@ void nxagentKeycodeConversionSetup(void) return; } - nxagentKeycodeConversion = False; - - drulesLen = nxagentXkbGetNames(&drules, &dmodel, &dlayout, - &dvariant, &doptions); - - #ifdef DEBUG - if (drulesLen != 0 && drules && dmodel) - { - fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", - __func__, drules, dmodel, dlayout, dvariant, doptions); - } - else - { - fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); - } - #endif - - nxagentWriteKeyboardFile(drulesLen, drules, dmodel, dlayout, dvariant, doptions); - - if (drules && dmodel && - (strcmp(drules, "evdev") == 0 || - strcmp(dmodel, "evdev") == 0)) + if (rules && model && + (strcmp(rules, "evdev") == 0 || + strcmp(model, "evdev") == 0)) { #ifdef DEBUG fprintf(stderr, "%s: Activating KeyCode conversion.\n", __func__); @@ -1663,12 +1666,13 @@ void nxagentKeycodeConversionSetup(void) } else { + #ifdef DEBUG + fprintf(stderr, "%s: Deactivating KeyCode conversion.\n", __func__); + #endif + fprintf(stderr, "Info: Keycode conversion auto-determined as off\n"); - } - if (drules) - { - XFree(drules); + nxagentKeycodeConversion = False; } } @@ -1683,7 +1687,21 @@ void nxagentResetKeycodeConversion(void) if (result != 0) { - nxagentKeycodeConversionSetup(); + char *drules = NULL; + char *dmodel = NULL; + char *dlayout = NULL; + char *dvariant = NULL; + char *doptions = NULL; + unsigned int drulesLen; + + drulesLen = nxagentXkbGetNames(&drules, &dmodel, &dlayout, + &dvariant, &doptions); + + if (drulesLen && drules && dmodel) + nxagentKeycodeConversionSetup(drules, dmodel); + + if (drules) + XFree(drules); } else { -- cgit v1.2.3 From d0d6c1bdba457c9e6cc5eaddbe8d94e5b2dd74ad Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 1 Dec 2018 23:59:36 +0100 Subject: Keyboard.c: rename variables to better reflect their meaning --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 50 +++++++++++++-------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 3410e09b0..b525a2a9c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -819,20 +819,20 @@ XkbError: #endif { - char *drules = NULL; - char *dmodel = NULL; - char *dlayout = NULL; - char *dvariant = NULL; - char *doptions = NULL; + char *remoterules = NULL; + char *remotemodel = NULL; + char *remotelayout = NULL; + char *remotevariant = NULL; + char *remoteoptions = NULL; - unsigned int drulesLen = nxagentXkbGetNames(&drules, &dmodel, &dlayout, - &dvariant, &doptions); + unsigned int remoteruleslen = nxagentXkbGetNames(&remoterules, &remotemodel, &remotelayout, + &remotevariant, &remoteoptions); #ifdef DEBUG - if (drulesLen && drules && dmodel) + if (remoteruleslen && remoterules && remotemodel) { fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", - __func__, drules, dmodel, dlayout, dvariant, doptions); + __func__, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); } else { @@ -840,12 +840,12 @@ XkbError: } #endif - nxagentWriteKeyboardFile(drulesLen, drules, dmodel, dlayout, dvariant, doptions); - nxagentKeycodeConversionSetup(drules, dmodel); + nxagentWriteKeyboardFile(remoteruleslen, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); + nxagentKeycodeConversionSetup(remoterules, remotemodel); - if (drules) + if (remoterules) { - XFree(drules); + XFree(remoterules); } } @@ -1687,21 +1687,21 @@ void nxagentResetKeycodeConversion(void) if (result != 0) { - char *drules = NULL; - char *dmodel = NULL; - char *dlayout = NULL; - char *dvariant = NULL; - char *doptions = NULL; - unsigned int drulesLen; + char *remoterules = NULL; + char *remotemodel = NULL; + char *remotelayout = NULL; + char *remotevariant = NULL; + char *remoteoptions = NULL; + unsigned int remoteruleslen; - drulesLen = nxagentXkbGetNames(&drules, &dmodel, &dlayout, - &dvariant, &doptions); + remoteruleslen = nxagentXkbGetNames(&remoterules, &remotemodel, &remotelayout, + &remotevariant, &remoteoptions); - if (drulesLen && drules && dmodel) - nxagentKeycodeConversionSetup(drules, dmodel); + if (remoteruleslen && remoterules && remotemodel) + nxagentKeycodeConversionSetup(remoterules, remotemodel); - if (drules) - XFree(drules); + if (remoterules) + XFree(remoterules); } else { -- cgit v1.2.3 From 3c4a8da12fd514c4df1abcb5fbe1081dd06462fb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Dec 2018 00:09:00 +0100 Subject: Keyboard.c: use 'variant' all over the place avoid mix of 'variant' and 'variants' --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index b525a2a9c..0871a5808 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -746,7 +746,7 @@ XkbError: #ifdef XKB } else { /* if (noXkbExtension) */ XkbComponentNamesRec names = {0}; - char *rules = NULL, *variants = NULL, *options = NULL; /* use xkb default */ + char *rules = NULL, *variant = NULL, *options = NULL; /* use xkb default */ #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using XKB extension.\n"); @@ -864,11 +864,11 @@ XkbError: #ifdef DEBUG fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: " - "[rules='%s',model='%s',layout='%s',variants='%s',options='%s'].\n", - rules, model, layout, variants, options); + "[rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", + rules, model, layout, variant, options); #endif - XkbSetRulesDflts(rules, model, layout, variants, options); + XkbSetRulesDflts(rules, model, layout, variant, options); XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); -- cgit v1.2.3 From fb31220f248e82a36ae49be5c5d3abef5a791373 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 1 Dec 2018 18:17:40 +0100 Subject: Keyboard.c: reformat nxagentKeycodeConversionSetup --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 37 +++++++++++++-------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 0871a5808..dcb58de10 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -1644,35 +1644,34 @@ void nxagentKeycodeConversionSetup(char * rules, char * model) { fprintf(stderr, "Info: Keycode conversion is off\n"); nxagentKeycodeConversion = False; - return; } else if (nxagentOption(KeycodeConversion) == KeycodeConversionOn) { fprintf(stderr, "Info: Keycode conversion is on\n"); nxagentKeycodeConversion = True; - return; - } - - if (rules && model && - (strcmp(rules, "evdev") == 0 || - strcmp(model, "evdev") == 0)) - { - #ifdef DEBUG - fprintf(stderr, "%s: Activating KeyCode conversion.\n", __func__); - #endif - - fprintf(stderr, "Info: Keycode conversion auto-determined as on\n"); - nxagentKeycodeConversion = True; } else { - #ifdef DEBUG - fprintf(stderr, "%s: Deactivating KeyCode conversion.\n", __func__); - #endif + if (rules && model && + (strcmp(rules, "evdev") == 0 || + strcmp(model, "evdev") == 0)) + { + #ifdef DEBUG + fprintf(stderr, "%s: Activating KeyCode conversion.\n", __func__); + #endif - fprintf(stderr, "Info: Keycode conversion auto-determined as off\n"); + fprintf(stderr, "Info: Keycode conversion auto-determined as on\n"); + nxagentKeycodeConversion = True; + } + else + { + #ifdef DEBUG + fprintf(stderr, "%s: Deactivating KeyCode conversion.\n", __func__); + #endif - nxagentKeycodeConversion = False; + fprintf(stderr, "Info: Keycode conversion auto-determined as off\n"); + nxagentKeycodeConversion = False; + } } } -- cgit v1.2.3 From 3b62184a1aaa3f8a66aab21c21d12162e7ba83df Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 23 Jul 2017 02:03:58 +0200 Subject: Keyboard.c: improve creation of keyboard config file It will now create better working config files. References: ArcticaProject/nx-libs#239 ArcticaProject/nx-libs#368 --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 44 +++++++++++++++++---------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index dcb58de10..9efafdf7c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -83,7 +83,7 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout, static void nxagentKeycodeConversionSetup(char *rules, char *model); -void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, char *layout, char *variant, char *options); +void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options); #endif /* XKB */ @@ -840,7 +840,7 @@ XkbError: } #endif - nxagentWriteKeyboardFile(remoteruleslen, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); + nxagentWriteKeyboardFile(remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); nxagentKeycodeConversionSetup(remoterules, remotemodel); if (remoterules) @@ -1588,10 +1588,32 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout, return n; } -void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, char *layout, char *variant, char *options) +void writeKeyboardfileData(FILE *out, char *rules, char *model, char *layout, char *variant, char *options) { - if (ruleslen) + /* + How to set "empty" values with setxkbmap, result of trial and error: + - model and layout: empty strings are accepted by setxkbmap. + - rules: setxkbmap will fail if rules is an empty string + (code will intercept in an earlier stage in that case) + - variant: the variant line must be omitted completely. + - options: prepend value with "," to override, otherwise options will be added. + */ + fprintf(out, "rules=\"%s\"\n", rules); + fprintf(out, "model=\"%s\"\n", model ? model : ""); + fprintf(out, "layout=\"%s\"\n", layout ? layout : ""); + if (variant && variant[0] != '\0') + fprintf(out, "variant=\"%s\"\n", variant); + fprintf(out, "options=\",%s\"\n", options ? options : ""); +} + +void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options) +{ + if (rules && rules[0] != '\0') { + #ifdef DEBUG + writeKeyboardfileData(stderr, rules, model, layout, variant, options); + #endif + char *sessionpath = nxagentGetSessionPath(); if (sessionpath) { @@ -1605,18 +1627,8 @@ void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, c free(sessionpath); if ((keyboard_file = fopen(keyboard_file_path, "w"))) { - if (rules) - fprintf(keyboard_file, "rules=\"%s\"\n", rules[0] == '\0' ? "," : rules); - if (model) - fprintf(keyboard_file, "model=\"%s\"\n", model[0] == '\0' ? "," : model); - if (layout) - fprintf(keyboard_file, "layout=\"%s\"\n", layout[0] == '\0' ? "," : layout); - /* FIXME: this is not correct. We need to match the number of - comma separated values between variant and layout */ - if (variant) - fprintf(keyboard_file, "variant=\"%s\"\n", variant[0] == '\0' ? "," : variant); - if (options) - fprintf(keyboard_file, "options=\"%s\"\n", options[0] == '\0' ? "," : options); + writeKeyboardfileData(keyboard_file, rules, model, layout, variant, options); + fclose(keyboard_file); fprintf(stderr, "Info: keyboard file created: '%s'\n", keyboard_file_path); } -- cgit v1.2.3 From 21a0ce3672e53346c90aad2a9f5953d453e55a05 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 1 Dec 2018 22:37:40 +0100 Subject: nxagent: fix references to default rules in manpage we have changed that to base some time ago. --- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 3b616272a..892248d60 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -620,12 +620,12 @@ settings. .I / use the given model and layout. You can not modify keyboard rules, variant or options. Instead preset values are used. These are -\fIxfree86\fR for rules and empty strings for variant and options. +\fIbase\fR for rules and empty strings for variant and options. .RE .TP 8 .PP -If \fIkeyboard\fR is omitted the internal defaults of \fBnxagent\fR will be used (rules: \fIxfree86\fR, layout: \fIus\fR, model: \fIpc102\fR, empty variant and options). +If \fIkeyboard\fR is omitted the internal defaults of \fBnxagent\fR will be used (rules: \fIbase\fR, layout: \fIus\fR, model: \fIpc102\fR, empty variant and options). .TP 8 .B keyconv= -- cgit v1.2.3 From 4dfe84eafb3838e1b54f81450369c0b8e3bb8350 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Dec 2018 21:52:33 +0100 Subject: Keyboard.c: remove non-fitting comment Describes a check we are not doing here anymore... --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 9efafdf7c..1da6a0149 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -708,12 +708,6 @@ N/A #ifdef XKB - /* - * First of all the validity - * of XkbBaseDirectory global - * variable is checked. - */ - if (noXkbExtension) { #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: No XKB extension.\n"); -- cgit v1.2.3 From 26b033b84e682bfe098711204418319f753a34dc Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Dec 2018 21:34:40 +0100 Subject: Reconnect.c: restore old keyboard value if no new one is given It may not fully fix the issue mentioned below but it does for the -keyboard commandline option at least. Fixes ArcticaProject/nx-libs#741 --- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 6d15f2021..4b1ae03f9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -584,6 +584,17 @@ Bool nxagentReconnectSession(void) goto nxagentReconnectError; } + /* if there's no keyboard definition in the options file + restore the previous value. */ + #ifdef DEBUG + fprintf(stderr, "%s: nxagentKeyboard [%s] nxagentOldKeyboard [%s]\n", __func__, nxagentKeyboard, nxagentOldKeyboard); + #endif + if (nxagentKeyboard == NULL) + { + nxagentKeyboard = nxagentOldKeyboard; + nxagentOldKeyboard = NULL; + } + if (nxagentOption(ResetKeyboardAtResume) == 1 && (nxagentKeyboard == NULL || nxagentOldKeyboard == NULL || strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 || -- cgit v1.2.3