Don't use the wlr_ prefix for static functions

This commit is contained in:
emersion 2018-04-25 23:51:00 +01:00
parent 71ca45e2c0
commit 625a7a48dc
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
22 changed files with 306 additions and 302 deletions

View file

@ -15,13 +15,13 @@
#include "backend/drm/drm.h"
#include "util/signal.h"
static bool wlr_drm_backend_start(struct wlr_backend *backend) {
static bool backend_start(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
scan_drm_connectors(drm);
return true;
}
static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
static void backend_destroy(struct wlr_backend *backend) {
if (!backend) {
return;
}
@ -48,16 +48,16 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
free(drm);
}
static struct wlr_renderer *wlr_drm_backend_get_renderer(
static struct wlr_renderer *backend_get_renderer(
struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
return drm->renderer.wlr_rend;
}
static struct wlr_backend_impl backend_impl = {
.start = wlr_drm_backend_start,
.destroy = wlr_drm_backend_destroy,
.get_renderer = wlr_drm_backend_get_renderer,
.start = backend_start,
.destroy = backend_destroy,
.get_renderer = backend_get_renderer,
};
bool wlr_backend_is_drm(struct wlr_backend *b) {
@ -110,7 +110,7 @@ static void drm_invalidated(struct wl_listener *listener, void *data) {
static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_drm_backend *drm =
wl_container_of(listener, drm, display_destroy);
wlr_drm_backend_destroy(&drm->backend);
backend_destroy(&drm->backend);
}
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,

View file

@ -7,23 +7,23 @@
#include "backend/libinput.h"
#include "util/signal.h"
static int wlr_libinput_open_restricted(const char *path,
static int libinput_open_restricted(const char *path,
int flags, void *_backend) {
struct wlr_libinput_backend *backend = _backend;
return wlr_session_open_file(backend->session, path);
}
static void wlr_libinput_close_restricted(int fd, void *_backend) {
static void libinput_close_restricted(int fd, void *_backend) {
struct wlr_libinput_backend *backend = _backend;
wlr_session_close_file(backend->session, fd);
}
static const struct libinput_interface libinput_impl = {
.open_restricted = wlr_libinput_open_restricted,
.close_restricted = wlr_libinput_close_restricted
.open_restricted = libinput_open_restricted,
.close_restricted = libinput_close_restricted
};
static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) {
static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) {
struct wlr_libinput_backend *backend = _backend;
if (libinput_dispatch(backend->libinput_context) != 0) {
wlr_log(L_ERROR, "Failed to dispatch libinput");
@ -38,12 +38,12 @@ static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) {
return 0;
}
static void wlr_libinput_log(struct libinput *libinput_context,
static void log_libinput(struct libinput *libinput_context,
enum libinput_log_priority priority, const char *fmt, va_list args) {
_wlr_vlog(L_ERROR, fmt, args);
}
static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
static bool backend_start(struct wlr_backend *_backend) {
struct wlr_libinput_backend *backend =
(struct wlr_libinput_backend *)_backend;
wlr_log(L_DEBUG, "Initializing libinput");
@ -62,7 +62,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
}
// TODO: More sophisticated logging
libinput_log_set_handler(backend->libinput_context, wlr_libinput_log);
libinput_log_set_handler(backend->libinput_context, log_libinput);
libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR);
int libinput_fd = libinput_get_fd(backend->libinput_context);
@ -73,7 +73,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
}
}
if (!no_devs && backend->wlr_device_lists.length == 0) {
wlr_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
handle_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
if (backend->wlr_device_lists.length == 0) {
wlr_log(L_ERROR, "libinput initialization failed, no input devices");
wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check");
@ -87,7 +87,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
wl_event_source_remove(backend->input_event);
}
backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd,
WL_EVENT_READABLE, wlr_libinput_readable, backend);
WL_EVENT_READABLE, handle_libinput_readable, backend);
if (!backend->input_event) {
wlr_log(L_ERROR, "Failed to create input event on event loop");
return false;
@ -96,7 +96,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
return true;
}
static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
static void backend_destroy(struct wlr_backend *wlr_backend) {
if (!wlr_backend) {
return;
}
@ -125,9 +125,9 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
free(backend);
}
static struct wlr_backend_impl backend_impl = {
.start = wlr_libinput_backend_start,
.destroy = wlr_libinput_backend_destroy
static const struct wlr_backend_impl backend_impl = {
.start = backend_start,
.destroy = backend_destroy,
};
bool wlr_backend_is_libinput(struct wlr_backend *b) {
@ -153,7 +153,7 @@ static void session_signal(struct wl_listener *listener, void *data) {
static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_libinput_backend *backend =
wl_container_of(listener, backend, display_destroy);
wlr_libinput_backend_destroy(&backend->backend);
backend_destroy(&backend->backend);
}
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,

View file

@ -24,7 +24,7 @@ struct wlr_input_device *get_appropriate_device(
return NULL;
}
static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) {
static void input_device_destroy(struct wlr_input_device *_dev) {
struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev;
libinput_device_unref(dev->handle);
wl_list_remove(&dev->wlr_input_device.link);
@ -32,7 +32,7 @@ static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) {
}
static const struct wlr_input_device_impl input_device_impl = {
.destroy = wlr_libinput_device_destroy
.destroy = input_device_destroy,
};
static struct wlr_input_device *allocate_device(

View file

@ -12,20 +12,20 @@ struct wlr_libinput_keyboard {
struct libinput_device *libinput_dev;
};
static void wlr_libinput_keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
static void keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb;
libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds);
}
static void wlr_libinput_keyboard_destroy(struct wlr_keyboard *wlr_kb) {
static void keyboard_destroy(struct wlr_keyboard *wlr_kb) {
struct wlr_libinput_keyboard *wlr_libinput_kb =
(struct wlr_libinput_keyboard *)wlr_kb;
libinput_device_unref(wlr_libinput_kb->libinput_dev);
}
struct wlr_keyboard_impl impl = {
.destroy = wlr_libinput_keyboard_destroy,
.led_update = wlr_libinput_keyboard_set_leds
.destroy = keyboard_destroy,
.led_update = keyboard_set_leds
};
struct wlr_keyboard *create_libinput_keyboard(

View file

@ -39,7 +39,7 @@ static int dispatch_events(int fd, uint32_t mask, void *data) {
* compositor and creates surfaces for each output, then registers globals on
* the specified display.
*/
static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
static bool backend_start(struct wlr_backend *_backend) {
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
wlr_log(L_INFO, "Initializating wayland backend");
@ -65,7 +65,7 @@ static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
return true;
}
static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) {
static void backend_destroy(struct wlr_backend *wlr_backend) {
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
if (backend == NULL) {
return;
@ -110,16 +110,16 @@ static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) {
free(backend);
}
static struct wlr_renderer *wlr_wl_backend_get_renderer(
static struct wlr_renderer *backend_get_renderer(
struct wlr_backend *wlr_backend) {
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
return backend->renderer;
}
static struct wlr_backend_impl backend_impl = {
.start = wlr_wl_backend_start,
.destroy = wlr_wl_backend_destroy,
.get_renderer = wlr_wl_backend_get_renderer,
.start = backend_start,
.destroy = backend_destroy,
.get_renderer = backend_get_renderer,
};
bool wlr_backend_is_wl(struct wlr_backend *b) {
@ -172,7 +172,7 @@ void get_wl_output_layout_box(struct wlr_wl_backend *backend,
static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_wl_backend *backend =
wl_container_of(listener, backend, local_display_destroy);
wlr_wl_backend_destroy(&backend->backend);
backend_destroy(&backend->backend);
}
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char *remote) {

View file

@ -32,7 +32,7 @@ static struct wl_callback_listener frame_listener = {
.done = surface_frame_callback
};
static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output,
static bool output_set_custom_mode(struct wlr_output *_output,
int32_t width, int32_t height, int32_t refresh) {
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
wl_egl_window_resize(output->egl_window, width, height, 0, 0);
@ -40,7 +40,7 @@ static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output,
return true;
}
static bool wlr_wl_output_make_current(struct wlr_output *wlr_output,
static bool output_make_current(struct wlr_output *wlr_output,
int *buffer_age) {
struct wlr_wl_backend_output *output =
(struct wlr_wl_backend_output *)wlr_output;
@ -48,7 +48,7 @@ static bool wlr_wl_output_make_current(struct wlr_output *wlr_output,
buffer_age);
}
static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output,
static bool output_swap_buffers(struct wlr_output *wlr_output,
pixman_region32_t *damage) {
struct wlr_wl_backend_output *output =
(struct wlr_wl_backend_output *)wlr_output;
@ -65,13 +65,13 @@ static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output,
damage);
}
static void wlr_wl_output_transform(struct wlr_output *_output,
static void output_transform(struct wlr_output *_output,
enum wl_output_transform transform) {
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
output->wlr_output.transform = transform;
}
static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
static bool output_set_cursor(struct wlr_output *_output,
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
struct wlr_wl_backend_output *output =
@ -157,7 +157,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
return true;
}
static void wlr_wl_output_destroy(struct wlr_output *wlr_output) {
static void output_destroy(struct wlr_output *wlr_output) {
struct wlr_wl_backend_output *output =
(struct wlr_wl_backend_output *)wlr_output;
if (output == NULL) {
@ -200,19 +200,19 @@ void update_wl_output_cursor(struct wlr_wl_backend_output *output) {
}
}
bool wl_output_move_cursor(struct wlr_output *_output, int x, int y) {
bool output_move_cursor(struct wlr_output *_output, int x, int y) {
// TODO: only return true if x == current x and y == current y
return true;
}
static struct wlr_output_impl output_impl = {
.set_custom_mode = wlr_wl_output_set_custom_mode,
.transform = wlr_wl_output_transform,
.destroy = wlr_wl_output_destroy,
.make_current = wlr_wl_output_make_current,
.swap_buffers = wlr_wl_output_swap_buffers,
.set_cursor = wlr_wl_output_set_cursor,
.move_cursor = wl_output_move_cursor,
static const struct wlr_output_impl output_impl = {
.set_custom_mode = output_set_custom_mode,
.transform = output_transform,
.destroy = output_destroy,
.make_current = output_make_current,
.swap_buffers = output_swap_buffers,
.set_cursor = output_set_cursor,
.move_cursor = output_move_cursor,
};
bool wlr_output_is_wl(struct wlr_output *wlr_output) {

View file

@ -235,7 +235,7 @@ static struct wlr_input_device *allocate_device(struct wlr_wl_backend *backend,
return wlr_device;
}
static void wlr_wl_pointer_handle_output_destroy(struct wl_listener *listener,
static void pointer_handle_output_destroy(struct wl_listener *listener,
void *data) {
struct wlr_wl_pointer *wlr_wl_pointer =
wl_container_of(listener, wlr_wl_pointer, output_destroy_listener);
@ -256,7 +256,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
return;
}
wlr_wl_pointer->output_destroy_listener.notify =
wlr_wl_pointer_handle_output_destroy;
pointer_handle_output_destroy;
struct wlr_input_device *wlr_device;
if (!(wlr_device = allocate_device(backend, WLR_INPUT_DEVICE_POINTER))) {

View file

@ -120,7 +120,7 @@ static int x11_event(int fd, uint32_t mask, void *data) {
return 0;
}
static bool wlr_x11_backend_start(struct wlr_backend *backend) {
static bool backend_start(struct wlr_backend *backend) {
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
x11->started = true;
@ -209,7 +209,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
return true;
}
static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
static void backend_destroy(struct wlr_backend *backend) {
if (!backend) {
return;
}
@ -250,16 +250,16 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
free(x11);
}
static struct wlr_renderer *wlr_x11_backend_get_renderer(
static struct wlr_renderer *backend_get_renderer(
struct wlr_backend *backend) {
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
return x11->renderer;
}
static const struct wlr_backend_impl backend_impl = {
.start = wlr_x11_backend_start,
.destroy = wlr_x11_backend_destroy,
.get_renderer = wlr_x11_backend_get_renderer,
.start = backend_start,
.destroy = backend_destroy,
.get_renderer = backend_get_renderer,
};
bool wlr_backend_is_x11(struct wlr_backend *backend) {
@ -269,7 +269,7 @@ bool wlr_backend_is_x11(struct wlr_backend *backend) {
static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_x11_backend *x11 =
wl_container_of(listener, x11, display_destroy);
wlr_x11_backend_destroy(&x11->backend);
backend_destroy(&x11->backend);
}
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,