mirror of
https://github.com/labwc/labwc.git
synced 2026-02-26 01:40:22 -05:00
Fix coding style
This commit is contained in:
parent
6a242d5739
commit
e45e2c7e60
16 changed files with 28 additions and 22 deletions
|
|
@ -7,9 +7,11 @@ struct server;
|
||||||
struct wl_list;
|
struct wl_list;
|
||||||
|
|
||||||
struct action {
|
struct action {
|
||||||
struct wl_list link; /* struct keybinding.actions,
|
struct wl_list link; /*
|
||||||
* struct mousebinding.actions,
|
* struct keybinding.actions
|
||||||
* struct menuitem.actions */
|
* struct mousebinding.actions
|
||||||
|
* struct menuitem.actions
|
||||||
|
*/
|
||||||
|
|
||||||
uint32_t type; /* enum action_type */
|
uint32_t type; /* enum action_type */
|
||||||
struct wl_list args; /* struct action_arg.link */
|
struct wl_list args; /* struct action_arg.link */
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ char *xstrdup(const char *str);
|
||||||
* Does nothing if <ptr> is already NULL.
|
* Does nothing if <ptr> is already NULL.
|
||||||
*/
|
*/
|
||||||
#define zfree(ptr) do { \
|
#define zfree(ptr) do { \
|
||||||
free(ptr); (ptr) = NULL; \
|
free(ptr); (ptr) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* __LABWC_MEM_H */
|
#endif /* __LABWC_MEM_H */
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@ struct wl_list;
|
||||||
|
|
||||||
/* Double use: as config in config/rcxml.c and as instance in workspaces.c */
|
/* Double use: as config in config/rcxml.c and as instance in workspaces.c */
|
||||||
struct workspace {
|
struct workspace {
|
||||||
struct wl_list link; /* struct server.workspaces
|
struct wl_list link; /*
|
||||||
struct rcxml.workspace_config.workspaces */
|
* struct server.workspaces
|
||||||
|
* struct rcxml.workspace_config.workspaces
|
||||||
|
*/
|
||||||
struct server *server;
|
struct server *server;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ restore_nofile_limit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setrlimit(RLIMIT_NOFILE, &original_nofile_rlimit) != 0) {
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ draw_cairo_border(cairo_t *cairo, double width, double height, double line_width
|
||||||
|
|
||||||
double x, y, w, h;
|
double x, y, w, h;
|
||||||
/* The anchor point of a line is in the center */
|
/* 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;
|
w = width - line_width;
|
||||||
h = height - line_width;
|
h = height - line_width;
|
||||||
cairo_set_line_width(cairo, line_width);
|
cairo_set_line_width(cairo, line_width);
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ scaled_font_buffer_create(struct wlr_scene_tree *parent)
|
||||||
{
|
{
|
||||||
assert(parent);
|
assert(parent);
|
||||||
struct scaled_font_buffer *self = znew(*self);
|
struct scaled_font_buffer *self = znew(*self);
|
||||||
struct scaled_scene_buffer *scaled_buffer
|
struct scaled_scene_buffer *scaled_buffer =
|
||||||
= scaled_scene_buffer_create(parent, &impl);
|
scaled_scene_buffer_create(parent, &impl);
|
||||||
if (!scaled_buffer) {
|
if (!scaled_buffer) {
|
||||||
free(self);
|
free(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@
|
||||||
#include "resistance.h"
|
#include "resistance.h"
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
|
|
||||||
static const char **cursor_names = NULL;
|
static const char * const *cursor_names = NULL;
|
||||||
|
|
||||||
/* Usual cursor names */
|
/* Usual cursor names */
|
||||||
static const char *cursors_xdg[] = {
|
static const char * const cursors_xdg[] = {
|
||||||
NULL,
|
NULL,
|
||||||
"default",
|
"default",
|
||||||
"grab",
|
"grab",
|
||||||
|
|
@ -33,7 +33,7 @@ static const char *cursors_xdg[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* XCursor fallbacks */
|
/* XCursor fallbacks */
|
||||||
static const char *cursors_x11[] = {
|
static const char * const cursors_x11[] = {
|
||||||
NULL,
|
NULL,
|
||||||
"left_ptr",
|
"left_ptr",
|
||||||
"grabbing",
|
"grabbing",
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ desktop_focused_view(struct server *server)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each (view, &server->views, link) {
|
wl_list_for_each(view, &server->views, link) {
|
||||||
if (view->surface == focused_surface) {
|
if (view->surface == focused_surface) {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ static bool
|
||||||
handle_keybinding(struct server *server, uint32_t modifiers, xkb_keysym_t sym)
|
handle_keybinding(struct server *server, uint32_t modifiers, xkb_keysym_t sym)
|
||||||
{
|
{
|
||||||
struct keybind *keybind;
|
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) {
|
if (modifiers ^ keybind->modifiers) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ layers_arrange(struct output *output)
|
||||||
/ sizeof(layers_above_shell[0]);
|
/ sizeof(layers_above_shell[0]);
|
||||||
struct lab_layer_surface *layer, *topmost = NULL;
|
struct lab_layer_surface *layer, *topmost = NULL;
|
||||||
for (size_t i = 0; i < nlayers; ++i) {
|
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) {
|
&output->layers[layers_above_shell[i]], link) {
|
||||||
struct wlr_layer_surface_v1 *layer_surface =
|
struct wlr_layer_surface_v1 *layer_surface =
|
||||||
layer->scene_layer_surface->layer_surface;
|
layer->scene_layer_surface->layer_surface;
|
||||||
|
|
|
||||||
|
|
@ -684,7 +684,7 @@ static void
|
||||||
close_all_submenus(struct menu *menu)
|
close_all_submenus(struct menu *menu)
|
||||||
{
|
{
|
||||||
struct menuitem *item;
|
struct menuitem *item;
|
||||||
wl_list_for_each (item, &menu->menuitems, link) {
|
wl_list_for_each(item, &menu->menuitems, link) {
|
||||||
if (item->submenu) {
|
if (item->submenu) {
|
||||||
wlr_scene_node_set_enabled(
|
wlr_scene_node_set_enabled(
|
||||||
&item->submenu->scene_tree->node, false);
|
&item->submenu->scene_tree->node, false);
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ struct output *
|
||||||
output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
|
output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
|
||||||
{
|
{
|
||||||
struct output *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) {
|
if (output->wlr_output == wlr_output) {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ reload_config_and_theme(void)
|
||||||
theme_init(g_server->theme, rc.theme_name);
|
theme_init(g_server->theme, rc.theme_name);
|
||||||
|
|
||||||
struct view *view;
|
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) {
|
if (!view->mapped || !view->ssd.enabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ static struct view *
|
||||||
parent_of(struct view *view)
|
parent_of(struct view *view)
|
||||||
{
|
{
|
||||||
struct view *p;
|
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
|
if (p->xdg_surface->toplevel
|
||||||
== view->xdg_surface->toplevel->parent) {
|
== view->xdg_surface->toplevel->parent) {
|
||||||
return p;
|
return p;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ focus_next_surface(struct server *server, struct wlr_xwayland_surface *xsurface)
|
||||||
/* Try to focus on last created unmanaged xwayland surface */
|
/* Try to focus on last created unmanaged xwayland surface */
|
||||||
struct xwayland_unmanaged *u;
|
struct xwayland_unmanaged *u;
|
||||||
struct wl_list *list = &server->unmanaged_surfaces;
|
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;
|
struct wlr_xwayland_surface *prev = u->xwayland_surface;
|
||||||
if (wlr_xwayland_or_surface_wants_focus(prev)) {
|
if (wlr_xwayland_or_surface_wants_focus(prev)) {
|
||||||
seat_focus_surface(&server->seat, prev->surface);
|
seat_focus_surface(&server->seat, prev->surface);
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ set_activated(struct view *view, bool activated)
|
||||||
/* Restack unmanaged surfaces on top */
|
/* Restack unmanaged surfaces on top */
|
||||||
struct xwayland_unmanaged *u;
|
struct xwayland_unmanaged *u;
|
||||||
struct wl_list *list = &view->server->unmanaged_surfaces;
|
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,
|
wlr_xwayland_surface_restack(u->xwayland_surface, NULL,
|
||||||
XCB_STACK_MODE_ABOVE);
|
XCB_STACK_MODE_ABOVE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue