From 3042c5064b0bde6e27ed010386d7941deb83179e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 13 Mar 2017 20:50:53 +0100 Subject: Keystroke.c: add missing Mod5 modifier --- doc/nxagent/README.keystrokes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/nxagent/README.keystrokes b/doc/nxagent/README.keystrokes index 08cdafb46..32197a79f 100644 --- a/doc/nxagent/README.keystrokes +++ b/doc/nxagent/README.keystrokes @@ -52,7 +52,7 @@ XStringToKeysym function. A list of possible keys can be found in 'Space' and 'escape' won't. Modifiers are given as boolean attributes, possible modifiers are Mod1, Mod2, -Mod3, Mod4, Control, Shift, Lock. Sensible combinations strongly depend on your +Mod3, Mod4, Mod5, Control, Shift, Lock. Sensible combinations strongly depend on your keyboard configuration, but usually you will need Mod1 and Control. Boolean in this context means '0', 'false' and an unspecified attribute are false, anything else is considered true. -- cgit v1.2.3 From c134b93ac09ff520539dd73482455808c0e22a38 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 13 Mar 2017 21:19:48 +0100 Subject: Keystroke.c: use an own environment variable for X2Go --- doc/nxagent/README.keystrokes | 2 +- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/nxagent/README.keystrokes b/doc/nxagent/README.keystrokes index 32197a79f..ad850f6df 100644 --- a/doc/nxagent/README.keystrokes +++ b/doc/nxagent/README.keystrokes @@ -16,7 +16,7 @@ If nxagent is called without branding, it searches: If nxagent is called with X2Go branding (i.e., as x2goagent), it searches: - in the location given by the '-keystrokefile' command line parameter -- in the location given by the NXAGENT_KEYSTROKEFILE environment variable +- in the location given by the X2GO_KEYSTROKEFILE environment variable - in ~/.x2go/config/keystrokes.cfg - in /etc/x2go/keystrokes.cfg diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index f655e3b95..ec408d3c2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -245,13 +245,15 @@ static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystr * - $HOME/.nx/config/keystrokes.cfg * - /etc/nxagent/keystrokes.cfg * - hardcoded traditional NX default settings + * If run in x2go flavour different filenames and varnames are used. */ static void parse_keystroke_file(void) { char *filename = NULL; - char *homefile = "/.nx/config/keystrokes.cfg"; - char *etcfile = "/etc/nxagent/keystrokes.cfg"; + char *homefile; + char *etcfile; + char *envvar; /* used for tracking if the config file parsing has already been done (regardless of the result) */ @@ -263,6 +265,11 @@ static void parse_keystroke_file(void) if (nxagentX2go) { homefile = "/.x2go/config/keystrokes.cfg"; etcfile = "/etc/x2go/keystrokes.cfg"; + envvar = "X2GO_KEYSTROKEFILE"; + } else { + homefile = "/.nx/config/keystrokes.cfg"; + etcfile = "/etc/nxagent/keystrokes.cfg"; + envvar = "NXAGENT_KEYSTROKEFILE"; } if (nxagentKeystrokeFile != NULL && access(nxagentKeystrokeFile, R_OK) == 0) @@ -274,7 +281,7 @@ static void parse_keystroke_file(void) exit(EXIT_FAILURE); } } - else if ((filename = getenv("NXAGENT_KEYSTROKEFILE")) != NULL && access(filename, R_OK) == 0) + else if ((filename = getenv(envvar)) != NULL && access(filename, R_OK) == 0) { filename = strdup(filename); if (filename == NULL) -- cgit v1.2.3 From abf6242128394aa2374f3882252dfc84d4499c33 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 13 Mar 2017 22:00:23 +0100 Subject: Keystroke.c: add new keystroke to reread keystroke config Default is ctrl-alt-k --- doc/nxagent/README.keystrokes | 4 +++ etc/keystrokes.cfg | 1 + nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 34 +++++++++++++++++++++++--- nx-X11/programs/Xserver/hw/nxagent/Keystroke.h | 6 +++-- 4 files changed, 39 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/nxagent/README.keystrokes b/doc/nxagent/README.keystrokes index ad850f6df..7edd340d2 100644 --- a/doc/nxagent/README.keystrokes +++ b/doc/nxagent/README.keystrokes @@ -92,6 +92,10 @@ viewport_move_right Moves the image viewport to the right. viewport_move_down Moves the image viewport down. +reread_keystrokes + forces nxagent to re-read the keystroke + configuration. Useful to add/changes keystrokes for a running + session. Only in builds with certain debugging options enabled, ignored otherwise: force_synchronization diff --git a/etc/keystrokes.cfg b/etc/keystrokes.cfg index 1716d6abe..22cc8c7a0 100644 --- a/etc/keystrokes.cfg +++ b/etc/keystrokes.cfg @@ -16,4 +16,5 @@ + diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index e0f8925fb..bb8d83f66 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -89,6 +89,8 @@ char * nxagentSpecialKeystrokeNames[] = { "viewport_move_up", "viewport_move_right", "viewport_move_down", + + "reread_keystrokes", NULL, }; @@ -134,6 +136,7 @@ struct nxagentSpecialKeystrokeMap default_map[] = { {KEYSTROKE_VIEWPORT_MOVE_RIGHT, ControlMask | ShiftMask, True, XK_KP_Right}, {KEYSTROKE_VIEWPORT_MOVE_DOWN, ControlMask | ShiftMask, True, XK_Down}, {KEYSTROKE_VIEWPORT_MOVE_DOWN, ControlMask | ShiftMask, True, XK_KP_Down}, + {KEYSTROKE_REREAD_KEYSTROKES, ControlMask, True, XK_k}, {KEYSTROKE_END_MARKER, 0, False, NoSymbol}, }; struct nxagentSpecialKeystrokeMap *map = default_map; @@ -247,7 +250,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(void) +static void parse_keystroke_file(Bool force) { char *filename = NULL; @@ -258,8 +261,21 @@ static void parse_keystroke_file(void) /* used for tracking if the config file parsing has already been done (regardless of the result) */ static Bool done = False; - if (done) - return; + + if (force) { + if (map != default_map) + { + free(map); + map = default_map; + } + fprintf(stderr, "re-reading keystroke config\n"); + } + else + { + if (done) + return; + } + done = True; if (nxagentX2go) { @@ -392,7 +408,7 @@ static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) /* FIXME: we do late parsing here, this should be done at startup, not at first keypress! */ - parse_keystroke_file(); + parse_keystroke_file(False); cur = map; @@ -573,6 +589,16 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) *result = doViewportMoveDown; } break; + case KEYSTROKE_REREAD_KEYSTROKES: + /* two reasons to check on KeyRelease: + - this code is called for KeyPress and KeyRelease, so we + would read the keystroke file twice + - if the keystroke file changes settings for this key this + might lead to unexpected behaviour + */ + if (X->type == KeyRelease) + parse_keystroke_file(True); + break; case KEYSTROKE_NOTHING: /* do nothing. difference to KEYSTROKE_IGNORE is the return value */ case KEYSTROKE_END_MARKER: /* just to make gcc STFU */ case KEYSTROKE_MAX: diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h index 56c977418..48ed65b35 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h @@ -64,12 +64,14 @@ enum nxagentSpecialKeystroke { KEYSTROKE_VIEWPORT_MOVE_RIGHT = 19, KEYSTROKE_VIEWPORT_MOVE_DOWN = 20, - KEYSTROKE_NOTHING = 21, + KEYSTROKE_REREAD_KEYSTROKES = 21, + + KEYSTROKE_NOTHING = 22, /* insert more here, increment KEYSTROKE_MAX accordingly. * then update string translation below */ - KEYSTROKE_MAX = 22, + KEYSTROKE_MAX = 23, }; struct nxagentSpecialKeystrokeMap { -- cgit v1.2.3 From 6f4eb15408c9b7f13ff9e2765a7a50bace0dfae1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 13 Mar 2017 22:19:17 +0100 Subject: Update keystroke readme --- doc/nxagent/README.keystrokes | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/nxagent/README.keystrokes b/doc/nxagent/README.keystrokes index 7edd340d2..96bc158d2 100644 --- a/doc/nxagent/README.keystrokes +++ b/doc/nxagent/README.keystrokes @@ -64,12 +64,17 @@ default keybindings, and only one file is read, no merging between different configuration files is done. This also means that an empty or invalid configuration file deactivates all keybindings. +If an attribute occurs more than once in a line the last one wins. + List of possible 'action' attributes: ------------------------------------- close_session This terminates the session. +fullscreen + Switches the client window into or out of fullscreen mode, using only the current head. switch_all_screens + Switches the client window into or out of fullscreen mode, using all available heads. minimize This will minimize the client window (even for fullscreen sessions.) left @@ -77,13 +82,15 @@ up right down resize - This action switches between the auto-resize and viewport mode (static size). The default is auto-resize. In viewport mode one can use the 'viewport_move_up', 'viewport_move_down', 'viewport_move_left' and 'viewport_move_right' actions to move within the image. + This action switches between the auto-resize and viewport mode + (static size). The default is auto-resize. In viewport mode one can + use the 'viewport_move_up', 'viewport_move_down', + 'viewport_move_left' and 'viewport_move_right' actions to move + within the image. defer - Works like 'ignore' to make some keys be ignored/defunct inside the session. + activate/deactivate deferred screen updates. ignore Makes it possible to add 'ignore', as in nothing happens when certain keys are pressed. -fullscreen - Switches the client window into or out of fullscreen mode. viewport_move_left Moves the image viewport to the left. viewport_move_up -- cgit v1.2.3