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
abf62421
Commit
abf62421
authored
Mar 13, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keystroke.c: add new keystroke to reread keystroke config
Default is ctrl-alt-k
parent
aadcac45
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
6 deletions
+39
-6
README.keystrokes
doc/nxagent/README.keystrokes
+4
-0
keystrokes.cfg
etc/keystrokes.cfg
+1
-0
Keystroke.c
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+30
-4
Keystroke.h
nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
+4
-2
No files found.
doc/nxagent/README.keystrokes
View file @
abf62421
...
...
@@ -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
...
...
etc/keystrokes.cfg
View file @
abf62421
...
...
@@ -16,4 +16,5 @@
<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_down"
Control=
"1"
AltMeta=
"1"
key=
"Down"
/>
<keystroke
action=
"reread_keystrokes"
Control=
"1"
AltMeta=
"1"
key=
"k"
/>
</keystrokes>
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
View file @
abf62421
...
...
@@ -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
:
...
...
nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
View file @
abf62421
...
...
@@ -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
=
2
2
,
KEYSTROKE_MAX
=
2
3
,
};
struct
nxagentSpecialKeystrokeMap
{
...
...
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