aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-07-22 19:03:19 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-12-19 12:32:03 +0100
commit1de6ca599f6f410308c7fe2ddd700197f66662fd (patch)
tree756a312cdc784ae0525e14878096766358c2e035 /nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
parentab3e1485010ecb549bb09c4321d24b391eac82a1 (diff)
downloadnx-libs-1de6ca599f6f410308c7fe2ddd700197f66662fd.tar.gz
nx-libs-1de6ca599f6f410308c7fe2ddd700197f66662fd.tar.bz2
nx-libs-1de6ca599f6f410308c7fe2ddd700197f66662fd.zip
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
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Keyboard.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c39
1 files changed, 34 insertions, 5 deletions
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);