Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
25d38bf3
Unverified
Commit
25d38bf3
authored
Apr 03, 2017
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/cleanup_keystroke' into 3.6.x
Attributes GH PR #404:
https://github.com/ArcticaProject/nx-libs/pull/404
parents
147371a2
ee18cd43
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
139 additions
and
85 deletions
+139
-85
README.keystrokes
doc/nxagent/README.keystrokes
+48
-48
README.keystrokes.debug
doc/nxagent/README.keystrokes.debug
+27
-0
keystrokes.cfg
etc/keystrokes.cfg
+13
-5
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+2
-0
Events.c
nx-X11/programs/Xserver/hw/nxagent/Events.c
+4
-4
Init.c
nx-X11/programs/Xserver/hw/nxagent/Init.c
+3
-0
Keyboard.h
nx-X11/programs/Xserver/hw/nxagent/Keyboard.h
+3
-0
Keystroke.c
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+0
-0
Keystroke.h
nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
+34
-28
Reconnect.c
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+5
-0
No files found.
doc/nxagent/README.keystrokes
View file @
25d38bf3
Configurable keybindings in nxagent
Keybindings in the redistributed x2go version of nxagent can
now
be configured
Keybindings in the redistributed x2go version of nxagent can be configured
by the user. This is done via a configuration file.
File location
...
...
@@ -40,29 +40,31 @@ The configuration file is XML with the following format:
<keystroke action="fullscreen" key="space" Mod1="0" Mod2="0" Control="0" Shift="0" AltMeta="0" />
</keystrokes>
Each 'action' defines an action to be executed when receiving that
keystroke. A
list of possible actions is given below. Some of those actions are only
available with debug builds of nxagent.
Each 'action' defines an action to be executed when receiving that
keystroke. A list of possible actions is given below. Some of those
a
ctions are only a
vailable with debug builds of nxagent.
Keys are given as a combination of 'key' and (optionally) a number of
modifiers. The key attribute is evaluated into a X11 key via the usual
XStringToKeysym function. A list of possible keys can be found in
/usr/include/X11/keysymdef.h, the names are specified without the
leading
'XK_'. Evaluation is case-sensitive, so, 'space' and 'Escape' will work while
'Space' and 'escape' won't.
/usr/include/X11/keysymdef.h, the names are specified without the
leading 'XK_'. Evaluation is case-sensitive, so, 'space' and 'Escape'
will work while
'Space' and 'escape' won't.
Modifiers are given as boolean attributes, possible modifiers are Mod1, Mod2,
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.
Modifiers are given as boolean attributes, possible modifiers are
Mod1, Mod2, 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.
Everything in this file is case-sensitive. Unknown lines are ignored.
Keybindings are evaluated from top to bottom, so if a keybinding matches, other
keybindings further down will be ignored. The contents of the file replaces the
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.
Keybindings are evaluated from top to bottom, so if a keybinding
matches, other keybindings further down will be ignored. The contents
of the file replaces the 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.
...
...
@@ -71,43 +73,41 @@ 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.
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.
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
up
right
down
This will minimize the client window (even for fullscreen sessions).
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 (default) and viewport
mode. In viewport mode the xserver screen size stays static even
if the nxagent window is resized. You will possibly only see a part of
the screen and can scroll around using the following actions:
viewport_move_left/up/right/down
Moves the viewport left/up/right/down by the width resp. height of
the visible area.
viewport_scroll_left/up/right/down
Scrolls the viewport left/up/right/down with increasing speed
(maximum step size is 200px).
defer
activate/deactivate deferred screen updates.
Activates/deactivates deferred screen updates.
ignore
Makes it possible to add 'ignore', as in nothing happens when certain keys are pressed.
viewport_move_left
Moves the image viewport to the left.
viewport_move_up
Moves the image viewport up.
viewport_move_right
Moves the image viewport to the right.
viewport_move_down
Moves the image viewport down.
Ignores the following keystroke, nothing will happen when this
keystroke is pressed.
reread_keystrokes
forces nxagent to re-read the keystroke
configuration. Useful to add/changes keystrokes for a running
session.
Forces nxagent to re-read the keystroke configuration. Useful to
add/change keystrokes to a running session.
Only in builds with certain debugging options enabled, ignored otherwise:
force_synchronization
Forces the drawing of elements to be synchronized which can fix some visual bugs.
debug_tree
regions_on_screen
test_input
deactivate_input_devices_grab
Forces immediate drawing of elements to be synchronized which can
fix some visual bugs.
doc/nxagent/README.keystrokes.debug
0 → 100644
View file @
25d38bf3
Configurable keybindings for debugging nxagent
Some keystrokes are only available in special debug builds of nxagent
and will be ignored otherwise. These are
debug_tree
Show the window trees of both internal and external
windows. Included if DEBUG_TREE is defined.
regions_on_screen
Make corrupted regions visible. Included if DUMP is defined.
test_input
Activate/deactive input device debugging. Included if NX_DEBUG_INPUT
is defined.
deactivate_input_devices_grab
Release grab of input devices. Included if NX_DEBUG_INPUT is
defined.
They can be configured by adding these lines to keystrokes.cfg, below
keystrokes represent the default:
<keystroke action="debug_tree" Control="1" AltMeta="1" key="q" />
<keystroke action="regions_on_screen" Control="1" AltMeta="1" key="a" />
<keystroke action="test_input" Control="1" AltMeta="1" key="x" />
<keystroke action="deactivate_input_devices_grab" Control="1" AltMeta="1" key="y" />
etc/keystrokes.cfg
View file @
25d38bf3
...
...
@@ -4,17 +4,25 @@
<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=
"resize"
Control=
"1"
AltMeta=
"1"
key=
"r"
/>
<keystroke
action=
"defer"
Control=
"1"
AltMeta=
"1"
key=
"e"
/>
<keystroke
action=
"ignore"
Control=
"1"
AltMeta=
"1"
key=
"BackSpace"
/>
<keystroke
action=
"force_synchronization"
Control=
"1"
AltMeta=
"1"
key=
"j"
/>
<keystroke
action=
"debug_tree"
Control=
"1"
AltMeta=
"1"
key=
"q"
/>
<keystroke
action=
"regions_on_screen"
Control=
"1"
AltMeta=
"1"
key=
"a"
/>
<keystroke
action=
"test_input"
Control=
"1"
AltMeta=
"1"
key=
"x"
/>
<keystroke
action=
"deactivate_input_devices_grab"
Control=
"1"
AltMeta=
"1"
key=
"y"
/>
<keystroke
action=
"resize"
Control=
"1"
AltMeta=
"1"
key=
"r"
/>
<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=
"KP_Left"
/>
<keystroke
action=
"viewport_move_up"
Control=
"1"
AltMeta=
"1"
key=
"Up"
/>
<keystroke
action=
"viewport_move_up"
Control=
"1"
AltMeta=
"1"
key=
"KP_Up"
/>
<keystroke
action=
"viewport_move_right"
Control=
"1"
AltMeta=
"1"
key=
"Right"
/>
<keystroke
action=
"viewport_move_right"
Control=
"1"
AltMeta=
"1"
key=
"KP_Right"
/>
<keystroke
action=
"viewport_move_down"
Control=
"1"
AltMeta=
"1"
key=
"Down"
/>
<keystroke
action=
"viewport_move_down"
Control=
"1"
AltMeta=
"1"
key=
"KP_Down"
/>
<keystroke
action=
"viewport_scroll_left"
Control=
"1"
AltMeta=
"1"
key=
"Left"
/>
<keystroke
action=
"viewport_scroll_left"
Control=
"1"
AltMeta=
"1"
key=
"KP_Left"
/>
<keystroke
action=
"viewport_scroll_up"
Control=
"1"
AltMeta=
"1"
key=
"Up"
/>
<keystroke
action=
"viewport_scroll_up"
Control=
"1"
AltMeta=
"1"
key=
"KP_Up"
/>
<keystroke
action=
"viewport_scroll_right"
Control=
"1"
AltMeta=
"1"
key=
"Right"
/>
<keystroke
action=
"viewport_scroll_right"
Control=
"1"
AltMeta=
"1"
key=
"KP_Right"
/>
<keystroke
action=
"viewport_scroll_down"
Control=
"1"
AltMeta=
"1"
key=
"Down"
/>
<keystroke
action=
"viewport_scroll_down"
Control=
"1"
AltMeta=
"1"
key=
"KP_Down"
/>
<keystroke
action=
"reread_keystrokes"
Control=
"1"
AltMeta=
"1"
key=
"k"
/>
</keystrokes>
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
25d38bf3
...
...
@@ -2103,6 +2103,8 @@ void ddxUseMsg()
ErrorF
(
"-nokbreset don't reset keyboard device if the session is resumed
\n
"
);
ErrorF
(
"-noxkblock always allow applications to change layout through XKEYBOARD
\n
"
);
ErrorF
(
"-tile WxH size of image tiles (minimum allowed: 32x32)
\n
"
);
ErrorF
(
"-keystrokefile file file with keyboard shortcut definitions
\n
"
);
ErrorF
(
"-verbose print more warning and error messages
\n
"
);
ErrorF
(
"-D enable desktop mode
\n
"
);
ErrorF
(
"-R enable rootless mode
\n
"
);
ErrorF
(
"-S enable shadow mode
\n
"
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Events.c
View file @
25d38bf3
...
...
@@ -180,6 +180,10 @@ static int viewportLastX;
static
int
viewportLastY
;
static
Cursor
viewportCursor
;
#define MAX_INC 200
#define INC_STEP 5
#define nextinc(x) ((x) < MAX_INC ? (x) += INC_STEP : (x))
/*
* Keyboard and pointer are handled as they were real devices by
* Xnest and we inherit this behaviour. The following mask will
...
...
@@ -193,10 +197,6 @@ static Mask defaultEventMask;
static
int
lastEventSerial
=
0
;
#define MAX_INC 200
#define INC_STEP 5
#define nextinc(x) ((x) < MAX_INC ? (x) += INC_STEP : (x))
/*
* Used to mask the appropriate bits in
* the state reported by XkbStateNotify
...
...
nx-X11/programs/Xserver/hw/nxagent/Init.c
View file @
25d38bf3
...
...
@@ -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
...
...
nx-X11/programs/Xserver/hw/nxagent/Keyboard.h
View file @
25d38bf3
...
...
@@ -126,6 +126,9 @@ CARD8 nxagentConvertKeycode(CARD8 k);
extern
CARD8
nxagentCapsLockKeycode
;
extern
CARD8
nxagentNumLockKeycode
;
extern
unsigned
int
nxagentAltMetaMask
;
extern
unsigned
int
nxagentAltMask
;
extern
unsigned
int
nxagentMetaMask
;
extern
unsigned
int
nxagentCapsMask
;
extern
unsigned
int
nxagentNumlockMask
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
View file @
25d38bf3
This diff is collapsed.
Click to expand it.
nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
View file @
25d38bf3
...
...
@@ -29,8 +29,8 @@
#include "Events.h"
extern
Bool
nxagentCheckSpecialKeystroke
(
XKeyEvent
*
,
enum
HandleEventResult
*
);
unsigned
int
nxagentAltMetaMask
;
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 */
...
...
@@ -39,39 +39,45 @@ unsigned int nxagentAltMetaMask;
* Keystroke.c nxagentSpecialKeystrokeNames */
enum
nxagentSpecialKeystroke
{
/* 0 is used as end marker */
KEYSTROKE_END_MARKER
=
0
,
KEYSTROKE_CLOSE_SESSION
=
1
,
KEYSTROKE_SWITCH_ALL_SCREENS
=
2
,
KEYSTROKE_FULLSCREEN
=
3
,
KEYSTROKE_MINIMIZE
=
4
,
KEYSTROKE_LEFT
=
5
,
KEYSTROKE_UP
=
6
,
KEYSTROKE_RIGHT
=
7
,
KEYSTROKE_DOWN
=
8
,
KEYSTROKE_RESIZE
=
9
,
KEYSTROKE_DEFER
=
10
,
KEYSTROKE_IGNORE
=
11
,
KEYSTROKE_FORCE_SYNCHRONIZATION
=
12
,
KEYSTROKE_END_MARKER
,
KEYSTROKE_CLOSE_SESSION
,
KEYSTROKE_SWITCH_ALL_SCREENS
,
KEYSTROKE_FULLSCREEN
,
KEYSTROKE_MINIMIZE
,
KEYSTROKE_DEFER
,
KEYSTROKE_IGNORE
,
KEYSTROKE_FORCE_SYNCHRONIZATION
,
/* stuff used for debugging, probably not useful for most people */
KEYSTROKE_DEBUG_TREE
=
13
,
KEYSTROKE_REGIONS_ON_SCREEN
=
14
,
KEYSTROKE_TEST_INPUT
=
15
,
KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB
=
16
,
#ifdef DEBUG_TREE
KEYSTROKE_DEBUG_TREE
,
#endif
#ifdef DUMP
KEYSTROKE_REGIONS_ON_SCREEN
,
#endif
#ifdef NX_DEBUG_INPUT
KEYSTROKE_TEST_INPUT
,
KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB
,
#endif
KEYSTROKE_VIEWPORT_MOVE_LEFT
=
17
,
KEYSTROKE_VIEWPORT_MOVE_UP
=
18
,
KEYSTROKE_VIEWPORT_MOVE_RIGHT
=
19
,
KEYSTROKE_VIEWPORT_MOVE_DOWN
=
20
,
/* all the viewport stuff */
KEYSTROKE_RESIZE
,
KEYSTROKE_VIEWPORT_MOVE_LEFT
,
KEYSTROKE_VIEWPORT_MOVE_UP
,
KEYSTROKE_VIEWPORT_MOVE_RIGHT
,
KEYSTROKE_VIEWPORT_MOVE_DOWN
,
KEYSTROKE_VIEWPORT_SCROLL_LEFT
,
KEYSTROKE_VIEWPORT_SCROLL_UP
,
KEYSTROKE_VIEWPORT_SCROLL_RIGHT
,
KEYSTROKE_VIEWPORT_SCROLL_DOWN
,
KEYSTROKE_REREAD_KEYSTROKES
=
21
,
KEYSTROKE_REREAD_KEYSTROKES
,
KEYSTROKE_NOTHING
=
22
,
KEYSTROKE_NOTHING
,
/* insert more here, increment KEYSTROKE_MAX accordingly.
* then update string translation below */
/* insert more here and in the string translation */
KEYSTROKE_MAX
=
23
,
KEYSTROKE_MAX
,
};
struct
nxagentSpecialKeystrokeMap
{
...
...
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
View file @
25d38bf3
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment