Commit 7241128b authored by Jeremy White's avatar Jeremy White

Invert the logic of viewonly.

This makes view only the default, and requires an explicit
request to allow-control instead.
parent 3dd90df9
......@@ -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.
......
......@@ -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");
......
......@@ -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;
......
......@@ -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++) {
......
......@@ -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
......
......@@ -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
......
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