From e45e2c7e60b84e424b8bb2c9767de23533052e59 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 3 Nov 2022 19:58:21 +0000 Subject: [PATCH] Fix coding style --- include/action.h | 8 +++++--- include/common/mem.h | 2 +- include/workspaces.h | 6 ++++-- src/common/fd_util.c | 3 ++- src/common/graphic-helpers.c | 3 ++- src/common/scaled_font_buffer.c | 4 ++-- src/cursor.c | 6 +++--- src/desktop.c | 2 +- src/keyboard.c | 2 +- src/layers.c | 2 +- src/menu/menu.c | 2 +- src/output.c | 2 +- src/server.c | 2 +- src/xdg.c | 2 +- src/xwayland-unmanaged.c | 2 +- src/xwayland.c | 2 +- 16 files changed, 28 insertions(+), 22 deletions(-) diff --git a/include/action.h b/include/action.h index e5506033..126e5b54 100644 --- a/include/action.h +++ b/include/action.h @@ -7,9 +7,11 @@ struct server; struct wl_list; struct action { - struct wl_list link; /* struct keybinding.actions, - * struct mousebinding.actions, - * struct menuitem.actions */ + struct wl_list link; /* + * struct keybinding.actions + * struct mousebinding.actions + * struct menuitem.actions + */ uint32_t type; /* enum action_type */ struct wl_list args; /* struct action_arg.link */ diff --git a/include/common/mem.h b/include/common/mem.h index a38f7fde..fa9607d6 100644 --- a/include/common/mem.h +++ b/include/common/mem.h @@ -49,7 +49,7 @@ char *xstrdup(const char *str); * Does nothing if is already NULL. */ #define zfree(ptr) do { \ - free(ptr); (ptr) = NULL; \ + free(ptr); (ptr) = NULL; \ } while (0) #endif /* __LABWC_MEM_H */ diff --git a/include/workspaces.h b/include/workspaces.h index 8f77339b..53dc4da3 100644 --- a/include/workspaces.h +++ b/include/workspaces.h @@ -9,8 +9,10 @@ struct wl_list; /* Double use: as config in config/rcxml.c and as instance in workspaces.c */ struct workspace { - struct wl_list link; /* struct server.workspaces - struct rcxml.workspace_config.workspaces */ + struct wl_list link; /* + * struct server.workspaces + * struct rcxml.workspace_config.workspaces + */ struct server *server; char *name; diff --git a/src/common/fd_util.c b/src/common/fd_util.c index e935f02c..d4f92561 100644 --- a/src/common/fd_util.c +++ b/src/common/fd_util.c @@ -36,6 +36,7 @@ restore_nofile_limit(void) } if (setrlimit(RLIMIT_NOFILE, &original_nofile_rlimit) != 0) { - wlr_log_errno(WLR_ERROR, "Failed to restore max open files limit: setrlimit(NOFILE) failed"); + wlr_log_errno(WLR_ERROR, + "Failed to restore max open files limit: setrlimit(NOFILE) failed"); } } diff --git a/src/common/graphic-helpers.c b/src/common/graphic-helpers.c index a42502b3..add14a91 100644 --- a/src/common/graphic-helpers.c +++ b/src/common/graphic-helpers.c @@ -68,7 +68,8 @@ draw_cairo_border(cairo_t *cairo, double width, double height, double line_width double x, y, w, h; /* The anchor point of a line is in the center */ - x = y = line_width / 2; + x = line_width / 2; + y = x; w = width - line_width; h = height - line_width; cairo_set_line_width(cairo, line_width); diff --git a/src/common/scaled_font_buffer.c b/src/common/scaled_font_buffer.c index 61c98ff2..ec4c6161 100644 --- a/src/common/scaled_font_buffer.c +++ b/src/common/scaled_font_buffer.c @@ -47,8 +47,8 @@ scaled_font_buffer_create(struct wlr_scene_tree *parent) { assert(parent); struct scaled_font_buffer *self = znew(*self); - struct scaled_scene_buffer *scaled_buffer - = scaled_scene_buffer_create(parent, &impl); + struct scaled_scene_buffer *scaled_buffer = + scaled_scene_buffer_create(parent, &impl); if (!scaled_buffer) { free(self); return NULL; diff --git a/src/cursor.c b/src/cursor.c index 57952cb3..db394046 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -15,10 +15,10 @@ #include "resistance.h" #include "ssd.h" -static const char **cursor_names = NULL; +static const char * const *cursor_names = NULL; /* Usual cursor names */ -static const char *cursors_xdg[] = { +static const char * const cursors_xdg[] = { NULL, "default", "grab", @@ -33,7 +33,7 @@ static const char *cursors_xdg[] = { }; /* XCursor fallbacks */ -static const char *cursors_x11[] = { +static const char * const cursors_x11[] = { NULL, "left_ptr", "grabbing", diff --git a/src/desktop.c b/src/desktop.c index aaa719d1..52054fbd 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -273,7 +273,7 @@ desktop_focused_view(struct server *server) return NULL; } struct view *view; - wl_list_for_each (view, &server->views, link) { + wl_list_for_each(view, &server->views, link) { if (view->surface == focused_surface) { return view; } diff --git a/src/keyboard.c b/src/keyboard.c index 63bc7016..373bf2b5 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -77,7 +77,7 @@ static bool handle_keybinding(struct server *server, uint32_t modifiers, xkb_keysym_t sym) { struct keybind *keybind; - wl_list_for_each_reverse (keybind, &rc.keybinds, link) { + wl_list_for_each_reverse(keybind, &rc.keybinds, link) { if (modifiers ^ keybind->modifiers) { continue; } diff --git a/src/layers.c b/src/layers.c index b1145c90..7bd12f13 100644 --- a/src/layers.c +++ b/src/layers.c @@ -80,7 +80,7 @@ layers_arrange(struct output *output) / sizeof(layers_above_shell[0]); struct lab_layer_surface *layer, *topmost = NULL; for (size_t i = 0; i < nlayers; ++i) { - wl_list_for_each_reverse (layer, + wl_list_for_each_reverse(layer, &output->layers[layers_above_shell[i]], link) { struct wlr_layer_surface_v1 *layer_surface = layer->scene_layer_surface->layer_surface; diff --git a/src/menu/menu.c b/src/menu/menu.c index 0721a552..d0ad02c6 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -684,7 +684,7 @@ static void close_all_submenus(struct menu *menu) { struct menuitem *item; - wl_list_for_each (item, &menu->menuitems, link) { + wl_list_for_each(item, &menu->menuitems, link) { if (item->submenu) { wlr_scene_node_set_enabled( &item->submenu->scene_tree->node, false); diff --git a/src/output.c b/src/output.c index b1723daa..d61518b0 100644 --- a/src/output.c +++ b/src/output.c @@ -417,7 +417,7 @@ struct output * output_from_wlr_output(struct server *server, struct wlr_output *wlr_output) { struct output *output; - wl_list_for_each (output, &server->outputs, link) { + wl_list_for_each(output, &server->outputs, link) { if (output->wlr_output == wlr_output) { return output; } diff --git a/src/server.c b/src/server.c index db542865..7195d7d5 100644 --- a/src/server.c +++ b/src/server.c @@ -38,7 +38,7 @@ reload_config_and_theme(void) theme_init(g_server->theme, rc.theme_name); struct view *view; - wl_list_for_each (view, &g_server->views, link) { + wl_list_for_each(view, &g_server->views, link) { if (!view->mapped || !view->ssd.enabled) { continue; } diff --git a/src/xdg.c b/src/xdg.c index a055ca9b..487a7b69 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -240,7 +240,7 @@ static struct view * parent_of(struct view *view) { struct view *p; - wl_list_for_each (p, &view->server->views, link) { + wl_list_for_each(p, &view->server->views, link) { if (p->xdg_surface->toplevel == view->xdg_surface->toplevel->parent) { return p; diff --git a/src/xwayland-unmanaged.c b/src/xwayland-unmanaged.c index 5979ba20..5a6fb12a 100644 --- a/src/xwayland-unmanaged.c +++ b/src/xwayland-unmanaged.c @@ -73,7 +73,7 @@ focus_next_surface(struct server *server, struct wlr_xwayland_surface *xsurface) /* Try to focus on last created unmanaged xwayland surface */ struct xwayland_unmanaged *u; struct wl_list *list = &server->unmanaged_surfaces; - wl_list_for_each_reverse (u, list, link) { + wl_list_for_each_reverse(u, list, link) { struct wlr_xwayland_surface *prev = u->xwayland_surface; if (wlr_xwayland_or_surface_wants_focus(prev)) { seat_focus_surface(&server->seat, prev->surface); diff --git a/src/xwayland.c b/src/xwayland.c index baa26477..4dc33444 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -442,7 +442,7 @@ set_activated(struct view *view, bool activated) /* Restack unmanaged surfaces on top */ struct xwayland_unmanaged *u; struct wl_list *list = &view->server->unmanaged_surfaces; - wl_list_for_each (u, list, link) { + wl_list_for_each(u, list, link) { wlr_xwayland_surface_restack(u->xwayland_surface, NULL, XCB_STACK_MODE_ABOVE); } -- 2.52.0