Fix GCC build

This commit is contained in:
emersion 2017-10-07 19:30:00 +02:00
parent c9909a45ab
commit e4a8831bf1
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 15 additions and 10 deletions

View File

@ -37,8 +37,8 @@
#include <screenshooter-client-protocol.h> #include <screenshooter-client-protocol.h>
#include "../backend/wayland/os-compatibility.c" #include "../backend/wayland/os-compatibility.c"
static struct wl_shm *shm; static struct wl_shm *shm = NULL;
static struct orbital_screenshooter *screenshooter; static struct orbital_screenshooter *screenshooter = NULL;
static struct wl_list output_list; static struct wl_list output_list;
int min_x, min_y, max_x, max_y; int min_x, min_y, max_x, max_y;
int buffer_copy_done; int buffer_copy_done;
@ -51,7 +51,7 @@ struct screenshooter_output {
struct wl_list link; 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, int x, int y, int physical_width, int physical_height, int subpixel,
const char *make, const char *model, int transform) { const char *make, const char *model, int transform) {
struct screenshooter_output *output = wl_output_get_user_data(wl_output); 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) { uint32_t flags, int width, int height, int refresh) {
struct screenshooter_output *output = wl_output_get_user_data(wl_output); 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 = { static const struct wl_output_listener output_listener = {
display_handle_geometry, .geometry = output_handle_geometry,
display_handle_mode .mode = output_handle_mode,
.done = output_handle_done,
}; };
static void screenshot_done(void *data, struct orbital_screenshot *screenshot) { 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 = { static const struct orbital_screenshot_listener screenshot_listener = {
screenshot_done .done = screenshot_done,
}; };
static void handle_global(void *data, struct wl_registry *registry, 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 = { static const struct wl_registry_listener registry_listener = {
handle_global, .global = handle_global,
handle_global_remove .global_remove = handle_global_remove,
}; };
static struct wl_buffer *create_shm_buffer(int width, int height, 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; int output_stride = output->width * 4;
void *s = output->data; void *s = output->data;
void *d = data + (output->offset_y - min_y) * buffer_stride + 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++) { for (int i = 0; i < output->height; i++) {
memcpy(d, s, output_stride); memcpy(d, s, output_stride);