aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
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
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')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c39
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/man/nxagent.111
3 files changed, 44 insertions, 9 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);
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=<string> or kbtype=<string>
-.BR query | <model>/<layout>
+.BR query | clone | <model>/<layout>
.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 <model>/<layout>
use the given model and layout. You can not modify keyboard rules,
variant or options. Instead preset values are used. These are