Commit 6f390f82 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

nxagent: remove additional keyboard handling from Reconnect.c

At reconnect we check if a keyboard reset is required. If so, we are calling the corresponding code from Keyboard.c. No explicit keyboard code in Reconnect.c required. fixes ArcticaProject/nx-libs#886
parent a59020b1
...@@ -649,7 +649,6 @@ XkbError: ...@@ -649,7 +649,6 @@ XkbError:
__func__, nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); __func__, nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions);
#endif #endif
/* Only setup keycode conversion if we are NOT in clone mode */
if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0)) if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0))
{ {
SAFE_free(rules); rules = strdup(nxagentRemoteRules); SAFE_free(rules); rules = strdup(nxagentRemoteRules);
...@@ -657,6 +656,14 @@ XkbError: ...@@ -657,6 +656,14 @@ XkbError:
SAFE_free(layout); layout = strdup(nxagentRemoteLayout); SAFE_free(layout); layout = strdup(nxagentRemoteLayout);
SAFE_free(variant); variant = strdup(nxagentRemoteVariant); SAFE_free(variant); variant = strdup(nxagentRemoteVariant);
SAFE_free(options); options = strdup(nxagentRemoteOptions); SAFE_free(options); options = strdup(nxagentRemoteOptions);
/* Only setup keycode conversion if we are NOT in clone mode */
#ifdef DEBUG
fprintf(stderr, "%s: nxagentKeyboard is [%s] - disabling keycode conversion.\n", __func__,
nxagentKeyboard);
#endif
nxagentChangeOption(KeycodeConversion, KeycodeConversionOff);
/* /*
* when cloning we do not want X2Go to set the keyboard * when cloning we do not want X2Go to set the keyboard
* via a keyboard file generated by nxagent. The defined * via a keyboard file generated by nxagent. The defined
...@@ -670,7 +677,6 @@ XkbError: ...@@ -670,7 +677,6 @@ XkbError:
} }
else else
{ {
nxagentKeycodeConversionSetup();
/* /*
* Keyboard has always been tricky with nxagent. For that * Keyboard has always been tricky with nxagent. For that
* reason X2Go offers "auto" keyboard configuration. You can * reason X2Go offers "auto" keyboard configuration. You can
...@@ -688,6 +694,7 @@ XkbError: ...@@ -688,6 +694,7 @@ XkbError:
nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions);
} }
} }
nxagentKeycodeConversionSetup();
} }
#ifdef DEBUG #ifdef DEBUG
else else
......
...@@ -599,18 +599,20 @@ Bool nxagentReconnectSession(void) ...@@ -599,18 +599,20 @@ Bool nxagentReconnectSession(void)
nxagentOldKeyboard = NULL; nxagentOldKeyboard = NULL;
} }
if (nxagentOption(ResetKeyboardAtResume) == 1 && /* Reset the keyboard only if we detect any changes. */
(nxagentKeyboard == NULL || nxagentOldKeyboard == NULL || if (nxagentOption(ResetKeyboardAtResume) == 1)
{
if (nxagentKeyboard == NULL || nxagentOldKeyboard == NULL ||
strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 || strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 ||
strcmp(nxagentKeyboard, "query") == 0 || strcmp(nxagentKeyboard, "query") == 0 ||
strcmp(nxagentKeyboard, "clone") == 0)) strcmp(nxagentKeyboard, "clone") == 0)
{ {
if (nxagentResetKeyboard() == 0) if (nxagentResetKeyboard() == 0)
{ {
#ifdef WARNING #ifdef WARNING
if (nxagentVerbose == 1) if (nxagentVerbose == 1)
{ {
fprintf(stderr, "nxagentReconnectSession: Failed to reset keyboard device.\n"); fprintf(stderr, "%s: Failed to reset keyboard device.\n", __func__);
} }
#endif #endif
...@@ -621,7 +623,10 @@ Bool nxagentReconnectSession(void) ...@@ -621,7 +623,10 @@ Bool nxagentReconnectSession(void)
} }
else else
{ {
nxagentKeycodeConversionSetup(); #ifdef DEBUG
fprintf(stderr, "%s: keyboard unchanged - skipping keyboard reset.\n", __func__);
#endif
}
} }
nxagentXkbState.Initialized = 0; nxagentXkbState.Initialized = 0;
......
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