[X2Go-Commits] [nx-libs] 27/51: nxagent: add keyboard=clone configuration option
git-admin at x2go.org
git-admin at x2go.org
Fri Feb 8 05:40:10 CET 2019
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository nx-libs.
commit 1de6ca599f6f410308c7fe2ddd700197f66662fd
Author: Ulrich Sibiller <uli42 at gmx.de>
Date: Sat Jul 22 19:03:19 2017 +0200
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(-)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 1da6a01..89e51b6 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 4b1ae03..a61b425 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 892248d..84669ff 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
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
More information about the x2go-commits
mailing list