Skip to content

Commit

Permalink
examples: screencopy: Add option to capture cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
any1 committed Oct 31, 2021
1 parent fef4104 commit 4fe62d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/screencopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct format {
static struct wl_shm *shm = NULL;
static struct zext_screencopy_manager_v1 *screencopy_manager = NULL;
static struct wl_output *output = NULL;
static bool capture_cursor = false;

static struct {
struct wl_buffer *wl_buffer;
Expand Down Expand Up @@ -281,7 +282,11 @@ static void write_image(char *filename, enum wl_shm_format wl_fmt, int width,
}

int main(int argc, char *argv[]) {
struct wl_display * display = wl_display_connect(NULL);
if (argc >= 2 && strcmp(argv[1], "cursor") == 0) {
capture_cursor = true;
}

struct wl_display *display = wl_display_connect(NULL);
if (display == NULL) {
perror("failed to create display");
return EXIT_FAILURE;
Expand All @@ -304,7 +309,8 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}

struct zext_screencopy_surface_v1 *surface =
struct zext_screencopy_surface_v1 *surface = capture_cursor ?
zext_screencopy_manager_v1_capture_output_cursor(screencopy_manager, output) :
zext_screencopy_manager_v1_capture_output(screencopy_manager, output);
zext_screencopy_surface_v1_add_listener(surface, &frame_listener, NULL);

Expand Down

0 comments on commit 4fe62d0

Please sign in to comment.