wlr_screencast: add xdg_output_listener after output registration if possible

This commit is contained in:
columbarius 2021-04-15 18:20:20 +02:00 committed by Simon Ser
parent 3ca286b0b4
commit ca46a98b86
1 changed files with 15 additions and 4 deletions

View File

@ -303,14 +303,22 @@ static void wlr_add_xdg_output_listener(struct xdpw_wlr_output *output,
output); output);
} }
static void wlr_init_xdg_outputs(struct xdpw_screencast_context *ctx) { static void wlr_init_xdg_output(struct xdpw_screencast_context *ctx,
struct xdpw_wlr_output *output, *tmp; struct xdpw_wlr_output *output) {
wl_list_for_each_safe(output, tmp, &ctx->output_list, link) {
struct zxdg_output_v1 *xdg_output = struct zxdg_output_v1 *xdg_output =
zxdg_output_manager_v1_get_xdg_output(ctx->xdg_output_manager, zxdg_output_manager_v1_get_xdg_output(ctx->xdg_output_manager,
output->output); output->output);
wlr_add_xdg_output_listener(output, xdg_output); wlr_add_xdg_output_listener(output, xdg_output);
} }
static void wlr_init_xdg_outputs(struct xdpw_screencast_context *ctx) {
struct xdpw_wlr_output *output, *tmp;
wl_list_for_each_safe(output, tmp, &ctx->output_list, link) {
if (output->xdg_output) {
continue;
}
wlr_init_xdg_output(ctx, output);
}
} }
static pid_t spawn_chooser(char *cmd, int chooser_in[2], int chooser_out[2]) { static pid_t spawn_chooser(char *cmd, int chooser_in[2], int chooser_out[2]) {
@ -566,6 +574,9 @@ static void wlr_registry_handle_add(void *data, struct wl_registry *reg,
wl_output_add_listener(output->output, &wlr_output_listener, output); wl_output_add_listener(output->output, &wlr_output_listener, output);
wl_list_insert(&ctx->output_list, &output->link); wl_list_insert(&ctx->output_list, &output->link);
if (ctx->xdg_output_manager) {
wlr_init_xdg_output(ctx, output);
}
} }
if (!strcmp(interface, zwlr_screencopy_manager_v1_interface.name)) { if (!strcmp(interface, zwlr_screencopy_manager_v1_interface.name)) {