From 89ad0b808fd2560a2fab968d71460c23268f3ad3 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Wed, 5 Oct 2022 08:43:56 +0200 Subject: [PATCH] s/wl_list_insert(list.prev...)/wl_list_append(list...)/ --- include/common/graphic-helpers.h | 3 ++- src/action.c | 3 ++- src/config/keybind.c | 3 ++- src/config/mousebind.c | 3 ++- src/config/rcxml.c | 13 +++++++------ src/desktop.c | 14 +++----------- src/layers.c | 3 ++- src/menu/menu.c | 7 ++++--- src/ssd/ssd_part.c | 5 +++-- src/workspaces.c | 5 +++-- src/xwayland-unmanaged.c | 4 ++-- 11 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/common/graphic-helpers.h b/include/common/graphic-helpers.h index 786cb2fd..6ee4d2f6 100644 --- a/include/common/graphic-helpers.h +++ b/include/common/graphic-helpers.h @@ -1,8 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include + struct wlr_scene_tree; struct wlr_scene_rect; -struct wl_listener; struct multi_rect { struct wlr_scene_tree *tree; diff --git a/src/action.c b/src/action.c index 2a4aaeb2..6ead0873 100644 --- a/src/action.c +++ b/src/action.c @@ -6,6 +6,7 @@ #include #include #include +#include "common/list.h" #include "common/mem.h" #include "common/spawn.h" #include "debug.h" @@ -378,5 +379,5 @@ action_arg_add_str(struct action *action, char *key, const char *value) arg->base.key = xstrdup(key); } arg->value = xstrdup(value); - wl_list_insert(action->args.prev, &arg->base.link); + wl_list_append(&action->args, &arg->base.link); } diff --git a/src/config/keybind.c b/src/config/keybind.c index 08b5e9ba..858e0207 100644 --- a/src/config/keybind.c +++ b/src/config/keybind.c @@ -5,6 +5,7 @@ #include #include #include +#include "common/list.h" #include "common/mem.h" #include "config/keybind.h" #include "config/rcxml.h" @@ -60,7 +61,7 @@ keybind_create(const char *keybind) if (!k) { return NULL; } - wl_list_insert(rc.keybinds.prev, &k->link); + wl_list_append(&rc.keybinds, &k->link); k->keysyms = xmalloc(k->keysyms_len * sizeof(xkb_keysym_t)); memcpy(k->keysyms, keysyms, k->keysyms_len * sizeof(xkb_keysym_t)); wl_list_init(&k->actions); diff --git a/src/config/mousebind.c b/src/config/mousebind.c index 1b1d5c74..33e723e3 100644 --- a/src/config/mousebind.c +++ b/src/config/mousebind.c @@ -5,6 +5,7 @@ #include #include #include +#include "common/list.h" #include "common/mem.h" #include "config/mousebind.h" #include "config/rcxml.h" @@ -112,7 +113,7 @@ mousebind_create(const char *context) struct mousebind *m = znew(*m); m->context = context_from_str(context); if (m->context != LAB_SSD_NONE) { - wl_list_insert(rc.mousebinds.prev, &m->link); + wl_list_append(&rc.mousebinds, &m->link); } wl_list_init(&m->actions); return m; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 8cd93537..7664b50d 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -14,6 +14,7 @@ #include #include #include "action.h" +#include "common/list.h" #include "common/mem.h" #include "common/nodename.h" #include "common/string-helpers.h" @@ -67,7 +68,7 @@ fill_keybind(char *nodename, char *content) "nodename: '%s' content: '%s'", nodename, content); } else if (!strcmp(nodename, "name.action")) { current_keybind_action = action_create(content); - wl_list_insert(current_keybind->actions.prev, + wl_list_append(¤t_keybind->actions, ¤t_keybind_action->link); } else if (!current_keybind_action) { wlr_log(WLR_ERROR, "expect element first. " @@ -127,7 +128,7 @@ fill_mousebind(char *nodename, char *content) mousebind_event_from_str(content); } else if (!strcmp(nodename, "name.action")) { current_mousebind_action = action_create(content); - wl_list_insert(current_mousebind->actions.prev, + wl_list_append(¤t_mousebind->actions, ¤t_mousebind_action->link); } else if (!current_mousebind_action) { wlr_log(WLR_ERROR, "expect element first. " @@ -403,7 +404,7 @@ entry(xmlNode *node, char *nodename, char *content) } else if (!strcasecmp(nodename, "name.names.desktops")) { struct workspace *workspace = znew(*workspace); workspace->name = xstrdup(content); - wl_list_insert(rc.workspace_config.workspaces.prev, &workspace->link); + wl_list_append(&rc.workspace_config.workspaces, &workspace->link); } else if (!strcasecmp(nodename, "popupTime.desktops")) { rc.workspace_config.popuptime = atoi(content); } @@ -547,7 +548,7 @@ load_default_key_bindings(void) } action = action_create(key_combos[i].action); - wl_list_insert(k->actions.prev, &action->link); + wl_list_append(&k->actions, &action->link); if (key_combos[i].command) { action_arg_add_str(action, NULL, key_combos[i].command); @@ -617,7 +618,7 @@ load_default_mouse_bindings(void) } action = action_create(current->action); - wl_list_insert(m->actions.prev, &action->link); + wl_list_append(&m->actions, &action->link); if (current->command) { action_arg_add_str(action, NULL, current->command); @@ -685,7 +686,7 @@ post_processing(void) if (!wl_list_length(&rc.workspace_config.workspaces)) { struct workspace *workspace = znew(*workspace); workspace->name = xstrdup("Default"); - wl_list_insert(rc.workspace_config.workspaces.prev, &workspace->link); + wl_list_append(&rc.workspace_config.workspaces, &workspace->link); } if (rc.workspace_config.popuptime == INT_MIN) { rc.workspace_config.popuptime = 1000; diff --git a/src/desktop.c b/src/desktop.c index 5e7e0196..e8fa349b 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -1,11 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only #include "config.h" #include +#include "common/list.h" +#include "common/scene-helpers.h" #include "labwc.h" #include "layers.h" #include "node.h" #include "ssd.h" -#include "common/scene-helpers.h" #include "workspaces.h" static void @@ -68,15 +69,6 @@ desktop_move_to_front(struct view *view) cursor_update_focus(view->server); } -static void -wl_list_insert_tail(struct wl_list *list, struct wl_list *elm) -{ - elm->prev = list->prev; - elm->next = list; - list->prev = elm; - elm->prev->next = elm; -} - void desktop_move_to_back(struct view *view) { @@ -84,7 +76,7 @@ desktop_move_to_back(struct view *view) return; } wl_list_remove(&view->link); - wl_list_insert_tail(&view->server->views, &view->link); + wl_list_append(&view->server->views, &view->link); } void diff --git a/src/layers.c b/src/layers.c index 94a2d7ed..b1145c90 100644 --- a/src/layers.c +++ b/src/layers.c @@ -14,6 +14,7 @@ #include #include #include +#include "common/list.h" #include "common/mem.h" #include "layers.h" #include "labwc.h" @@ -366,7 +367,7 @@ new_layer_surface_notify(struct wl_listener *listener, void *data) return; } - wl_list_insert(output->layers[layer_surface->pending.layer].prev, + wl_list_append(&output->layers[layer_surface->pending.layer], &surface->link); /* * Temporarily set the layer's current state to pending so that diff --git a/src/menu/menu.c b/src/menu/menu.c index 7e09626a..66e06ffc 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -10,17 +10,18 @@ #include #include #include +#include "action.h" #include "common/buf.h" #include "common/font.h" +#include "common/list.h" #include "common/mem.h" #include "common/nodename.h" #include "common/scaled_font_buffer.h" #include "common/string-helpers.h" #include "labwc.h" #include "menu/menu.h" -#include "theme.h" -#include "action.h" #include "node.h" +#include "theme.h" #define MENUWIDTH (110) #define MENU_ITEM_PADDING_Y (4) @@ -225,7 +226,7 @@ fill_item(char *nodename, char *content) */ } else if (!strcmp(nodename, "name.action")) { current_item_action = action_create(content); - wl_list_insert(current_item->actions.prev, ¤t_item_action->link); + wl_list_append(¤t_item->actions, ¤t_item_action->link); } else if (!current_item_action) { wlr_log(WLR_ERROR, "expect element first. " "nodename: '%s' content: '%s'", nodename, content); diff --git a/src/ssd/ssd_part.c b/src/ssd/ssd_part.c index 561c02df..a4e4dd11 100644 --- a/src/ssd/ssd_part.c +++ b/src/ssd/ssd_part.c @@ -1,10 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include "common/list.h" #include "common/mem.h" #include "labwc.h" -#include "ssd.h" #include "node.h" +#include "ssd.h" /* Internal helpers */ static void @@ -41,7 +42,7 @@ add_scene_part(struct wl_list *part_list, enum ssd_part_type type) { struct ssd_part *part = znew(*part); part->type = type; - wl_list_insert(part_list->prev, &part->link); + wl_list_append(part_list, &part->link); return part; } diff --git a/src/workspaces.c b/src/workspaces.c index 71dfabf7..3d6a0b51 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -7,10 +7,11 @@ #include #include #include -#include "labwc.h" #include "common/font.h" #include "common/graphic-helpers.h" +#include "common/list.h" #include "common/mem.h" +#include "labwc.h" #include "workspaces.h" /* Internal helpers */ @@ -157,7 +158,7 @@ add_workspace(struct server *server, const char *name) workspace->server = server; workspace->name = xstrdup(name); workspace->tree = wlr_scene_tree_create(server->view_tree); - wl_list_insert(server->workspaces.prev, &workspace->link); + wl_list_append(&server->workspaces, &workspace->link); if (!server->workspace_current) { server->workspace_current = workspace; } else { diff --git a/src/xwayland-unmanaged.c b/src/xwayland-unmanaged.c index decc3d65..c408858d 100644 --- a/src/xwayland-unmanaged.c +++ b/src/xwayland-unmanaged.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only +#include "common/list.h" #include "common/mem.h" #include "labwc.h" @@ -37,8 +38,7 @@ unmanaged_handle_map(struct wl_listener *listener, void *data) /* Stack new surface on top */ wlr_xwayland_surface_restack(xsurface, NULL, XCB_STACK_MODE_ABOVE); - wl_list_insert(unmanaged->server->unmanaged_surfaces.prev, - &unmanaged->link); + wl_list_append(&unmanaged->server->unmanaged_surfaces, &unmanaged->link); wl_signal_add(&xsurface->events.set_geometry, &unmanaged->set_geometry); unmanaged->set_geometry.notify = unmanaged_handle_set_geometry; -- 2.52.0