Forgot to rename these

This commit is contained in:
Drew DeVault 2017-10-22 10:56:40 -04:00
parent 799f8b95b7
commit c5fff08f8a
13 changed files with 54 additions and 54 deletions

View File

@ -105,9 +105,9 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *_backend) {
wl_signal_emit(&backend->backend.events.input_remove, wlr_dev);
wlr_input_device_destroy(wlr_dev);
}
list_free(wlr_devices);
wlr_list_free(wlr_devices);
}
list_free(backend->wlr_device_lists);
wlr_list_free(backend->wlr_device_lists);
wl_event_source_remove(backend->input_event);
libinput_unref(backend->libinput_context);
free(backend);
@ -148,7 +148,7 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
}
wlr_backend_init(&backend->backend, &backend_impl);
if (!(backend->wlr_device_lists = list_create())) {
if (!(backend->wlr_device_lists = wlr_list_create())) {
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
goto error_backend;
}

View File

@ -145,7 +145,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
if (wl_list_length(wlr_devices) > 0) {
libinput_device_set_user_data(libinput_dev, wlr_devices);
list_add(backend->wlr_device_lists, wlr_devices);
wlr_list_add(backend->wlr_device_lists, wlr_devices);
} else {
free(wlr_devices);
}
@ -177,7 +177,7 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
}
for (size_t i = 0; i < backend->wlr_device_lists->length; i++) {
if (backend->wlr_device_lists->items[i] == wlr_devices) {
list_del(backend->wlr_device_lists, i);
wlr_list_del(backend->wlr_device_lists, i);
break;
}
}

View File

