Make implementation function lists static const

This requires a change to the type of `struct wlr_tablet` and
`wlr_tablet_init` signature, both of which are part of the unstable API.
This commit is contained in:
Manuel Stoeckl 2021-02-04 08:57:18 -05:00 committed by Simon Ser
parent b6dea80907
commit a290d7a78d
15 changed files with 31 additions and 31 deletions

View file

@ -87,7 +87,7 @@ static int backend_get_drm_fd(struct wlr_backend *backend) {
}
}
static struct wlr_backend_impl backend_impl = {
static const struct wlr_backend_impl backend_impl = {
.start = backend_start,
.destroy = backend_destroy,
.get_renderer = backend_get_renderer,

View file

@ -13,7 +13,7 @@
#include "backend/libinput.h"
#include "util/signal.h"
static struct wlr_tablet_impl tablet_impl;
static const struct wlr_tablet_impl tablet_impl;
static bool tablet_is_libinput(struct wlr_tablet *tablet) {
return tablet->impl == &tablet_impl;
@ -71,7 +71,7 @@ static void destroy_tablet(struct wlr_tablet *wlr_tablet) {
free(tablet);
}
static struct wlr_tablet_impl tablet_impl = {
static const struct wlr_tablet_impl tablet_impl = {
.destroy = destroy_tablet,
};

View file

@ -110,7 +110,7 @@ static int multi_backend_get_drm_fd(struct wlr_backend *backend) {
return -1;
}
struct wlr_backend_impl backend_impl = {
static const struct wlr_backend_impl backend_impl = {
.start = multi_backend_start,
.destroy = multi_backend_destroy,
.get_renderer = multi_backend_get_renderer,

View file

@ -25,7 +25,7 @@ extern const struct session_impl session_logind;
extern const struct session_impl session_direct;
extern const struct session_impl session_noop;
static const struct session_impl *impls[] = {
static const struct session_impl *const impls[] = {
#if WLR_HAS_LIBSEAT
&session_libseat,
#endif
@ -137,7 +137,7 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) {
env_wlr_session);
}
} else {
const struct session_impl **iter;
const struct session_impl *const *iter;
for (iter = impls; !session && *iter; ++iter) {
session = (*iter)->create(disp);
}

View file

@ -339,7 +339,7 @@ static int backend_get_drm_fd(struct wlr_backend *backend) {
return wl->drm_fd;
}
static struct wlr_backend_impl backend_impl = {
static const struct wlr_backend_impl backend_impl = {
.start = backend_start,
.destroy = backend_destroy,
.get_renderer = backend_get_renderer,

View file

@ -541,7 +541,7 @@ static void xdg_surface_handle_configure(void *data,
// nothing else?
}
static struct xdg_surface_listener xdg_surface_listener = {
static const struct xdg_surface_listener xdg_surface_listener = {
.configure = xdg_surface_handle_configure,
};
@ -566,7 +566,7 @@ static void xdg_toplevel_handle_close(void *data,
wlr_output_destroy(&output->wlr_output);
}
static struct xdg_toplevel_listener xdg_toplevel_listener = {
static const struct xdg_toplevel_listener xdg_toplevel_listener = {
.configure = xdg_toplevel_handle_configure,
.close = xdg_toplevel_handle_close,
};

View file

@ -281,7 +281,7 @@ static void keyboard_handle_repeat_info(void *data,
// This space is intentionally left blank
}
static struct wl_keyboard_listener keyboard_listener = {
static const struct wl_keyboard_listener keyboard_listener = {
.keymap = keyboard_handle_keymap,
.enter = keyboard_handle_enter,
.leave = keyboard_handle_leave,
@ -369,7 +369,7 @@ static void touch_handle_orientation(void *data, struct wl_touch *wl_touch,
// no-op
}
static struct wl_touch_listener touch_listener = {
static const struct wl_touch_listener touch_listener = {
.down = touch_handle_down,
.up = touch_handle_up,
.motion = touch_handle_motion,
@ -441,7 +441,7 @@ static void input_device_destroy(struct wlr_input_device *wlr_dev) {
free(dev);
}
static struct wlr_input_device_impl input_device_impl = {
static const struct wlr_input_device_impl input_device_impl = {
.destroy = input_device_destroy,
};
@ -474,7 +474,7 @@ struct wlr_wl_input_device *create_wl_input_device(
return dev;
}
static struct wlr_pointer_impl pointer_impl;
static const struct wlr_pointer_impl pointer_impl;
struct wlr_wl_pointer *pointer_get_wl(struct wlr_pointer *wlr_pointer) {
assert(wlr_pointer->impl == &pointer_impl);
@ -497,7 +497,7 @@ static void pointer_destroy(struct wlr_pointer *wlr_pointer) {
free(pointer);
}
static struct wlr_pointer_impl pointer_impl = {
static const struct wlr_pointer_impl pointer_impl = {
.destroy = pointer_destroy,
};
@ -544,7 +544,7 @@ static void gesture_swipe_end(void *data,
wlr_signal_emit_safe(&wlr_dev->pointer->events.swipe_end, &wlr_event);
}
static struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_impl = {
static const struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_impl = {
.begin = gesture_swipe_begin,
.update = gesture_swipe_update,
.end = gesture_swipe_end,
@ -595,7 +595,7 @@ static void gesture_pinch_end(void *data,
wlr_signal_emit_safe(&wlr_dev->pointer->events.pinch_end, &wlr_event);
}
static struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_impl = {
static const struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_impl = {
.begin = gesture_pinch_begin,
.update = gesture_pinch_update,
.end = gesture_pinch_end,