aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-03-23 22:22:05 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-04-03 21:28:10 +0200
commit3c921ccb42601ad78d0e6a67318ad12ed7118889 (patch)
tree48d47e05f21b7daffe889a01577ee6bab72ce779
parent811ce4902ca7c3ab4b848d01695081d2def11763 (diff)
downloadnx-libs-3c921ccb42601ad78d0e6a67318ad12ed7118889.tar.gz
nx-libs-3c921ccb42601ad78d0e6a67318ad12ed7118889.tar.bz2
nx-libs-3c921ccb42601ad78d0e6a67318ad12ed7118889.zip
Keystroke.c/h: completely disable keystrokes that are not active at compile time
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.c31
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.h6
2 files changed, 27 insertions, 10 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
index 402f10b91..f6b3e420c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
@@ -33,7 +33,6 @@
#include "Display.h"
#include "Events.h"
#include "Options.h"
-#include "Keystroke.h"
#include "Keyboard.h"
#include "Drawable.h"
#include "Init.h" /* extern int nxagentX2go */
@@ -63,6 +62,9 @@ extern void nxagentDeactivateInputDevicesGrabs();
#undef DEBUG
#undef DUMP
+/* must be included _after_ DUMP */
+#include "Keystroke.h"
+
/* this table is used to parse actions given on the command line or in the
* config file, therefore indices have to match the enum in Keystroke.h */
@@ -81,11 +83,16 @@ char * nxagentSpecialKeystrokeNames[] = {
"ignore",
"force_synchronization",
+#ifdef DEBUG_TREE
"debug_tree",
+#endif
+#ifdef DUMP
"regions_on_screen",
+#endif
+#ifdef NX_DEBUG_INPUT
"test_input",
"deactivate_input_devices_grab",
-
+#endif
"viewport_move_left",
"viewport_move_up",
"viewport_move_right",
@@ -97,7 +104,9 @@ char * nxagentSpecialKeystrokeNames[] = {
struct nxagentSpecialKeystrokeMap default_map[] = {
/* stroke, modifierMask, modifierAltMeta, keysym */
+#ifdef DEBUG_TREE
{KEYSTROKE_DEBUG_TREE, ControlMask, True, XK_q},
+#endif
{KEYSTROKE_CLOSE_SESSION, ControlMask, True, XK_t},
{KEYSTROKE_SWITCH_ALL_SCREENS, ControlMask, True, XK_f},
{KEYSTROKE_FULLSCREEN, ControlMask | ShiftMask, True, XK_f},
@@ -115,9 +124,13 @@ struct nxagentSpecialKeystrokeMap default_map[] = {
{KEYSTROKE_IGNORE, ControlMask, True, XK_BackSpace},
{KEYSTROKE_IGNORE, 0, False, XK_Terminate_Server},
{KEYSTROKE_FORCE_SYNCHRONIZATION, ControlMask, True, XK_j},
+#ifdef DUMP
{KEYSTROKE_REGIONS_ON_SCREEN, ControlMask, True, XK_a},
+#endif
+#ifdef NX_DEBUG_INPUT
{KEYSTROKE_TEST_INPUT, ControlMask, True, XK_x},
{KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB, ControlMask, True, XK_y},
+#endif
{KEYSTROKE_VIEWPORT_MOVE_LEFT, ControlMask | ShiftMask, True, XK_Left},
{KEYSTROKE_VIEWPORT_MOVE_LEFT, ControlMask | ShiftMask, True, XK_KP_Left},
{KEYSTROKE_VIEWPORT_MOVE_UP, ControlMask | ShiftMask, True, XK_Up},
@@ -494,11 +507,11 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
}
switch (stroke) {
+#ifdef DEBUG_TREE
case KEYSTROKE_DEBUG_TREE:
- #ifdef DEBUG_TREE
*result = doDebugTree;
- #endif
break;
+#endif
case KEYSTROKE_CLOSE_SESSION:
*result = doCloseSession;
break;
@@ -551,16 +564,16 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
case KEYSTROKE_FORCE_SYNCHRONIZATION:
nxagentForceSynchronization = 1;
break;
+#ifdef DUMP
case KEYSTROKE_REGIONS_ON_SCREEN:
- #ifdef DUMP
nxagentRegionsOnScreen();
- #endif
break;
+#endif
+#ifdef NX_DEBUG_INPUT
case KEYSTROKE_TEST_INPUT:
/*
* Used to test the input devices state.
*/
- #ifdef NX_DEBUG_INPUT
if (X -> type == KeyPress) {
if (nxagentDebugInputDevices == 0) {
fprintf(stderr, "Info: Turning input devices debug ON.\n");
@@ -572,16 +585,14 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
}
}
return True;
- #endif
break;
case KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB:
- #ifdef NX_DEBUG_INPUT
if (X->type == KeyPress) {
nxagentDeactivateInputDevicesGrab();
}
return True;
- #endif
break;
+#endif
case KEYSTROKE_FULLSCREEN:
if (nxagentOption(Rootless) == 0) {
*result = doSwitchFullscreen;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
index f8602fc37..caf72f78c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
@@ -52,10 +52,16 @@ enum nxagentSpecialKeystroke {
KEYSTROKE_FORCE_SYNCHRONIZATION,
/* stuff used for debugging, probably not useful for most people */
+#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,
KEYSTROKE_VIEWPORT_MOVE_UP,