@ -213,7 +213,7 @@ static void handle_touch_up(struct wl_listener *listener, void *data) {
for (size_t i = 0; i < sample->touch_points->length; ++i) {
struct touch_point *point = sample->touch_points->items[i];
if (point->slot == event->slot) {
list_del(sample->touch_points, i);
wlr_list_del(sample->touch_points, i);
break;
}
}
@ -228,7 +228,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
point->slot = event->slot;
point->x = event->x_mm / event->width_mm;
point->y = event->y_mm / event->height_mm;
if (list_add(sample->touch_points, point) == -1) {
if (wlr_list_add(sample->touch_points, point) == -1) {
free(point);
}
@ -270,7 +270,7 @@ int main(int argc, char *argv[]) {
struct sample_state state = {
.default_color = { 0.25f, 0.25f, 0.25f, 1 },
.clear_color = { 0.25f, 0.25f, 0.25f, 1 },
.touch_points = list_create(),
.touch_points = wlr_list_create(),
};
state.config = parse_args(argc, argv);

View File

@ -65,7 +65,7 @@ static void handle_touch_down(struct touch_state *tstate, int32_t slot,
point->slot = slot;
point->x = x / width;
point->y = y / height;
if (list_add(sample->touch_points, point) == -1) {
if (wlr_list_add(sample->touch_points, point) == -1) {
free(point);
}
}
@ -75,7 +75,7 @@ static void handle_touch_up(struct touch_state *tstate, int32_t slot) {
for (size_t i = 0; i < sample->touch_points->length; ++i) {
struct touch_point *point = sample->touch_points->items[i];
if (point->slot == slot) {
list_del(sample->touch_points, i);
wlr_list_del(sample->touch_points, i);
break;
}
}
@ -96,7 +96,7 @@ static void handle_touch_motion(struct touch_state *tstate, int32_t slot,
int main(int argc, char *argv[]) {
struct sample_state state = {
.touch_points = list_create()
.touch_points = wlr_list_create()
};
struct compositor_state compositor = { 0,
.data = &state,

View File

@ -12,48 +12,48 @@ struct wlr_list {
/**
* Creates a new list, may return `NULL` on failure
*/
struct wlr_list *list_create(void);
void list_free(struct wlr_list *list);
void list_foreach(struct wlr_list *list, void (*callback)(void *item));
struct wlr_list *wlr_list_create(void);
void wlr_list_free(struct wlr_list *list);
void wlr_list_foreach(struct wlr_list *list, void (*callback)(void *item));
/**
* Add `item` to the end of a list.
* Returns: new list length or `-1` on failure
*/
int list_add(struct wlr_list *list, void *item);
int wlr_list_add(struct wlr_list *list, void *item);
/**
* Add `item` to the end of a list.
* Returns: new list length or `-1` on failure
*/
int list_push(struct wlr_list *list, void *item);
int wlr_list_push(struct wlr_list *list, void *item);
/**
* Place `item` into index `index` in the list
* Returns: new list length or `-1` on failure
*/
int list_insert(struct wlr_list *list, size_t index, void *item);
int wlr_list_insert(struct wlr_list *list, size_t index, void *item);
/**
* Remove an item from the list
*/
void list_del(struct wlr_list *list, size_t index);
void wlr_list_del(struct wlr_list *list, size_t index);
/**
* Remove and return an item from the end of the list
*/
void *list_pop(struct wlr_list *list);
void *wlr_list_pop(struct wlr_list *list);
/**
* Get a reference to the last item of a list without removal
*/
void *list_peek(struct wlr_list *list);
void *wlr_list_peek(struct wlr_list *list);
/**
* Append each item in `source` to `list`
* Does not modify `source`
* Returns: new list length or `-1` on failure
*/
int list_cat(struct wlr_list *list, struct wlr_list *source);
int wlr_list_cat(struct wlr_list *list, struct wlr_list *source);
// See qsort. Remember to use *_qsort functions as compare functions,
// because they dereference the left and right arguments first!
void list_qsort(struct wlr_list *list, int compare(const void *left, const void *right));
void wlr_list_qsort(struct wlr_list *list, int compare(const void *left, const void *right));
// Return index for first item in list that returns 0 for given compare
// function or -1 if none matches.
int list_seq_find(struct wlr_list *list,
int wlr_list_seq_find(struct wlr_list *list,
int compare(const void *item, const void *cmp_to),
const void *cmp_to);

View File

@ -183,8 +183,8 @@ void set_view_focus(struct roots_input *input, struct roots_desktop *desktop,
}
view_activate(view, true);
// TODO: list_swap
list_del(desktop->views, index);
list_add(desktop->views, view);
wlr_list_del(desktop->views, index);
wlr_list_add(desktop->views, view);
}
static void handle_cursor_motion(struct wl_listener *listener, void *data) {

View File

@ -29,7 +29,7 @@ void view_destroy(struct roots_view *view) {
for (size_t i = 0; i < desktop->views->length; ++i) {
struct roots_view *_view = desktop->views->items[i];
if (view == _view) {
list_del(desktop->views, i);
wlr_list_del(desktop->views, i);
break;
}
}
@ -209,7 +209,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
return NULL;
}
desktop->views = list_create();
desktop->views = wlr_list_create();
if (desktop->views == NULL) {
free(desktop);
return NULL;

View File

@ -110,12 +110,12 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
view->close = close;
view->desktop = desktop;
roots_surface->view = view;
list_add(desktop->views, view);
wlr_list_add(desktop->views, view);
view_initialize(view);
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TRANSIENT) {
// we need to map it relative to the parent
int i = list_seq_find(desktop->views, shell_surface_compare_equals,
int i = wlr_list_seq_find(desktop->views, shell_surface_compare_equals,
surface->parent);
if (i != -1) {
struct roots_view *parent = desktop->views->items[i];

View File

@ -124,7 +124,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
view->close = close;
view->desktop = desktop;
roots_surface->view = view;
list_add(desktop->views, view);
wlr_list_add(desktop->views, view);
view_initialize(view);
}

View File

@ -98,7 +98,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
view->set_position = set_position;
view->close = close;
roots_surface->view = view;
list_add(desktop->views, view);
wlr_list_add(desktop->views, view);
if (!surface->override_redirect) {
view_initialize(view);

View File

@ -14,16 +14,16 @@ bool wlr_data_source_init(struct wlr_data_source *source,
struct wlr_data_source_impl *impl) {
source->impl = impl;
wl_signal_init(&source->events.destroy);
return (source->types = list_create());
return (source->types = wlr_list_create());
}
void wlr_data_source_finish(struct wlr_data_source *source) {
if (source) {
wl_signal_emit(&source->events.destroy, source);
if (source->types) {
list_foreach(source->types, free);
wlr_list_foreach(source->types, free);
}
list_free(source->types);
wlr_list_free(source->types);
}
}
@ -81,7 +81,7 @@ static void data_source_offer(struct wl_client *client,
return;
}
list_add(src->base.types, dtype);
wlr_list_add(src->base.types, dtype);
}
static void data_source_destroy(struct wl_client *client,

View File

@ -5,7 +5,7 @@
#include <stddef.h>
#include <wlr/types/wlr_list.h>
struct wlr_list *list_create(void) {
struct wlr_list *wlr_list_create(void) {
struct wlr_list *list = malloc(sizeof(struct wlr_list));
if (!list) {
return NULL;
@ -32,7 +32,7 @@ static bool list_resize(struct wlr_list *list) {
return true;
}
void list_free(struct wlr_list *list) {
void wlr_list_free(struct wlr_list *list) {
if (list == NULL) {
return;
}
@ -40,7 +40,7 @@ void list_free(struct wlr_list *list) {
free(list);
}
void list_foreach(struct wlr_list *list, void (*callback)(void *item)) {
void wlr_list_foreach(struct wlr_list *list, void (*callback)(void *item)) {
if (list == NULL || callback == NULL) {
return;
}
@ -49,7 +49,7 @@ void list_foreach(struct wlr_list *list, void (*callback)(void *item)) {
}
}
int list_add(struct wlr_list *list, void *item) {
int wlr_list_add(struct wlr_list *list, void *item) {
if (!list_resize(list)) {
return -1;
}
@ -57,11 +57,11 @@ int list_add(struct wlr_list *list, void *item) {
return list->length;
}
int list_push(struct wlr_list *list, void *item) {
return list_add(list, item);
int wlr_list_push(struct wlr_list *list, void *item) {
return wlr_list_add(list, item);
}
int list_insert(struct wlr_list *list, size_t index, void *item) {
int wlr_list_insert(struct wlr_list *list, size_t index, void *item) {
if (!list_resize(list)) {
return -1;
}
@ -71,26 +71,26 @@ int list_insert(struct wlr_list *list, size_t index, void *item) {
return list->length;
}
void list_del(struct wlr_list *list, size_t index) {
void wlr_list_del(struct wlr_list *list, size_t index) {
list->length--;
memmove(&list->items[index], &list->items[index + 1], sizeof(void*) * (list->length - index));
}
void *list_pop(struct wlr_list *list) {
void *wlr_list_pop(struct wlr_list *list) {
void *_ = list->items[list->length - 1];
list_del(list, list->length - 1);
wlr_list_del(list, list->length - 1);
return _;
}
void *list_peek(struct wlr_list *list) {
void *wlr_list_peek(struct wlr_list *list) {
return list->items[list->length - 1];
}
int list_cat(struct wlr_list *list, struct wlr_list *source) {
int wlr_list_cat(struct wlr_list *list, struct wlr_list *source) {
size_t old_len = list->length;
size_t i;
for (i = 0; i < source->length; ++i) {
if (list_add(list, source->items[i]) == -1) {
if (wlr_list_add(list, source->items[i]) == -1) {
list->length = old_len;
return -1;
}
@ -98,11 +98,11 @@ int list_cat(struct wlr_list *list, struct wlr_list *source) {
return list->length;
}
void list_qsort(struct wlr_list *list, int compare(const void *left, const void *right)) {
void wlr_list_qsort(struct wlr_list *list, int compare(const void *left, const void *right)) {
qsort(list->items, list->length, sizeof(void *), compare);
}
int list_seq_find(struct wlr_list *list,
int wlr_list_seq_find(struct wlr_list *list,
int compare(const void *item, const void *data),
const void *data) {
for (size_t i = 0; i < list->length; i++) {

View File

@ -71,7 +71,7 @@ static struct wlr_xwayland_surface *wlr_xwayland_surface_create(
surface->height = height;
surface->override_redirect = override_redirect;
wl_list_insert(&xwm->new_surfaces, &surface->link);
surface->state = list_create();
surface->state = wlr_list_create();
wl_signal_init(&surface->events.destroy);
wl_signal_init(&surface->events.request_configure);
wl_signal_init(&surface->events.set_class);
@ -92,7 +92,7 @@ static void wlr_xwayland_surface_destroy(struct wlr_xwayland_surface *surface) {
free(surface->title);
free(surface->class);
free(surface->instance);
list_free(surface->state);
wlr_list_free(surface->state);
free(surface->window_type);
free(surface->protocols);
free(surface->hints);
@ -199,7 +199,7 @@ static void handle_surface_state(struct wlr_xwm *xwm,
if (action == NET_WM_STATE_REMOVE ||
action == NET_WM_STATE_TOGGLE) {
free(surface->state->items[j]);
list_del(surface->state, j);
wlr_list_del(surface->state, j);
}
break;
}
@ -209,7 +209,7 @@ static void handle_surface_state(struct wlr_xwm *xwm,
action == NET_WM_STATE_TOGGLE)) {
xcb_atom_t *atom_ptr = malloc(sizeof(xcb_atom_t));
*atom_ptr = atom;
list_add(surface->state, atom_ptr);
wlr_list_add(surface->state, atom_ptr);
}
}