Skip to content

Commit

Permalink
Create outputchooser function in wlr_screencast.c
Browse files Browse the repository at this point in the history
  • Loading branch information
columbarius committed Oct 10, 2020
1 parent 39b82ff commit ec38d34
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/wlr_screencast.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct xdpw_wlr_output *xdpw_wlr_output_find_by_name(struct wl_list *output_list
struct xdpw_wlr_output *xdpw_wlr_output_first(struct wl_list *output_list);
struct xdpw_wlr_output *xdpw_wlr_output_find(struct xdpw_screencast_context *ctx,
struct wl_output *out, uint32_t id);
struct xdpw_wlr_output *xdpw_wlr_output_chooser(struct wl_list *output_list);

void xdpw_wlr_frame_free(struct xdpw_screencast_instance *cast);
void xdpw_wlr_register_cb(struct xdpw_screencast_instance *cast);
Expand Down
2 changes: 1 addition & 1 deletion src/screencast/screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int setup_outputs(struct xdpw_screencast_context *ctx, struct xdpw_session *sess
abort();
}
} else {
out = xdpw_wlr_output_first(&ctx->output_list);
out = xdpw_wlr_output_chooser(&ctx->output_list);
if (!out) {
logprint(ERROR, "wlroots: no output found");
abort();
Expand Down
17 changes: 17 additions & 0 deletions src/screencast/wlr_screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,23 @@ struct xdpw_wlr_output *xdpw_wlr_output_first(struct wl_list *output_list) {
return NULL;
}

struct xdpw_wlr_output *xdpw_wlr_output_chooser(struct wl_list *output_list) {

logprint(DEBUG, "wlroots: output chooser called");
struct xdpw_wlr_output* (*chooser_functions[])(struct wl_list*) = {
xdpw_wlr_output_first
};
int N = sizeof(chooser_functions)/sizeof(chooser_functions[0]);
struct xdpw_wlr_output *output;
for (int i = 0; i<N; i++) {
output = chooser_functions[i](output_list);
if (output != NULL) {
return output;
}
}
return output;
}

struct xdpw_wlr_output *xdpw_wlr_output_find_by_name(struct wl_list *output_list,
const char* name) {
struct xdpw_wlr_output *output, *tmp;
Expand Down

0 comments on commit ec38d34

Please sign in to comment.