From 26b033b84e682bfe098711204418319f753a34dc Mon Sep 17 00:00:00 2001
From: Ulrich Sibiller <uli42@gmx.de>
Date: Mon, 3 Dec 2018 21:34:40 +0100
Subject: Reconnect.c: restore old keyboard value if no new one is given

It may not fully fix the issue mentioned below but it does for the
-keyboard commandline option at least.

Fixes ArcticaProject/nx-libs#741
---
 nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'nx-X11/programs')

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index 6d15f2021..4b1ae03f9 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -584,6 +584,17 @@ Bool nxagentReconnectSession(void)
     goto nxagentReconnectError;
   }
 
+  /* if there's no keyboard definition in the options file
+     restore the previous value. */
+  #ifdef DEBUG
+  fprintf(stderr, "%s: nxagentKeyboard [%s] nxagentOldKeyboard [%s]\n", __func__, nxagentKeyboard, nxagentOldKeyboard);
+  #endif
+  if (nxagentKeyboard == NULL)
+  {
+    nxagentKeyboard = nxagentOldKeyboard;
+    nxagentOldKeyboard = NULL;
+  }
+
   if (nxagentOption(ResetKeyboardAtResume) == 1 &&
          (nxagentKeyboard  == NULL || nxagentOldKeyboard == NULL ||
              strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 ||
-- 
cgit v1.2.3