aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-03-23 23:11:32 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-04-03 21:28:11 +0200
commitba5183f80836042ce90be7dde29cc2c5f13baf9d (patch)
treee0187f5f783d6140969ac63ad4066dfafe3a30cf /nx-X11/programs/Xserver/hw/nxagent
parentf12012b15b2c761172ca863bb4b76383ec0b3ee5 (diff)
downloadnx-libs-ba5183f80836042ce90be7dde29cc2c5f13baf9d.tar.gz
nx-libs-ba5183f80836042ce90be7dde29cc2c5f13baf9d.tar.bz2
nx-libs-ba5183f80836042ce90be7dde29cc2c5f13baf9d.zip
Init keystrokes at startup and reconnect
no more late initialization
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Init.c3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.c12
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.h1
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c5
4 files changed, 12 insertions, 9 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c
index f15f2cb0a..014ab17f9 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Init.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c
@@ -69,6 +69,7 @@ is" without express or implied warranty.
#include "Font.h"
#include "Millis.h"
#include "Error.h"
+#include "Keystroke.h"
#include <nx/NX.h>
#include "compext/Compext.h"
@@ -406,6 +407,8 @@ FIXME: These variables, if not removed at all because have probably
*/
blackRoot = TRUE;
+
+ nxagentInitKeystrokes(False);
}
void
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
index 8fac89658..8a5347a53 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
@@ -265,7 +265,7 @@ static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystr
* - hardcoded traditional NX default settings
* If run in x2go flavour different filenames and varnames are used.
*/
-static void parse_keystroke_file(Bool force)
+void nxagentInitKeystrokes(Bool force)
{
char *filename = NULL;
@@ -482,13 +482,7 @@ static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X)
{
enum nxagentSpecialKeystroke ret = KEYSTROKE_NOTHING;
int keysyms_per_keycode_return;
- struct nxagentSpecialKeystrokeMap *cur;
-
- /* FIXME: we do late parsing here, this should be done at startup,
- not at first keypress! */
- parse_keystroke_file(False);
-
- cur = map;
+ struct nxagentSpecialKeystrokeMap *cur = map;
XlibKeySym *keysym = XGetKeyboardMapping(nxagentDisplay,
X->keycode,
@@ -665,7 +659,7 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
might lead to unexpected behaviour
*/
if (X->type == KeyRelease)
- parse_keystroke_file(True);
+ nxagentInitKeystrokes(True);
break;
case KEYSTROKE_NOTHING: /* do nothing. difference to KEYSTROKE_IGNORE is the return value */
case KEYSTROKE_END_MARKER: /* just to make gcc STFU */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
index 777540aa0..7eb71bb6f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
@@ -30,6 +30,7 @@
extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*);
extern void nxagentDumpKeystrokes(void);
+extern void nxagentInitKeystrokes(Bool force);
/* keep this sorted, do not rely on any numerical value in this enum, and be aware
* that KEYSTROKE_MAX may be used in a malloc */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index ee21bff69..fb2303549 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -52,6 +52,7 @@
#include "Millis.h"
#include "Splash.h"
#include "Error.h"
+#include "Keystroke.h"
#ifdef XKB
#include "XKBsrv.h"
@@ -646,6 +647,10 @@ Bool nxagentReconnectSession(void)
goto nxagentReconnectError;
}
+ /* Re-read keystrokes definitions in case the keystrokes file has
+ changed while being supended */
+ nxagentInitKeystrokes(True);
+
#ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session resumed at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis());
#else