Commit 1de6ca59 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

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
parent ab3e1485
......@@ -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);
......
......@@ -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)
{
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment