Add -Wmissing-prototypes

This requires functions without a prototype definition to be static.
This allows to detect dead code, export less symbols and put shared
functions in headers.
This commit is contained in:
Simon Ser 2019-11-20 00:45:19 +01:00 committed by Scott Anderson
parent 685a5a11a9
commit 16e5e9541b
24 changed files with 66 additions and 123 deletions

View File

@ -154,9 +154,6 @@ static bool atomic_conn_enable(struct wlr_drm_backend *drm,
true); true);
} }
bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, struct gbm_bo *bo);
static bool atomic_crtc_set_cursor(struct wlr_drm_backend *drm, static bool atomic_crtc_set_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, struct gbm_bo *bo) { struct wlr_drm_crtc *crtc, struct gbm_bo *bo) {
if (!crtc || !crtc->cursor) { if (!crtc || !crtc->cursor) {
@ -185,9 +182,6 @@ static bool atomic_crtc_set_cursor(struct wlr_drm_backend *drm,
return atomic_end(drm->fd, &atom); return atomic_end(drm->fd, &atom);
} }
bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, int x, int y);
static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm, static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, int x, int y) { struct wlr_drm_crtc *crtc, int x, int y) {
if (!crtc || !crtc->cursor) { if (!crtc || !crtc->cursor) {

View File

@ -68,13 +68,13 @@ bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm,
return !drmModeMoveCursor(drm->fd, crtc->id, x, y); return !drmModeMoveCursor(drm->fd, crtc->id, x, y);
} }
bool legacy_crtc_set_gamma(struct wlr_drm_backend *drm, static bool legacy_crtc_set_gamma(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, size_t size, struct wlr_drm_crtc *crtc, size_t size,
uint16_t *r, uint16_t *g, uint16_t *b) { uint16_t *r, uint16_t *g, uint16_t *b) {
return !drmModeCrtcSetGamma(drm->fd, crtc->id, (uint32_t)size, r, g, b); return !drmModeCrtcSetGamma(drm->fd, crtc->id, (uint32_t)size, r, g, b);
} }
size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm, static size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc) { struct wlr_drm_crtc *crtc) {
return (size_t)crtc->legacy_crtc->gamma_size; return (size_t)crtc->legacy_crtc->gamma_size;
} }

View File

