diff options
author | Jeremy White <jwhite@codeweavers.com> | 2016-10-27 12:54:24 -0500 |
---|---|---|
committer | Jeremy White <jwhite@codeweavers.com> | 2016-10-27 12:54:24 -0500 |
commit | 7241128be4fb31d7667f1fc394a9ae4e8b50bff3 (patch) | |
tree | d3bffa561381a858a8255a404f74fb061a375d9d | |
parent | 3dd90df9c17912983be1a409f63fc80994a2b7ba (diff) |
Invert the logic of viewonly.
This makes view only the default, and requires an explicit
request to allow-control instead.
-rw-r--r-- | src/data/x11spice.1 | 5 | ||||
-rw-r--r-- | src/options.c | 12 | ||||
-rw-r--r-- | src/options.h | 2 | ||||
-rw-r--r-- | src/session.c | 6 | ||||
-rwxr-xr-x | src/util/run | 2 | ||||
-rw-r--r-- | src/xdg/x11spice/x11spice.conf | 6 |
6 files changed, 16 insertions, 17 deletions
diff --git a/src/data/x11spice.1 b/src/data/x11spice.1 index 2c8f2a3..3fb477a 100644 --- a/src/data/x11spice.1 +++ b/src/data/x11spice.1 @@ -70,9 +70,8 @@ and finally the ciphersuite. You can skip one of the options by providing a bla If a timeout is specificed, if no connection is made within the given number of seconds, x11spice will exit. .TP -\fB\-\-viewonly\fR -This will prevent a remote viewer from being able to inject mouse or keyboard -commands. +\fB\-\-allow-control\fR +This will enable a remote viewer to inject mouse or keyboard commands. .SH EXIT STATUS x11spice will return a status of 0 if it is able to start a Spice session. diff --git a/src/options.c b/src/options.c index ba7e6ed..50dc769 100644 --- a/src/options.c +++ b/src/options.c @@ -135,7 +135,7 @@ static void usage(options_t *options, char *argv0) printf(" checking for an open port, and using the first one available.\n"); printf("\n"); printf("Options:\n"); - printf("%s [--viewonly]\n", indent); + printf("%s [--allow-control]\n", indent); printf("%s [--timeout=<seconds>]\n", indent); printf("%s [--display=<DISPLAY>]\n", indent); printf("%s [--generate-password[=<len>]\n", indent); @@ -219,7 +219,7 @@ int options_parse_arguments(int argc, char *argv[], options_t *options) int rc; int longindex = 0; - enum option_types { OPTION_VIEWONLY, OPTION_TIMEOUT, OPTION_AUTO, OPTION_HIDE, + enum option_types { OPTION_ALLOW_CONTROL, OPTION_TIMEOUT, OPTION_AUTO, OPTION_HIDE, OPTION_PASSWORD, OPTION_PASSWORD_FILE, OPTION_CONFIG, OPTION_SSL, OPTION_GENERATE_PASSWORD, OPTION_DISPLAY, OPTION_MINIMIZE, OPTION_HELP @@ -227,7 +227,7 @@ int options_parse_arguments(int argc, char *argv[], options_t *options) static struct option long_options[] = { - {"viewonly", 0, 0, OPTION_VIEWONLY }, + {"allow-control", 0, 0, OPTION_ALLOW_CONTROL }, {"timeout", 1, 0, OPTION_TIMEOUT }, {"auto", 1, 0, OPTION_AUTO }, {"hide", 0, 0, OPTION_HIDE }, @@ -250,8 +250,8 @@ int options_parse_arguments(int argc, char *argv[], options_t *options) } switch (rc) { - case OPTION_VIEWONLY: - options->viewonly = 1; + case OPTION_ALLOW_CONTROL: + options->allow_control = 1; break; case OPTION_TIMEOUT: @@ -357,7 +357,7 @@ void options_from_config(options_t *options) options->timeout = int_option(userkey, systemkey, "spice", "timeout"); options->minimize = bool_option(userkey, systemkey, "spice", "minimize"); - options->viewonly = bool_option(userkey, systemkey, "spice", "viewonly"); + options->allow_control = bool_option(userkey, systemkey, "spice", "allow-control"); options->generate_password = int_option(userkey, systemkey, "spice", "generate-password"); options->hide = bool_option(userkey, systemkey, "spice", "hide"); options->display = string_option(userkey, systemkey, "spice", "display"); diff --git a/src/options.h b/src/options.h index 3744847..bbcd2b2 100644 --- a/src/options.h +++ b/src/options.h @@ -43,7 +43,7 @@ typedef struct { /* Both config and command line arguments */ long timeout; int minimize; - int viewonly; + int allow_control; int generate_password; int hide; char *display; diff --git a/src/session.c b/src/session.c index 8c6853f..77b76ac 100644 --- a/src/session.c +++ b/src/session.c @@ -122,7 +122,7 @@ int session_cursor_waiting(session_t *session) void session_handle_key(session_t *session, uint8_t keycode, int is_press) { - if (session->options.viewonly) + if (! session->options.allow_control) return; xcb_test_fake_input(session->display.c, is_press ? XCB_KEY_PRESS : XCB_KEY_RELEASE, @@ -133,7 +133,7 @@ void session_handle_key(session_t *session, uint8_t keycode, int is_press) void session_handle_mouse_position(session_t *session, int x, int y, uint32_t buttons_state) { - if (session->options.viewonly) + if (! session->options.allow_control) return; xcb_test_fake_input(session->display.c, XCB_MOTION_NOTIFY, 0, XCB_CURRENT_TIME, @@ -145,7 +145,7 @@ void session_handle_mouse_position(session_t *session, int x, int y, uint32_t bu static void session_handle_button_change(session_t *s, uint32_t buttons_state) { int i; - if (s->options.viewonly) + if (! s->options.allow_control) return; for (i = 0; i < BUTTONS; i++) { diff --git a/src/util/run b/src/util/run index 69560e1..451416d 100755 --- a/src/util/run +++ b/src/util/run @@ -20,7 +20,7 @@ dn=`dirname $0` ddir=`(cd $dn; pwd)` xorg_args="-ac -config $ddir/dummy.xorg.conf -logfile $ddir/dummy.log" -args="5900-5910" +args="--allow-control 5900-5910" function cleanup { rm -rf /tmp/xspice-vdagent diff --git a/src/xdg/x11spice/x11spice.conf b/src/xdg/x11spice/x11spice.conf index 98ac734..2e5dfc6 100644 --- a/src/xdg/x11spice/x11spice.conf +++ b/src/xdg/x11spice/x11spice.conf @@ -44,10 +44,10 @@ #uinput-path=/tmp/xspice-uinput #----------------------------------------------------------------------------- -# viewonly If set to true, indicates that a remote client cannot move the -# mouse or enter keystrokes. Default false. +# allow-control If set to true, indicates that a remote client is permitted to +# move the mouse or enter keystrokes. Default false. #----------------------------------------------------------------------------- -#viewonly=false +#allow-control=false #----------------------------------------------------------------------------- # timeout Specifies a time, in seconds, when x11spice exits if no connection |