]> git.mdlowis.com Git - proto/labwc.git/commitdiff
s/wl_list_insert(list.prev...)/wl_list_append(list...)/
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Wed, 5 Oct 2022 06:43:56 +0000 (08:43 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 5 Oct 2022 18:50:36 +0000 (19:50 +0100)
include/common/graphic-helpers.h
src/action.c
src/config/keybind.c
src/config/mousebind.c
src/config/rcxml.c
src/desktop.c
src/layers.c
src/menu/menu.c
src/ssd/ssd_part.c
src/workspaces.c
src/xwayland-unmanaged.c

index 786cb2fd6912e9f316e7dc10dbd1b9fbae09e031..6ee4d2f6d7563fb45b91da6ca029e79c91ec592b 100644 (file)
@@ -1,8 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <wayland-server-core.h>
+
 struct wlr_scene_tree;
 struct wlr_scene_rect;
-struct wl_listener;
 
 struct multi_rect {
        struct wlr_scene_tree *tree;
index 2a4aaeb2601f697b63bb4caa980a5d4bf0b81714..6ead08735b5527a15d27e5473967af517729d0e4 100644 (file)
@@ -6,6 +6,7 @@
 #include <strings.h>
 #include <unistd.h>
 #include <wlr/util/log.h>
+#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);
 }
index 08b5e9ba899775b2ff1d4455f51bc6fb645a6013..858e02073ecd73daa593cd3c3d1d7bb08afabc3d 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <wlr/util/log.h>
+#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);
index 1b1d5c74d1f1aeb12dd2a6b8d3ed6348d2f74237..33e723e3afe068b34a3d7e158c962081920b1e32 100644 (file)
@@ -5,6 +5,7 @@
 #include <strings.h>
 #include <unistd.h>
 #include <wlr/util/log.h>
+#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;
index 8cd935373983e04e1c89199992ff4cc9bad21701..7664b50dff783925ca0d7dcfe447dd651f0981f1 100644 (file)
@@ -14,6 +14,7 @@
 #include <wayland-server-core.h>
 #include <wlr/util/log.h>
 #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(&current_keybind->actions,
                        &current_keybind_action->link);
        } else if (!current_keybind_action) {
                wlr_log(WLR_ERROR, "expect <action name=\"\"> 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(&current_mousebind->actions,
                        &current_mousebind_action->link);
        } else if (!current_mousebind_action) {
                wlr_log(WLR_ERROR, "expect <action name=\"\"> 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;
index 5e7e0196e14b8373fc179dafe871c205a0260dc8..e8fa349bcf54882367503414f889c1a7ba4d88dc 100644 (file)
@@ -1,11 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0-only
 #include "config.h"
 #include <assert.h>
+#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
index 94a2d7ed7af6d447f4cb8dab90cb1c828a4fa675..b1145c90eb6577927e3f09865ce40cd3e7de091b 100644 (file)
@@ -14,6 +14,7 @@
 #include <wayland-server.h>
 #include <wlr/types/wlr_layer_shell_v1.h>
 #include <wlr/util/log.h>
+#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
index 7e09626a2d49fe6404aa72588dfd7318183ae43b..66e06ffc031fc530520f28cde22e6926dcc49899 100644 (file)
 #include <strings.h>
 #include <wayland-server-core.h>
 #include <wlr/util/log.h>
+#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, &current_item_action->link);
+               wl_list_append(&current_item->actions, &current_item_action->link);
        } else if (!current_item_action) {
                wlr_log(WLR_ERROR, "expect <action name=\"\"> element first. "
                        "nodename: '%s' content: '%s'", nodename, content);
index 561c02dfea037b092ca491b5c4451e5be35a9844..a4e4dd113cd6c8bcb7af3a3a0619c627998728e3 100644 (file)
@@ -1,10 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
 #include <assert.h>
+#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;
 }
 
index 71dfabf706010a7ef10e424c753f3832aa212002..3d6a0b51c78866a3f5cc06f8d8befe8a66f425e6 100644 (file)
@@ -7,10 +7,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
-#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 {
index decc3d65484f20b16acfa50e9074bb1e24bc24d1..c408858d58966e57e3648d014e31b77fd6d86122 100644 (file)
@@ -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;