From 1de6ca599f6f410308c7fe2ddd700197f66662fd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 22 Jul 2017 19:03:19 +0200 Subject: nxagent: add keyboard=clone configuration option Specifying -keyboard clone (or keyboard=clone in options) will clone XKB keyboard from the remote x server. This way many keyboard problems will hopefully never return... Should be the default but is not (yet) for compatibility reasons. Fixes ArcticaProject/nx-libs#373 (except the "do autoconf if no keyboard is provided" feature.) References: ArcticaProject/nx-libs#240 ArcticaProject/nx-libs#368 --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 39 +++++++++++++++++++++--- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 3 +- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 11 +++++-- 3 files changed, 44 insertions(+), 9 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 1da6a0149..89e51b628 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -761,7 +761,9 @@ XkbError: layout. */ - if (nxagentKeyboard && (strcmp(nxagentKeyboard, "query") != 0)) + if (nxagentKeyboard && + (strcmp(nxagentKeyboard, "query") != 0) && + (strcmp(nxagentKeyboard, "clone") != 0)) { for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++); @@ -822,21 +824,48 @@ XkbError: unsigned int remoteruleslen = nxagentXkbGetNames(&remoterules, &remotemodel, &remotelayout, &remotevariant, &remoteoptions); - #ifdef DEBUG if (remoteruleslen && remoterules && remotemodel) { + #ifdef DEBUG fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", __func__, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); + #endif + + /* + * Keyboard has always been tricky with nxagent. For that + * reason X2Go offers "auto" keyboard configuration. You can + * specify it in the client side session configuration. In + * "auto" mode x2goserver expects nxagent to write the + * remote keyboard config to a file on startup and + * x2goserver would then pick that file and pass it to + * setxkbmap. This functionality is obsoleted by the "clone" + * stuff but we still need it because x2goserver does not + * know about that yet. Once x2go starts using clone we can + * drop this here. + */ + nxagentWriteKeyboardFile(remoteruleslen, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); + + /* Only setup keycode conversion if we are NOT in clone mode */ + if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0)) + { + free(rules); rules = strdup(remoterules); + free(model); model = strdup(remotemodel); + free(layout); layout = strdup(remotelayout); + free(variant); variant = strdup(remotevariant); + free(options); options = strdup(remoteoptions); + } + else + { + nxagentKeycodeConversionSetup(remoterules, remotemodel); + } } + #ifdef DEBUG else { fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); } #endif - nxagentWriteKeyboardFile(remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); - nxagentKeycodeConversionSetup(remoterules, remotemodel); - if (remoterules) { XFree(remoterules); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 4b1ae03f9..a61b42530 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -598,7 +598,8 @@ Bool nxagentReconnectSession(void) if (nxagentOption(ResetKeyboardAtResume) == 1 && (nxagentKeyboard == NULL || nxagentOldKeyboard == NULL || strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 || - strcmp(nxagentKeyboard, "query") == 0)) + strcmp(nxagentKeyboard, "query") == 0 || + strcmp(nxagentKeyboard, "clone") == 0)) { if (nxagentResetKeyboard() == 0) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 892248d60..84669ff36 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -525,8 +525,8 @@ don't reset keyboard device if the session is resumed this is only relevant if you also specify \-keyboard=query. In that case \fBnxagent\fR will lock the keyboard settings and clients will get an error when trying to change keyboard settings via -XKEYBOARD. With \-noxkblock the lock is not applied and clients can -change the keyboard settings through XKEYBOARD. +XKEYBOARD. With \-noxkblock the lock is not applied and clients are +allowed change the keyboard settings through XKEYBOARD. .TP 8 .B \-tile WxH size of image tiles (minimum allowed: 32x32) @@ -603,7 +603,7 @@ start or resume a session in fullscreen mode (default: off) .TP 8 .B keyboard= or kbtype= -.BR query | / +.BR query | clone | / .RS 8 .TP 8 @@ -617,6 +617,11 @@ this platform. Note that in this case XKEYBOARD will always report the default layout which will most likely not match the experienced settings. .TP 8 +.I clone +ask the real X server for the keyboard settings using XKEYBOARD +protocol functions and clone them. This is the recommended setting. For +compatibility reasons it is not the default. +.TP 8 .I / use the given model and layout. You can not modify keyboard rules, variant or options. Instead preset values are used. These are -- cgit v1.2.3 From 161515d2463b539e8d6e6ca8db625cb6f3eece0a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Dec 2018 17:08:31 +0100 Subject: nxagent: add additional keyboard config option rmlvo Add possibility to pass more than model and layout via the keyboard parameter. --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 34 ++++++++++++++++++++---- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 11 ++++++-- 2 files changed, 38 insertions(+), 7 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 89e51b628..d264d1c96 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -774,8 +774,33 @@ XkbError: goto XkbError; } - model = strndup(nxagentKeyboard, i); - layout = strdup(&nxagentKeyboard[i + 1]); + /* + The original nxagent only supports model/layout values + here. It uses these values together with the default rules + and empty variant and options. We use a more or less + compatible hack here: The special keyword rlmvo for model + means that the layout part of the string will contain a + full RMLVO config, separated by #, e.g. + rlmvo/base#pc105#de,us#nodeadkeys#lv3:rwin_switch + */ + if (strncmp(nxagentKeyboard, "rlmvo/", 6) == 0) + { + const char * sep = "#"; + char * rmlvo = strdup(&nxagentKeyboard[i+1]); + char * tmp = rmlvo; + /* strtok cannot handle empty fields, so use strsep */ + rules = strdup(strsep(&tmp, sep)); + model = strdup(strsep(&tmp, sep)); + layout = strdup(strsep(&tmp, sep)); + variant = strdup(strsep(&tmp, sep)); + options = strdup(strsep(&tmp, sep)); + free(rmlvo); + } + else + { + model = strndup(nxagentKeyboard, i); + layout = strdup(&nxagentKeyboard[i + 1]); + } /* * There is no description for pc105 on Solaris. @@ -783,8 +808,8 @@ XkbError: */ #ifdef TEST - fprintf(stderr, "nxagentKeyboardProc: Using keyboard model [%s] with layout [%s].\n", - model, layout); + fprintf(stderr, "%s: Using [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", + __func__, rules, model, layout, variant, options); #endif #ifdef __sun @@ -793,7 +818,6 @@ XkbError: { #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: WARNING! Keyboard model 'pc105' unsupported on Solaris.\n"); - fprintf(stderr, "nxagentKeyboardProc: WARNING! Forcing keyboard model to 'pc104'.\n"); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 84669ff36..938c2eb57 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -603,7 +603,7 @@ start or resume a session in fullscreen mode (default: off) .TP 8 .B keyboard= or kbtype= -.BR query | clone | / +.BR query | clone | / | rmlvo/#### .RS 8 .TP 8 @@ -624,8 +624,15 @@ compatibility reasons it is not the default. .TP 8 .I / use the given model and layout. You can not modify keyboard rules, -variant or options. Instead preset values are used. These are +variant or options this way. Instead preset values are used. These are \fIbase\fR for rules and empty strings for variant and options. +.TP 8 +.I rmlvo/#### +configure the keyboard according to the rmlvo +(Rules+Model+Layout+Variant+Options) description given after the / and +separated by #. This can be used to fully pass the keyboard +configuration of \fBnxagent\fR right after the start. Example: +rmlvo/base#pc105#de,us#nodeadkeys#lv3:rwin_switch .RE .TP 8 -- cgit v1.2.3 From 1d6c241d3c0b10db19476b3f018cc24f2024fa30 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Dec 2018 21:54:15 +0100 Subject: nxagent: store remote keyboard in global variables This avoids some roundtrips. --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 213 ++++++++++++------------- nx-X11/programs/Xserver/hw/nxagent/Keyboard.h | 1 + nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 3 + 3 files changed, 106 insertions(+), 111 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index d264d1c96..20b68b563 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -78,10 +78,9 @@ is" without express or implied warranty. #include -static int nxagentXkbGetNames(char **rules, char **model, char **layout, - char **variant, char **options); +void nxagentXkbGetNames(void); -static void nxagentKeycodeConversionSetup(char *rules, char *model); +void nxagentKeycodeConversionSetup(void); void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options); @@ -140,6 +139,13 @@ extern Status XkbGetControls( extern int XkbDfltRepeatDelay; extern int XkbDfltRepeatInterval; +/* xkb configuration of the real X server */ +static char *nxagentRemoteRules = NULL; +static char *nxagentRemoteModel = NULL; +static char *nxagentRemoteLayout = NULL; +static char *nxagentRemoteVariant = NULL; +static char *nxagentRemoteOptions = NULL; + #endif /* XKB */ /* @@ -571,8 +577,10 @@ int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff) CARD8 modmap[MAP_LENGTH]; int i, j; XKeyboardState values; +#ifdef XKB char *model = NULL, *layout = NULL; XkbDescPtr xkb = NULL; +#endif switch (onoff) { @@ -694,20 +702,13 @@ N/A keySyms.mapWidth = mapWidth; keySyms.map = keymap; - if (XkbQueryExtension(nxagentDisplay, - &nxagentXkbInfo.Opcode, - &nxagentXkbInfo.EventBase, - &nxagentXkbInfo.ErrorBase, - &nxagentXkbInfo.MajorVersion, - &nxagentXkbInfo.MinorVersion) == 0) +#ifdef XKB + if (!nxagentGetRemoteXkbExtension()) { - ErrorF("Unable to initialize XKEYBOARD extension.\n"); - goto XkbError; + ErrorF("Unable to query XKEYBOARD extension.\n"); + goto XkbError; } - -#ifdef XKB - if (noXkbExtension) { #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: No XKB extension.\n"); @@ -838,63 +839,47 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: Init XKB extension.\n"); #endif + if (nxagentRemoteRules && nxagentRemoteModel) { - char *remoterules = NULL; - char *remotemodel = NULL; - char *remotelayout = NULL; - char *remotevariant = NULL; - char *remoteoptions = NULL; + #ifdef DEBUG + fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", + __func__, nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); + #endif - unsigned int remoteruleslen = nxagentXkbGetNames(&remoterules, &remotemodel, &remotelayout, - &remotevariant, &remoteoptions); + /* + * Keyboard has always been tricky with nxagent. For that + * reason X2Go offers "auto" keyboard configuration. You can + * specify it in the client side session configuration. In + * "auto" mode x2goserver expects nxagent to write the + * remote keyboard config to a file on startup and + * x2goserver would then pick that file and pass it to + * setxkbmap. This functionality is obsoleted by the "clone" + * stuff but we still need it because x2goserver does not + * know about that yet. Once x2go starts using clone + * we can drop this here. + */ + nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); - if (remoteruleslen && remoterules && remotemodel) + /* Only setup keycode conversion if we are NOT in clone mode */ + if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0)) { - #ifdef DEBUG - fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", - __func__, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); - #endif - - /* - * Keyboard has always been tricky with nxagent. For that - * reason X2Go offers "auto" keyboard configuration. You can - * specify it in the client side session configuration. In - * "auto" mode x2goserver expects nxagent to write the - * remote keyboard config to a file on startup and - * x2goserver would then pick that file and pass it to - * setxkbmap. This functionality is obsoleted by the "clone" - * stuff but we still need it because x2goserver does not - * know about that yet. Once x2go starts using clone we can - * drop this here. - */ - nxagentWriteKeyboardFile(remoteruleslen, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); - - /* Only setup keycode conversion if we are NOT in clone mode */ - if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0)) - { - free(rules); rules = strdup(remoterules); - free(model); model = strdup(remotemodel); - free(layout); layout = strdup(remotelayout); - free(variant); variant = strdup(remotevariant); - free(options); options = strdup(remoteoptions); - } - else - { - nxagentKeycodeConversionSetup(remoterules, remotemodel); - } + free(rules); rules = strdup(nxagentRemoteRules); + free(model); model = strdup(nxagentRemoteModel); + free(layout); layout = strdup(nxagentRemoteLayout); + free(variant); variant = strdup(nxagentRemoteVariant); + free(options); options = strdup(nxagentRemoteOptions); } - #ifdef DEBUG else { - fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); - } - #endif - - if (remoterules) - { - XFree(remoterules); + nxagentKeycodeConversionSetup(); } } + #ifdef DEBUG + else + { + fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); + } + #endif xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); @@ -1551,8 +1536,16 @@ void nxagentTuneXkbWrapper(void) } } -static int nxagentXkbGetNames(char **rules, char **model, char **layout, - char **variant, char **options) +void nxagentXkbClearNames(void) +{ + free(nxagentRemoteRules); nxagentRemoteRules = NULL; + free(nxagentRemoteModel); nxagentRemoteModel = NULL; + free(nxagentRemoteLayout); nxagentRemoteLayout = NULL; + free(nxagentRemoteVariant); nxagentRemoteVariant = NULL; + free(nxagentRemoteOptions); nxagentRemoteOptions = NULL; +} + +void nxagentXkbGetNames(void) { Atom atom; #ifdef _XSERVER64 @@ -1567,28 +1560,25 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout, char *name; Status result; - data = name = NULL; - - *rules = NULL; - *model = NULL; - *layout = NULL; - *variant = NULL; - *options = NULL; + if (nxagentRemoteRules) + return; atom = XInternAtom(nxagentDisplay, "_XKB_RULES_NAMES", 1); if (atom == 0) { - return 0; + return; } + data = name = NULL; + result = XGetWindowProperty(nxagentDisplay, DefaultRootWindow(nxagentDisplay), atom, 0, 256, 0, XA_STRING, &type, &format, &n, &after, (unsigned char **)&data); if (result != Success || !data) { - return 0; + return; } if ((after > 0) || (type != XA_STRING) || (format != 8)) @@ -1596,7 +1586,7 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout, if (data) { XFree(data); - return 0; + return; } } @@ -1604,35 +1594,37 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout, if (name < data + n) { - *rules = name; + nxagentRemoteRules = strdup(name); name += strlen(name) + 1; } if (name < data + n) { - *model = name; + nxagentRemoteModel = strdup(name); name += strlen(name) + 1; } if (name < data + n) { - *layout = name; + nxagentRemoteLayout = strdup(name); name += strlen(name) + 1; } if (name < data + n) { - *variant = name; + nxagentRemoteVariant = strdup(name); name += strlen(name) + 1; } if (name < data + n) { - *options = name; + nxagentRemoteOptions = strdup(name); name += strlen(name) + 1; } - return n; + XFree(data); + + return; } void writeKeyboardfileData(FILE *out, char *rules, char *model, char *layout, char *variant, char *options) @@ -1697,7 +1689,7 @@ void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *vari } } -void nxagentKeycodeConversionSetup(char * rules, char * model) +void nxagentKeycodeConversionSetup(void) { if (nxagentOption(KeycodeConversion) == KeycodeConversionOff) { @@ -1711,9 +1703,9 @@ void nxagentKeycodeConversionSetup(char * rules, char * model) } else { - if (rules && model && - (strcmp(rules, "evdev") == 0 || - strcmp(model, "evdev") == 0)) + if (nxagentRemoteRules && nxagentRemoteModel && + (strcmp(nxagentRemoteRules, "evdev") == 0 || + strcmp(nxagentRemoteModel, "evdev") == 0)) { #ifdef DEBUG fprintf(stderr, "%s: Activating KeyCode conversion.\n", __func__); @@ -1736,40 +1728,39 @@ void nxagentKeycodeConversionSetup(char * rules, char * model) void nxagentResetKeycodeConversion(void) { - int result; - XkbAgentInfoRec info; - - result = XkbQueryExtension(nxagentDisplay, &info.Opcode, &info.EventBase, - &info.ErrorBase, &info.MajorVersion, - &info.MinorVersion); - - if (result != 0) + if (nxagentXkbInfo.Opcode != -1) { - char *remoterules = NULL; - char *remotemodel = NULL; - char *remotelayout = NULL; - char *remotevariant = NULL; - char *remoteoptions = NULL; - unsigned int remoteruleslen; + nxagentKeycodeConversionSetup(); + } + else + { + nxagentKeycodeConversion = False; + } +} - remoteruleslen = nxagentXkbGetNames(&remoterules, &remotemodel, &remotelayout, - &remotevariant, &remoteoptions); +Bool nxagentGetRemoteXkbExtension(void) +{ + Bool result; - if (remoteruleslen && remoterules && remotemodel) - nxagentKeycodeConversionSetup(remoterules, remotemodel); + nxagentXkbInfo.Opcode = nxagentXkbInfo.EventBase = nxagentXkbInfo.ErrorBase = nxagentXkbInfo.MajorVersion = nxagentXkbInfo.MinorVersion = -1; + nxagentXkbClearNames(); - if (remoterules) - XFree(remoterules); + if ((result = XkbQueryExtension(nxagentDisplay, + &nxagentXkbInfo.Opcode, + &nxagentXkbInfo.EventBase, + &nxagentXkbInfo.ErrorBase, + &nxagentXkbInfo.MajorVersion, + &nxagentXkbInfo.MinorVersion))) + { + nxagentXkbGetNames(); } + #ifdef WARNING else { - #ifdef WARNING - fprintf(stderr, "nxagentResetKeycodeConversion: " - "WARNING! Failed to query XKB extension.\n"); - #endif - - nxagentKeycodeConversion = False; + fprintf(stderr, "%s: WARNING! Failed to query XKB extension.\n", __func__); } -} + #endif + return result; +} #endif /* XKB */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h index ba95a3a22..b6ec51e99 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h @@ -119,6 +119,7 @@ void nxagentTuneXkbWrapper(void); void nxagentResetKeycodeConversion(void); +Bool nxagentGetRemoteXkbExtension(void); #endif CARD8 nxagentConvertKeycode(CARD8 k); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index a61b42530..bd4fccdce 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -584,6 +584,9 @@ Bool nxagentReconnectSession(void) goto nxagentReconnectError; } + /* Update remote XKB information */ + nxagentGetRemoteXkbExtension(); + /* if there's no keyboard definition in the options file restore the previous value. */ #ifdef DEBUG -- cgit v1.2.3 From d5c9733b24a55acb812a4cb11f39551c766c17d7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Dec 2018 22:03:58 +0100 Subject: nxagent: simplify keycode conversion setup --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 19 +++++-------------- nx-X11/programs/Xserver/hw/nxagent/Keyboard.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 20b68b563..5c35d7124 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -1691,10 +1691,14 @@ void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *vari void nxagentKeycodeConversionSetup(void) { + nxagentKeycodeConversion = False; + + if (nxagentXkbInfo.Opcode == -1) + return; + if (nxagentOption(KeycodeConversion) == KeycodeConversionOff) { fprintf(stderr, "Info: Keycode conversion is off\n"); - nxagentKeycodeConversion = False; } else if (nxagentOption(KeycodeConversion) == KeycodeConversionOn) { @@ -1721,23 +1725,10 @@ void nxagentKeycodeConversionSetup(void) #endif fprintf(stderr, "Info: Keycode conversion auto-determined as off\n"); - nxagentKeycodeConversion = False; } } } -void nxagentResetKeycodeConversion(void) -{ - if (nxagentXkbInfo.Opcode != -1) - { - nxagentKeycodeConversionSetup(); - } - else - { - nxagentKeycodeConversion = False; - } -} - Bool nxagentGetRemoteXkbExtension(void) { Bool result; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h index b6ec51e99..dbfb47733 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h @@ -117,7 +117,7 @@ void nxagentEnableXkbExtension(void); void nxagentTuneXkbWrapper(void); -void nxagentResetKeycodeConversion(void); +void nxagentKeycodeConversionSetup(void); Bool nxagentGetRemoteXkbExtension(void); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index bd4fccdce..91445a383 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -620,7 +620,7 @@ Bool nxagentReconnectSession(void) } else { - nxagentResetKeycodeConversion(); + nxagentKeycodeConversionSetup(); } nxagentXkbState.Initialized = 0; -- cgit v1.2.3 From a70ec920dd33a04b74af876444602c587fe9ec80 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Dec 2018 23:35:56 +0100 Subject: Keyboard.c: add static keyword where appropriate --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 5c35d7124..cfe73ac5b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -78,11 +78,11 @@ is" without express or implied warranty. #include -void nxagentXkbGetNames(void); +static void nxagentXkbGetNames(void); void nxagentKeycodeConversionSetup(void); -void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options); +static void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options); #endif /* XKB */ @@ -1545,7 +1545,7 @@ void nxagentXkbClearNames(void) free(nxagentRemoteOptions); nxagentRemoteOptions = NULL; } -void nxagentXkbGetNames(void) +static void nxagentXkbGetNames(void) { Atom atom; #ifdef _XSERVER64 @@ -1627,7 +1627,7 @@ void nxagentXkbGetNames(void) return; } -void writeKeyboardfileData(FILE *out, char *rules, char *model, char *layout, char *variant, char *options) +static void writeKeyboardfileData(FILE *out, char *rules, char *model, char *layout, char *variant, char *options) { /* How to set "empty" values with setxkbmap, result of trial and error: @@ -1645,7 +1645,7 @@ void writeKeyboardfileData(FILE *out, char *rules, char *model, char *layout, ch fprintf(out, "options=\",%s\"\n", options ? options : ""); } -void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options) +static void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options) { if (rules && rules[0] != '\0') { -- cgit v1.2.3