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: ...@@ -761,7 +761,9 @@ XkbError:
layout. 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++); for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++);
...@@ -822,21 +824,48 @@ XkbError: ...@@ -822,21 +824,48 @@ XkbError:
unsigned int remoteruleslen = nxagentXkbGetNames(&remoterules, &remotemodel, &remotelayout, unsigned int remoteruleslen = nxagentXkbGetNames(&remoterules, &remotemodel, &remotelayout,
&remotevariant, &remoteoptions); &remotevariant, &remoteoptions);
#ifdef DEBUG
if (remoteruleslen && remoterules && remotemodel) if (remoteruleslen && remoterules && remotemodel)
{ {
#ifdef DEBUG
fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n",
__func__, remoterules, remotemodel, remotelayout, remotevariant, remoteoptions); __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 else
{ {
fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__);
} }
#endif #endif
nxagentWriteKeyboardFile(remoterules, remotemodel, remotelayout, remotevariant, remoteoptions);
nxagentKeycodeConversionSetup(remoterules, remotemodel);
if (remoterules) if (remoterules)
{ {
XFree(remoterules); XFree(remoterules);
......
...@@ -598,7 +598,8 @@ Bool nxagentReconnectSession(void) ...@@ -598,7 +598,8 @@ Bool nxagentReconnectSession(void)
if (nxagentOption(ResetKeyboardAtResume) == 1 && if (nxagentOption(ResetKeyboardAtResume) == 1 &&
(nxagentKeyboard == NULL || nxagentOldKeyboard == NULL || (nxagentKeyboard == NULL || nxagentOldKeyboard == NULL ||
strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 || strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 ||
strcmp(nxagentKeyboard, "query") == 0)) strcmp(nxagentKeyboard, "query") == 0 ||
strcmp(nxagentKeyboard, "clone") == 0))
{ {
if (nxagentResetKeyboard() == 0) if (nxagentResetKeyboard() == 0)
{ {
......
...@@ -525,8 +525,8 @@ don't reset keyboard device if the session is resumed ...@@ -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 this is only relevant if you also specify \-keyboard=query. In that
case \fBnxagent\fR will lock the keyboard settings and clients will case \fBnxagent\fR will lock the keyboard settings and clients will
get an error when trying to change keyboard settings via get an error when trying to change keyboard settings via
XKEYBOARD. With \-noxkblock the lock is not applied and clients can XKEYBOARD. With \-noxkblock the lock is not applied and clients are
change the keyboard settings through XKEYBOARD. allowed change the keyboard settings through XKEYBOARD.
.TP 8 .TP 8
.B \-tile WxH .B \-tile WxH
size of image tiles (minimum allowed: 32x32) size of image tiles (minimum allowed: 32x32)
...@@ -603,7 +603,7 @@ start or resume a session in fullscreen mode (default: off) ...@@ -603,7 +603,7 @@ start or resume a session in fullscreen mode (default: off)
.TP 8 .TP 8
.B keyboard=<string> or kbtype=<string> .B keyboard=<string> or kbtype=<string>
.BR query | <model>/<layout> .BR query | clone | <model>/<layout>
.RS 8 .RS 8
.TP 8 .TP 8
...@@ -617,6 +617,11 @@ this platform. Note that in this case XKEYBOARD will always report ...@@ -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 the default layout which will most likely not match the experienced
settings. settings.
.TP 8 .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> .I <model>/<layout>
use the given model and layout. You can not modify keyboard rules, 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. 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