@ -9,7 +9,7 @@
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h" #include "util/signal.h"
struct wlr_libinput_input_device *get_libinput_device_from_device( static struct wlr_libinput_input_device *get_libinput_device_from_device(
struct wlr_input_device *wlr_dev) { struct wlr_input_device *wlr_dev) {
assert(wlr_input_device_is_libinput(wlr_dev)); assert(wlr_input_device_is_libinput(wlr_dev));
return (struct wlr_libinput_input_device *)wlr_dev; return (struct wlr_libinput_input_device *)wlr_dev;

View File

@ -447,7 +447,7 @@ static struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_impl = {
}; };
void relative_pointer_handle_relative_motion(void *data, static void relative_pointer_handle_relative_motion(void *data,
struct zwp_relative_pointer_v1 *relative_pointer, uint32_t utime_hi, struct zwp_relative_pointer_v1 *relative_pointer, uint32_t utime_hi,
uint32_t utime_lo, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dx_unaccel, uint32_t utime_lo, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dx_unaccel,
wl_fixed_t dy_unaccel) { wl_fixed_t dy_unaccel) {

View File

@ -461,7 +461,7 @@ static void register_cb(struct capture_context *ctx) {
&frame_listener, ctx); &frame_listener, ctx);
} }
void *vid_encode_thread(void *arg) { static void *vid_encode_thread(void *arg) {
int err = 0; int err = 0;
struct capture_context *ctx = arg; struct capture_context *ctx = arg;
@ -686,7 +686,7 @@ static int init_encoding(struct capture_context *ctx) {
struct capture_context *q_ctx = NULL; struct capture_context *q_ctx = NULL;
void on_quit_signal(int signo) { static void on_quit_signal(int signo) {
printf("\r"); printf("\r");
av_log(q_ctx, AV_LOG_WARNING, "Quitting!\n"); av_log(q_ctx, AV_LOG_WARNING, "Quitting!\n");
q_ctx->quit = true; q_ctx->quit = true;

View File

@ -52,7 +52,7 @@ static const struct org_kde_kwin_idle_timeout_listener idle_timer_listener = {
.resumed = handle_resume, .resumed = handle_resume,
}; };
int parse_args(int argc, char *argv[]) { static int parse_args(int argc, char *argv[]) {
int c; int c;
while ((c = getopt(argc, argv, "c:hs:t:")) != -1) { while ((c = getopt(argc, argv, "c:hs:t:")) != -1) {
switch(c) switch(c)
@ -81,7 +81,7 @@ int parse_args(int argc, char *argv[]) {
return 0; return 0;
} }
void *simulate_activity(void *data) { static void *simulate_activity(void *data) {
sleep(simulate_activity_timeout); sleep(simulate_activity_timeout);
fprintf(stdout, "simulate user activity\n"); fprintf(stdout, "simulate user activity\n");
struct thread_args *arg = data; struct thread_args *arg = data;
@ -90,7 +90,7 @@ void *simulate_activity(void *data) {
return NULL; return NULL;
} }
void *close_program(void *data) { static void *close_program(void *data) {
sleep(close_timeout); sleep(close_timeout);
struct thread_args *arg = data; struct thread_args *arg = data;
org_kde_kwin_idle_timeout_release(arg->timer); org_kde_kwin_idle_timeout_release(arg->timer);
@ -100,7 +100,7 @@ void *close_program(void *data) {
return NULL; return NULL;
} }
void *main_loop(void *data) { static void *main_loop(void *data) {
struct wl_display *display = data; struct wl_display *display = data;
while (wl_display_dispatch(display) != -1) { while (wl_display_dispatch(display) != -1) {
; ;

View File

@ -68,7 +68,7 @@ struct sample_keyboard {
struct wl_listener destroy; struct wl_listener destroy;
}; };
void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device, static void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device,
struct sample_state *sample) { struct sample_state *sample) {
struct sample_output *output; struct sample_output *output;
wlr_log(WLR_ERROR, "Configuring cursor %p for device %p", cursor, device); wlr_log(WLR_ERROR, "Configuring cursor %p for device %p", cursor, device);
@ -88,7 +88,7 @@ void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device
} }
} }
void output_frame_notify(struct wl_listener *listener, void *data) { static void output_frame_notify(struct wl_listener *listener, void *data) {
struct sample_output *output = wl_container_of(listener, output, frame); struct sample_output *output = wl_container_of(listener, output, frame);
struct sample_state *sample = output->sample; struct sample_state *sample = output->sample;
struct wlr_output *wlr_output = output->output; struct wlr_output *wlr_output = output->output;
@ -127,27 +127,7 @@ static void cursor_destroy(struct sample_cursor *cursor) {
free(cursor); free(cursor);
} }
void input_remove_notify(struct wl_listener *listener, void *data) { static void output_remove_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data;
struct sample_cursor *sample_cursor = wl_container_of(listener, sample_cursor, destroy);
struct sample_state *sample = sample_cursor->sample;
struct sample_cursor *cursor;
wl_list_for_each(cursor, &sample->cursors, link) {
if (cursor->device == device) {
cursor_destroy(cursor);
break;
}
}
struct sample_pointer *pointer;
wl_list_for_each(pointer, &sample->pointers, link) {
if (pointer->device == device) {
free(pointer);
break;
}
}
}
void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy);
struct sample_state *sample = sample_output->sample; struct sample_state *sample = sample_output->sample;
wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->frame.link);
@ -161,7 +141,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) {
} }
} }
void new_output_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
@ -193,7 +173,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
wl_list_insert(&sample->outputs, &sample_output->link); wl_list_insert(&sample->outputs, &sample_output->link);
} }
void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_event_keyboard_key *event = data;
@ -209,14 +189,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
} }
} }
void keyboard_destroy_notify(struct wl_listener *listener, void *data) { static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->destroy.link);
wl_list_remove(&keyboard->key.link); wl_list_remove(&keyboard->key.link);
free(keyboard); free(keyboard);
} }
void new_input_notify(struct wl_listener *listener, void *data) { static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data; struct wlr_input_device *device = data;
struct sample_state *sample = wl_container_of(listener, sample, new_input); struct sample_state *sample = wl_container_of(listener, sample, new_input);
switch (device->type) { switch (device->type) {

View File

@ -106,7 +106,7 @@ static void animate_cat(struct sample_state *sample,
sample->ts_last = ts; sample->ts_last = ts;
} }
void output_frame_notify(struct wl_listener *listener, void *data) { static void output_frame_notify(struct wl_listener *listener, void *data) {
struct sample_output *output = wl_container_of(listener, output, frame); struct sample_output *output = wl_container_of(listener, output, frame);
struct sample_state *sample = output->sample; struct sample_state *sample = output->sample;
struct timespec ts; struct timespec ts;
@ -145,7 +145,7 @@ static void update_velocities(struct sample_state *sample,
sample->y_vel += y_diff; sample->y_vel += y_diff;
} }
void output_remove_notify(struct wl_listener *listener, void *data) { static void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy);
struct sample_state *sample = sample_output->sample; struct sample_state *sample = sample_output->sample;
wlr_output_layout_remove(sample->layout, sample_output->output); wlr_output_layout_remove(sample->layout, sample_output->output);
@ -154,7 +154,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) {
free(sample_output); free(sample_output);
} }
void new_output_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
@ -171,7 +171,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
sample_output->destroy.notify = output_remove_notify; sample_output->destroy.notify = output_remove_notify;
} }
void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_event_keyboard_key *event = data;
@ -207,14 +207,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
} }
} }
void keyboard_destroy_notify(struct wl_listener *listener, void *data) { static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->destroy.link);
wl_list_remove(&keyboard->key.link); wl_list_remove(&keyboard->key.link);
free(keyboard); free(keyboard);
} }
void new_input_notify(struct wl_listener *listener, void *data) { static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data; struct wlr_input_device *device = data;
struct sample_state *sample = wl_container_of(listener, sample, new_input); struct sample_state *sample = wl_container_of(listener, sample, new_input);
switch (device->type) { switch (device->type) {

View File

@ -90,7 +90,7 @@ static void warp_to_touch(struct sample_state *state,
wlr_cursor_warp_absolute(state->cursor, dev, x, y); wlr_cursor_warp_absolute(state->cursor, dev, x, y);
} }
void output_frame_notify(struct wl_listener *listener, void *data) { static void output_frame_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, frame); struct sample_output *sample_output = wl_container_of(listener, sample_output, frame);
struct sample_state *state = sample_output->state; struct sample_state *state = sample_output->state;
struct wlr_output *wlr_output = sample_output->output; struct wlr_output *wlr_output = sample_output->output;
@ -221,7 +221,7 @@ static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
} }
} }
void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->state; struct sample_state *sample = keyboard->state;
struct wlr_event_keyboard_key *event = data; struct wlr_event_keyboard_key *event = data;
@ -237,7 +237,7 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
} }
} }
void output_remove_notify(struct wl_listener *listener, void *data) { static void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy);
struct sample_state *sample = sample_output->state; struct sample_state *sample = sample_output->state;
wlr_output_layout_remove(sample->layout, sample_output->output); wlr_output_layout_remove(sample->layout, sample_output->output);
@ -246,7 +246,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) {
free(sample_output); free(sample_output);
} }
void new_output_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
@ -268,14 +268,14 @@ void new_output_notify(struct wl_listener *listener, void *data) {
} }
void keyboard_destroy_notify(struct wl_listener *listener, void *data) { static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->destroy.link);
wl_list_remove(&keyboard->key.link); wl_list_remove(&keyboard->key.link);
free(keyboard); free(keyboard);
} }
void new_input_notify(struct wl_listener *listener, void *data) { static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data; struct wlr_input_device *device = data;
struct sample_state *state = wl_container_of(listener, state, new_input); struct sample_state *state = wl_container_of(listener, state, new_input);
switch (device->type) { switch (device->type) {

View File

@ -97,14 +97,14 @@ static void update_velocities(struct sample_state *sample,
} }
} }
void output_remove_notify(struct wl_listener *listener, void *data) { static void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy);
wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->frame.link);
wl_list_remove(&sample_output->destroy.link); wl_list_remove(&sample_output->destroy.link);
free(sample_output); free(sample_output);
} }
void new_output_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
@ -125,7 +125,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
wl_list_insert(&sample->outputs, &sample_output->link); wl_list_insert(&sample->outputs, &sample_output->link);
} }
void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_event_keyboard_key *event = data;
@ -157,14 +157,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
} }
} }
void keyboard_destroy_notify(struct wl_listener *listener, void *data) { static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->destroy.link);
wl_list_remove(&keyboard->key.link); wl_list_remove(&keyboard->key.link);
free(keyboard); free(keyboard);
} }
void new_input_notify(struct wl_listener *listener, void *data) { static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data; struct wlr_input_device *device = data;
struct sample_state *sample = wl_container_of(listener, sample, new_input); struct sample_state *sample = wl_container_of(listener, sample, new_input);
switch (device->type) { switch (device->type) {

View File

@ -36,7 +36,7 @@ struct sample_keyboard {
struct wl_listener destroy; struct wl_listener destroy;
}; };
void output_frame_notify(struct wl_listener *listener, void *data) { static void output_frame_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = struct sample_output *sample_output =
wl_container_of(listener, sample_output, frame); wl_container_of(listener, sample_output, frame);
struct sample_state *sample = sample_output->sample; struct sample_state *sample = sample_output->sample;
@ -65,7 +65,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
sample->last_frame = now; sample->last_frame = now;
} }
void output_remove_notify(struct wl_listener *listener, void *data) { static void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = struct sample_output *sample_output =
wl_container_of(listener, sample_output, destroy); wl_container_of(listener, sample_output, destroy);
wlr_log(WLR_DEBUG, "Output removed"); wlr_log(WLR_DEBUG, "Output removed");
@ -74,7 +74,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) {
free(sample_output); free(sample_output);
} }
void new_output_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = struct sample_state *sample =
wl_container_of(listener, sample, new_output); wl_container_of(listener, sample, new_output);
@ -93,7 +93,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
sample_output->destroy.notify = output_remove_notify; sample_output->destroy.notify = output_remove_notify;
} }
void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_event_keyboard_key *event = data;
@ -109,7 +109,7 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
} }
} }
void keyboard_destroy_notify(struct wl_listener *listener, void *data) { static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = struct sample_keyboard *keyboard =
wl_container_of(listener, keyboard, destroy); wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->destroy.link);
@ -117,7 +117,7 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
free(keyboard); free(keyboard);
} }
void new_input_notify(struct wl_listener *listener, void *data) { static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data; struct wlr_input_device *device = data;
struct sample_state *sample = wl_container_of(listener, sample, new_input); struct sample_state *sample = wl_container_of(listener, sample, new_input);
switch (device->type) { switch (device->type) {

View File

@ -227,14 +227,14 @@ static void tablet_pad_destroy_notify(struct wl_listener *listener, void *data)
free(pstate); free(pstate);
} }
void output_remove_notify(struct wl_listener *listener, void *data) { static void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy);
wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->frame.link);
wl_list_remove(&sample_output->destroy.link); wl_list_remove(&sample_output->destroy.link);
free(sample_output); free(sample_output);
} }
void new_output_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
@ -250,7 +250,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
sample_output->destroy.notify = output_remove_notify; sample_output->destroy.notify = output_remove_notify;
} }
void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_event_keyboard_key *event = data;
@ -266,14 +266,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
} }
} }
void keyboard_destroy_notify(struct wl_listener *listener, void *data) { static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->destroy.link);
wl_list_remove(&keyboard->key.link); wl_list_remove(&keyboard->key.link);
free(keyboard); free(keyboard);
} }
void new_input_notify(struct wl_listener *listener, void *data) { static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data; struct wlr_input_device *device = data;
struct sample_state *sample = wl_container_of(listener, sample, new_input); struct sample_state *sample = wl_container_of(listener, sample, new_input);
switch (device->type) { switch (device->type) {

View File

@ -140,14 +140,14 @@ static void touch_destroy_notify(struct wl_listener *listener, void *data) {
free(tstate); free(tstate);
} }
void output_remove_notify(struct wl_listener *listener, void *data) { static void output_remove_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy);
wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->frame.link);
wl_list_remove(&sample_output->destroy.link); wl_list_remove(&sample_output->destroy.link);
free(sample_output); free(sample_output);
} }
void new_output_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
@ -163,7 +163,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
sample_output->destroy.notify = output_remove_notify; sample_output->destroy.notify = output_remove_notify;
} }
void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_event_keyboard_key *event = data;
@ -179,14 +179,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
} }
} }
void keyboard_destroy_notify(struct wl_listener *listener, void *data) { static void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy);
wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->destroy.link);
wl_list_remove(&keyboard->key.link); wl_list_remove(&keyboard->key.link);
free(keyboard); free(keyboard);
} }
void new_input_notify(struct wl_listener *listener, void *data) { static void new_input_notify(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data; struct wlr_input_device *device = data;
struct sample_state *sample = wl_container_of(listener, sample, new_input); struct sample_state *sample = wl_container_of(listener, sample, new_input);
switch (device->type) { switch (device->type) {

View File

@ -151,4 +151,9 @@ bool set_drm_connector_gamma(struct wlr_output *output, size_t size,
bool drm_connector_set_mode(struct wlr_output *output, bool drm_connector_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode); struct wlr_output_mode *mode);
bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, struct gbm_bo *bo);
bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, int x, int y);
#endif #endif

View File

@ -34,6 +34,7 @@ add_project_arguments(cc.get_supported_arguments([
'-Wendif-labels', '-Wendif-labels',
'-Wstrict-aliasing=2', '-Wstrict-aliasing=2',
'-Woverflow', '-Woverflow',
'-Wmissing-prototypes',
'-Wno-missing-braces', '-Wno-missing-braces',
'-Wno-missing-field-initializers', '-Wno-missing-field-initializers',

View File

@ -27,7 +27,7 @@ struct wlr_gles2_texture *gles2_get_texture(
return (struct wlr_gles2_texture *)wlr_texture; return (struct wlr_gles2_texture *)wlr_texture;
} }
struct wlr_gles2_texture *get_gles2_texture_in_context( static struct wlr_gles2_texture *get_gles2_texture_in_context(
struct wlr_texture *wlr_texture) { struct wlr_texture *wlr_texture) {
struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture); struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
if (!wlr_egl_is_current(texture->egl)) { if (!wlr_egl_is_current(texture->egl)) {

View File

@ -1,38 +0,0 @@
#include <GLES2/gl2.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wlr/util/log.h>
#include "render/gles2.h"
const char *gles2_strerror(GLenum err) {
switch (err) {
case GL_INVALID_ENUM:
return "Invalid enum";
case GL_INVALID_VALUE:
return "Invalid value";
case GL_INVALID_OPERATION:
return "Invalid operation";
case GL_OUT_OF_MEMORY:
return "Out of memory";
case GL_INVALID_FRAMEBUFFER_OPERATION:
return "Invalid framebuffer operation";
default:
return "Unknown error";
}
}
bool _gles2_flush_errors(const char *file, int line) {
GLenum err;
bool failure = false;
while ((err = glGetError()) != GL_NO_ERROR) {
failure = true;
if (err == GL_OUT_OF_MEMORY) {
// The OpenGL context is now undefined
_wlr_log(WLR_ERROR, "[%s:%d] Fatal GL error: out of memory", file, line);
exit(1);
} else {
_wlr_log(WLR_ERROR, "[%s:%d] GL error %d %s", file, line, err, gles2_strerror(err));
}
}
return failure;
}

View File

@ -17,7 +17,6 @@ lib_wlr_render = static_library(
'gles2/renderer.c', 'gles2/renderer.c',
'gles2/shaders.c', 'gles2/shaders.c',
'gles2/texture.c', 'gles2/texture.c',
'gles2/util.c',
'wlr_renderer.c', 'wlr_renderer.c',
'wlr_texture.c', 'wlr_texture.c',
), ),

View File

@ -244,7 +244,7 @@ static const struct wlr_pointer_grab_interface
.cancel = drag_handle_pointer_cancel, .cancel = drag_handle_pointer_cancel,
}; };
uint32_t drag_handle_touch_down(struct wlr_seat_touch_grab *grab, static uint32_t drag_handle_touch_down(struct wlr_seat_touch_grab *grab,
uint32_t time, struct wlr_touch_point *point) { uint32_t time, struct wlr_touch_point *point) {
// eat the event // eat the event
return 0; return 0;

View File

@ -35,12 +35,12 @@ static void toplevel_handle_send_maximized_event(struct wl_resource *resource,
wlr_signal_emit_safe(&toplevel->events.request_maximize, &event); wlr_signal_emit_safe(&toplevel->events.request_maximize, &event);
} }
void foreign_toplevel_handle_set_maximized(struct wl_client *client, static void foreign_toplevel_handle_set_maximized(struct wl_client *client,
struct wl_resource *resource) { struct wl_resource *resource) {
toplevel_handle_send_maximized_event(resource, true); toplevel_handle_send_maximized_event(resource, true);
} }
void foreign_toplevel_handle_unset_maximized(struct wl_client *client, static void foreign_toplevel_handle_unset_maximized(struct wl_client *client,
struct wl_resource *resource) { struct wl_resource *resource) {
toplevel_handle_send_maximized_event(resource, false); toplevel_handle_send_maximized_event(resource, false);
} }

View File

@ -452,7 +452,7 @@ enum distance_selection_method {
FARTHEST FARTHEST
}; };
struct wlr_output *wlr_output_layout_output_in_direction( static struct wlr_output *wlr_output_layout_output_in_direction(
struct wlr_output_layout *layout, enum wlr_direction direction, struct wlr_output_layout *layout, enum wlr_direction direction,
struct wlr_output *reference, double ref_lx, double ref_ly, struct wlr_output *reference, double ref_lx, double ref_ly,
enum distance_selection_method distance_method) { enum distance_selection_method distance_method) {

View File

@ -477,7 +477,7 @@ static const struct zwlr_screencopy_manager_v1_interface manager_impl = {
.destroy = manager_handle_destroy, .destroy = manager_handle_destroy,
}; };
void manager_handle_resource_destroy(struct wl_resource *resource) { static void manager_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_screencopy_v1_client *client = struct wlr_screencopy_v1_client *client =
client_from_resource(resource); client_from_resource(resource);
client_unref(client); client_unref(client);

View File

@ -138,7 +138,8 @@ void wlr_server_decoration_manager_set_default_mode(
} }
} }
void server_decoration_manager_destroy_resource(struct wl_resource *resource) { static void server_decoration_manager_destroy_resource(
struct wl_resource *resource) {
wl_list_remove(wl_resource_get_link(resource)); wl_list_remove(wl_resource_get_link(resource));
} }

View File

@ -238,7 +238,8 @@ static const struct zxdg_decoration_manager_v1_interface
.get_toplevel_decoration = decoration_manager_handle_get_toplevel_decoration, .get_toplevel_decoration = decoration_manager_handle_get_toplevel_decoration,
}; };
void decoration_manager_handle_resource_destroy(struct wl_resource *resource) { static void decoration_manager_handle_resource_destroy(
struct wl_resource *resource) {
wl_list_remove(wl_resource_get_link(resource)); wl_list_remove(wl_resource_get_link(resource));
} }