Unverified Commit 6ac805ab authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/cleanup_keystroke' into 3.6.x

parents 320cece2 6f4eb154
...@@ -16,7 +16,7 @@ If nxagent is called without branding, it searches: ...@@ -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: 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 '-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 ~/.x2go/config/keystrokes.cfg
- in /etc/x2go/keystrokes.cfg - in /etc/x2go/keystrokes.cfg
...@@ -52,7 +52,7 @@ XStringToKeysym function. A list of possible keys can be found in ...@@ -52,7 +52,7 @@ XStringToKeysym function. A list of possible keys can be found in
'Space' and 'escape' won't. 'Space' and 'escape' won't.
Modifiers are given as boolean attributes, possible modifiers are Mod1, Mod2, 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 keyboard configuration, but usually you will need Mod1 and Control. Boolean in
this context means '0', 'false' and an unspecified attribute are false, anything this context means '0', 'false' and an unspecified attribute are false, anything
else is considered true. else is considered true.
...@@ -64,12 +64,17 @@ default keybindings, and only one file is read, no merging between different ...@@ -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 configuration files is done. This also means that an empty or invalid configuration
file deactivates all keybindings. file deactivates all keybindings.
If an attribute occurs more than once in a line the last one wins.
List of possible 'action' attributes: List of possible 'action' attributes:
------------------------------------- -------------------------------------
close_session close_session
This terminates the session. This terminates the session.
fullscreen
Switches the client window into or out of fullscreen mode, using only the current head.
switch_all_screens switch_all_screens
Switches the client window into or out of fullscreen mode, using all available heads.
minimize minimize
This will minimize the client window (even for fullscreen sessions.) This will minimize the client window (even for fullscreen sessions.)
left left
...@@ -77,13 +82,15 @@ up ...@@ -77,13 +82,15 @@ up
right right
down down
resize 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 defer
Works like 'ignore' to make some keys be ignored/defunct inside the session. activate/deactivate deferred screen updates.
ignore ignore
Makes it possible to add 'ignore', as in nothing happens when certain keys are pressed. 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 viewport_move_left
Moves the image viewport to the left. Moves the image viewport to the left.
viewport_move_up viewport_move_up
...@@ -92,6 +99,10 @@ viewport_move_right ...@@ -92,6 +99,10 @@ viewport_move_right
Moves the image viewport to the right. Moves the image viewport to the right.
viewport_move_down viewport_move_down
Moves the image viewport 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: Only in builds with certain debugging options enabled, ignored otherwise:
force_synchronization force_synchronization
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<keystrokes> <keystrokes>
<keystroke action="close_session" Control="1" AltMeta="1" key="t" /> <keystroke action="close_session" Control="1" AltMeta="1" key="t" />
<keystroke action="switch_all_screens" Control="1" AltMeta="1" key="f" /> <keystroke action="switch_all_screens" Control="1" AltMeta="1" key="f" />
<keystroke action="fullscreen" Control="1" Shift="1" AltMeta="1" key="f" />
<keystroke action="minimize" Control="1" AltMeta="1" key="m" /> <keystroke action="minimize" Control="1" AltMeta="1" key="m" />
<keystroke action="resize" Control="1" AltMeta="1" key="r" /> <keystroke action="resize" Control="1" AltMeta="1" key="r" />
<keystroke action="defer" Control="1" AltMeta="1" key="e" /> <keystroke action="defer" Control="1" AltMeta="1" key="e" />
...@@ -11,9 +12,9 @@ ...@@ -11,9 +12,9 @@
<keystroke action="regions_on_screen" Control="1" AltMeta="1" key="a" /> <keystroke action="regions_on_screen" Control="1" AltMeta="1" key="a" />
<keystroke action="test_input" Control="1" AltMeta="1" key="x" /> <keystroke action="test_input" Control="1" AltMeta="1" key="x" />
<keystroke action="deactivate_input_devices_grab" Control="1" AltMeta="1" key="y" /> <keystroke action="deactivate_input_devices_grab" Control="1" AltMeta="1" key="y" />
<keystroke action="fullscreen" Control="1" Shift="1" AltMeta="1" key="f" />
<keystroke action="viewport_move_left" Control="1" Shift="1" AltMeta="1" key="Left" /> <keystroke action="viewport_move_left" Control="1" Shift="1" AltMeta="1" key="Left" />
<keystroke action="viewport_move_up" Control="1" AltMeta="1" key="Up" /> <keystroke action="viewport_move_up" Control="1" AltMeta="1" key="Up" />
<keystroke action="viewport_move_right" Control="1" AltMeta="1" key="Right" /> <keystroke action="viewport_move_right" Control="1" AltMeta="1" key="Right" />
<keystroke action="viewport_move_down" Control="1" AltMeta="1" key="Down" /> <keystroke action="viewport_move_down" Control="1" AltMeta="1" key="Down" />
<keystroke action="reread_keystrokes" Control="1" AltMeta="1" key="k" />
</keystrokes> </keystrokes>
...@@ -202,6 +202,8 @@ extern char *nxagentKeyboard; ...@@ -202,6 +202,8 @@ extern char *nxagentKeyboard;
static char *nxagentXkbGetRules(void); static char *nxagentXkbGetRules(void);
unsigned int nxagentAltMetaMask; unsigned int nxagentAltMetaMask;
unsigned int nxagentAltMask;
unsigned int nxagentMetaMask;
static void nxagentCheckAltMetaKeys(CARD8, int); static void nxagentCheckAltMetaKeys(CARD8, int);
...@@ -788,6 +790,8 @@ N/A ...@@ -788,6 +790,8 @@ N/A
#endif /* #ifdef _XSERVER64 */ #endif /* #ifdef _XSERVER64 */
nxagentAltMetaMask = 0; nxagentAltMetaMask = 0;
nxagentAltMask = 0;
nxagentMetaMask = 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
modmap[i] = 0; modmap[i] = 0;
...@@ -1378,21 +1382,25 @@ void nxagentCheckAltMetaKeys(CARD8 keycode, int j) ...@@ -1378,21 +1382,25 @@ void nxagentCheckAltMetaKeys(CARD8 keycode, int j)
if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_L)) if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_L))
{ {
nxagentAltMetaMask |= 1 << j; nxagentAltMetaMask |= 1 << j;
nxagentMetaMask |= 1 << j;
} }
if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_R)) if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_R))
{ {
nxagentAltMetaMask |= 1 << j; nxagentAltMetaMask |= 1 << j;
nxagentMetaMask |= 1 << j;
} }
if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_L)) if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_L))
{ {
nxagentAltMetaMask |= 1 << j; nxagentAltMetaMask |= 1 << j;
nxagentAltMask |= 1 << j;
} }
if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_R)) if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_R))
{ {
nxagentAltMetaMask |= 1 << j; nxagentAltMetaMask |= 1 << j;
nxagentAltMask |= 1 << j;
} }
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "Events.h" #include "Events.h"
extern int nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*); extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*);
unsigned int nxagentAltMetaMask; unsigned int nxagentAltMetaMask;
...@@ -42,40 +42,42 @@ enum nxagentSpecialKeystroke { ...@@ -42,40 +42,42 @@ enum nxagentSpecialKeystroke {
KEYSTROKE_END_MARKER = 0, KEYSTROKE_END_MARKER = 0,
KEYSTROKE_CLOSE_SESSION = 1, KEYSTROKE_CLOSE_SESSION = 1,
KEYSTROKE_SWITCH_ALL_SCREENS = 2, KEYSTROKE_SWITCH_ALL_SCREENS = 2,
KEYSTROKE_MINIMIZE = 3, KEYSTROKE_FULLSCREEN = 3,
KEYSTROKE_LEFT = 4, KEYSTROKE_MINIMIZE = 4,
KEYSTROKE_UP = 5, KEYSTROKE_LEFT = 5,
KEYSTROKE_RIGHT = 6, KEYSTROKE_UP = 6,
KEYSTROKE_DOWN = 7, KEYSTROKE_RIGHT = 7,
KEYSTROKE_RESIZE = 8, KEYSTROKE_DOWN = 8,
KEYSTROKE_DEFER = 9, KEYSTROKE_RESIZE = 9,
KEYSTROKE_IGNORE = 10, KEYSTROKE_DEFER = 10,
KEYSTROKE_FORCE_SYNCHRONIZATION = 11, KEYSTROKE_IGNORE = 11,
KEYSTROKE_FORCE_SYNCHRONIZATION = 12,
/* stuff used for debugging, probably not useful for most people */ /* stuff used for debugging, probably not useful for most people */
KEYSTROKE_DEBUG_TREE = 12, KEYSTROKE_DEBUG_TREE = 13,
KEYSTROKE_REGIONS_ON_SCREEN = 13, KEYSTROKE_REGIONS_ON_SCREEN = 14,
KEYSTROKE_TEST_INPUT = 14, KEYSTROKE_TEST_INPUT = 15,
KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB = 15, KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB = 16,
KEYSTROKE_FULLSCREEN = 16,
KEYSTROKE_VIEWPORT_MOVE_LEFT = 17, KEYSTROKE_VIEWPORT_MOVE_LEFT = 17,
KEYSTROKE_VIEWPORT_MOVE_UP = 18, KEYSTROKE_VIEWPORT_MOVE_UP = 18,
KEYSTROKE_VIEWPORT_MOVE_RIGHT = 19, KEYSTROKE_VIEWPORT_MOVE_RIGHT = 19,
KEYSTROKE_VIEWPORT_MOVE_DOWN = 20, KEYSTROKE_VIEWPORT_MOVE_DOWN = 20,
KEYSTROKE_NOTHING = 21, KEYSTROKE_REREAD_KEYSTROKES = 21,
KEYSTROKE_NOTHING = 22,
/* insert more here, increment KEYSTROKE_MAX accordingly. /* insert more here, increment KEYSTROKE_MAX accordingly.
* then update string translation below */ * then update string translation below */
KEYSTROKE_MAX=22, KEYSTROKE_MAX = 23,
}; };
struct nxagentSpecialKeystrokeMap { struct nxagentSpecialKeystrokeMap {
enum nxagentSpecialKeystroke stroke; enum nxagentSpecialKeystroke stroke;
unsigned int modifierMask; /* everything except alt/meta */ unsigned int modifierMask; /* everything except alt/meta */
int modifierAltMeta; /* modifier combination should include alt/meta */ Bool modifierAltMeta; /* modifier combination should include alt/meta */
KeySym keysym; KeySym keysym;
}; };
......
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