Add wayvncctl wayvnc-exit command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>pull/195/head
parent
467cfa1889
commit
e958b06e44
|
@ -43,6 +43,7 @@ struct ctl_server_actions {
|
|||
const char* output_name);
|
||||
struct cmd_response* (*on_disconnect_client)(struct ctl*,
|
||||
const char* id);
|
||||
struct cmd_response* (*on_wayvnc_exit)(struct ctl*);
|
||||
|
||||
// Return number of elements created
|
||||
// Allocate 'clients' array or set ton ULL if none
|
||||
|
|
|
@ -49,6 +49,7 @@ enum cmd_type {
|
|||
CMD_GET_CLIENTS,
|
||||
CMD_GET_OUTPUTS,
|
||||
CMD_DISCONNECT_CLIENT,
|
||||
CMD_WAYVNC_EXIT,
|
||||
CMD_UNKNOWN,
|
||||
};
|
||||
#define CMD_LIST_LEN CMD_UNKNOWN
|
||||
|
@ -113,6 +114,10 @@ static struct cmd_info cmd_list[] = {
|
|||
{NULL, NULL},
|
||||
}
|
||||
},
|
||||
[CMD_WAYVNC_EXIT] = { "wayvnc-exit",
|
||||
"Disconnect all clients and shut down wayvnc",
|
||||
{{NULL,NULL}},
|
||||
},
|
||||
};
|
||||
|
||||
#define CLIENT_EVENT_PARAMS(including) \
|
||||
|
@ -333,6 +338,7 @@ static struct cmd* parse_command(struct jsonipc_request* ipc,
|
|||
case CMD_EVENT_RECEIVE:
|
||||
case CMD_GET_CLIENTS:
|
||||
case CMD_GET_OUTPUTS:
|
||||
case CMD_WAYVNC_EXIT:
|
||||
cmd = calloc(1, sizeof(*cmd));
|
||||
break;
|
||||
case CMD_UNKNOWN:
|
||||
|
@ -538,6 +544,9 @@ static struct cmd_response* ctl_server_dispatch_cmd(struct ctl* self,
|
|||
response = self->actions.on_disconnect_client(self, c->id);
|
||||
break;
|
||||
}
|
||||
case CMD_WAYVNC_EXIT:
|
||||
response = self->actions.on_wayvnc_exit(self);
|
||||
break;
|
||||
case CMD_VERSION:
|
||||
response = generate_version_object();
|
||||
break;
|
||||
|
|
|
@ -539,6 +539,14 @@ static struct cmd_response* on_disconnect_client(struct ctl* ctl,
|
|||
return cmd_failed("No such client with ID \"%s\"", id_string);
|
||||
}
|
||||
|
||||
static struct cmd_response* on_wayvnc_exit(struct ctl* ctl)
|
||||
{
|
||||
struct wayvnc* self = ctl_server_userdata(ctl);
|
||||
nvnc_log(NVNC_LOG_WARNING, "Shutting down via control socket command");
|
||||
wayvnc_exit(self);
|
||||
return cmd_ok();
|
||||
}
|
||||
|
||||
int init_main_loop(struct wayvnc* self)
|
||||
{
|
||||
struct aml* loop = aml_get_default();
|
||||
|
@ -1385,6 +1393,7 @@ int main(int argc, char* argv[])
|
|||
.get_client_list = get_client_list,
|
||||
.get_output_list = get_output_list,
|
||||
.on_disconnect_client = on_disconnect_client,
|
||||
.on_wayvnc_exit = on_wayvnc_exit,
|
||||
};
|
||||
self.ctl = ctl_server_new(socket_path, &ctl_actions);
|
||||
if (!self.ctl)
|
||||
|
|
|
@ -213,6 +213,10 @@ Parameters:
|
|||
Required: The ID of the client to disconnect. This ID can be found from the
|
||||
_GET-CLIENTS_ command or receipt of a _CLIENT-CONNECTED_ event.
|
||||
|
||||
_WAYVNC_EXIT_
|
||||
|
||||
The *wayvnc-exit* command disconnects all clients and shuts down wayvnc.
|
||||
|
||||
_GET-CLIENTS_
|
||||
|
||||
The *get-clients* command retrieves a list of all VNC clients currently
|
||||
|
|
Loading…
Reference in New Issue