Add wayvncctl capture-changed event

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
pull/195/head
Jim Ramsay 2022-11-24 20:57:26 -05:00 committed by Andri Yngvason
parent 19862aace8
commit 467cfa1889
4 changed files with 31 additions and 0 deletions

View File

@ -76,3 +76,6 @@ void ctl_server_event_disconnected(struct ctl*,
const char* client_hostname, const char* client_hostname,
const char* client_username, const char* client_username,
int new_connection_count); int new_connection_count);
void ctl_server_event_capture_changed(struct ctl*,
const char* captured_output);

View File

@ -56,6 +56,7 @@ enum cmd_type {
enum event_type { enum event_type {
EVT_CLIENT_CONNECTED, EVT_CLIENT_CONNECTED,
EVT_CLIENT_DISCONNECTED, EVT_CLIENT_DISCONNECTED,
EVT_CAPTURE_CHANGED,
EVT_UNKNOWN, EVT_UNKNOWN,
}; };
#define EVT_LIST_LEN EVT_UNKNOWN #define EVT_LIST_LEN EVT_UNKNOWN
@ -130,6 +131,14 @@ static struct cmd_info evt_list[] = {
"Sent when a vnc client disconnects from wayvnc", "Sent when a vnc client disconnects from wayvnc",
{ CLIENT_EVENT_PARAMS("not including") } { CLIENT_EVENT_PARAMS("not including") }
}, },
[EVT_CAPTURE_CHANGED] = {"capture-changed",
"Sent when wayvnc changes which output is captured",
{
{"output", "The name of the output now being captured"},
{NULL, NULL},
},
},
}; };
struct cmd { struct cmd {
@ -1038,3 +1047,10 @@ void ctl_server_event_disconnected(struct ctl* self,
ctl_server_event_connect(self, EVT_CLIENT_DISCONNECTED, client_id, ctl_server_event_connect(self, EVT_CLIENT_DISCONNECTED, client_id,
client_hostname, client_username, new_connection_count); client_hostname, client_username, new_connection_count);
} }
void ctl_server_event_capture_changed(struct ctl* self,
const char* captured_output)
{
ctl_server_enqueue_event(self, EVT_CAPTURE_CHANGED,
json_pack("{s:s}", "output", captured_output));
}

View File

@ -1087,6 +1087,8 @@ void set_selected_output(struct wayvnc* self, struct output* output) {
self->screencopy.wl_output = output->wl_output; self->screencopy.wl_output = output->wl_output;
output->on_dimension_change = on_output_dimension_change; output->on_dimension_change = on_output_dimension_change;
output->userdata = self; output->userdata = self;
if (self->ctl)
ctl_server_event_capture_changed(self->ctl, output->name);
log_selected_output(self); log_selected_output(self);
} }

View File

@ -262,6 +262,16 @@ Parameters:
*username=...* *username=...*
The username used to authenticate this client. May be null. The username used to authenticate this client. May be null.
_CAPTURE_CHANGED_
The *capture-changed* event is sent when the currently captured output
changes.
Parameters:
*output=...*
The name of the output now being captured.
## IPC MESSAGE FORMAT ## IPC MESSAGE FORMAT
The *wayvncctl(1)* command line utility will construct properly-formatted json The *wayvncctl(1)* command line utility will construct properly-formatted json