From e4a8831bf165d07cf9d2cd47a749b61e0fa4dbb6 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 7 Oct 2017 19:30:00 +0200 Subject: Fix GCC build --- examples/screenshot.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/screenshot.c b/examples/screenshot.c index c0735981..95af49ca 100644 --- a/examples/screenshot.c +++ b/examples/screenshot.c @@ -37,8 +37,8 @@ #include #include "../backend/wayland/os-compatibility.c" -static struct wl_shm *shm; -static struct orbital_screenshooter *screenshooter; +static struct wl_shm *shm = NULL; +static struct orbital_screenshooter *screenshooter = NULL; static struct wl_list output_list; int min_x, min_y, max_x, max_y; int buffer_copy_done; @@ -51,7 +51,7 @@ struct screenshooter_output { struct wl_list link; }; -static void display_handle_geometry(void *data, struct wl_output *wl_output, +static void output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, int physical_width, int physical_height, int subpixel, const char *make, const char *model, int transform) { struct screenshooter_output *output = wl_output_get_user_data(wl_output); @@ -62,7 +62,7 @@ static void display_handle_geometry(void *data, struct wl_output *wl_output, } } -static void display_handle_mode(void *data, struct wl_output *wl_output, +static void output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width, int height, int refresh) { struct screenshooter_output *output = wl_output_get_user_data(wl_output); @@ -72,9 +72,14 @@ static void display_handle_mode(void *data, struct wl_output *wl_output, } } +static void output_handle_done(void *data, struct wl_output *wl_output) { + +} + static const struct wl_output_listener output_listener = { - display_handle_geometry, - display_handle_mode + .geometry = output_handle_geometry, + .mode = output_handle_mode, + .done = output_handle_done, }; static void screenshot_done(void *data, struct orbital_screenshot *screenshot) { @@ -82,7 +87,7 @@ static void screenshot_done(void *data, struct orbital_screenshot *screenshot) { } static const struct orbital_screenshot_listener screenshot_listener = { - screenshot_done + .done = screenshot_done, }; static void handle_global(void *data, struct wl_registry *registry, @@ -109,8 +114,8 @@ static void handle_global_remove(void *data, struct wl_registry *registry, } static const struct wl_registry_listener registry_listener = { - handle_global, - handle_global_remove + .global = handle_global, + .global_remove = handle_global_remove, }; static struct wl_buffer *create_shm_buffer(int width, int height, @@ -165,7 +170,7 @@ static void write_image(const char *filename, int width, int height) { int output_stride = output->width * 4; void *s = output->data; void *d = data + (output->offset_y - min_y) * buffer_stride + - (output->offset_x - min_x) * 4; + (output->offset_x - min_x) * 4; for (int i = 0; i < output->height; i++) { memcpy(d, s, output_stride); -- cgit v1.2.3