Fix minor coding-style violations

...based on https://github.com/johanmalm/checkpatch.pl
This commit is contained in:
Johan Malm 2022-09-17 12:31:07 +01:00 committed by Johan Malm
parent 439cf4f848
commit d424514e24
14 changed files with 29 additions and 28 deletions

View file

@ -59,7 +59,6 @@ struct scaled_scene_buffer *scaled_scene_buffer_create(
/* Clear the cache of existing buffers, useful in case the content changes */ /* Clear the cache of existing buffers, useful in case the content changes */
void scaled_scene_buffer_invalidate_cache(struct scaled_scene_buffer *self); void scaled_scene_buffer_invalidate_cache(struct scaled_scene_buffer *self);
/* Private */ /* Private */
struct scaled_scene_buffer_cache_entry { struct scaled_scene_buffer_cache_entry {
struct wl_list link; /* struct scaled_scene_buffer.cache */ struct wl_list link; /* struct scaled_scene_buffer.cache */

View file

@ -17,12 +17,11 @@ struct workspace {
struct wlr_scene_tree *tree; struct wlr_scene_tree *tree;
}; };
void workspaces_init(struct server *server); void workspaces_init(struct server *server);
void workspaces_switch_to(struct workspace *target); void workspaces_switch_to(struct workspace *target);
void workspaces_send_to(struct view *view, struct workspace *target); void workspaces_send_to(struct view *view, struct workspace *target);
void workspaces_destroy(struct server *server); void workspaces_destroy(struct server *server);
void workspaces_osd_hide(struct seat *seat); void workspaces_osd_hide(struct seat *seat);
struct workspace * workspaces_find(struct workspace *anchor, const char *name); struct workspace *workspaces_find(struct workspace *anchor, const char *name);
#endif /* __LABWC_WORKSPACES_H */ #endif /* __LABWC_WORKSPACES_H */

View file

@ -12,17 +12,19 @@ void
increase_nofile_limit(void) increase_nofile_limit(void)
{ {
if (getrlimit(RLIMIT_NOFILE, &original_nofile_rlimit) != 0) { if (getrlimit(RLIMIT_NOFILE, &original_nofile_rlimit) != 0) {
wlr_log_errno(WLR_ERROR, "Failed to bump max open files limit: getrlimit(NOFILE) failed"); wlr_log_errno(WLR_ERROR,
"Failed to bump max open files limit: getrlimit(NOFILE) failed");
return; return;
} }
struct rlimit new_rlimit = original_nofile_rlimit; struct rlimit new_rlimit = original_nofile_rlimit;
new_rlimit.rlim_cur = new_rlimit.rlim_max; new_rlimit.rlim_cur = new_rlimit.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &new_rlimit) != 0) { if (setrlimit(RLIMIT_NOFILE, &new_rlimit) != 0) {
wlr_log_errno(WLR_ERROR, "Failed to bump max open files limit: setrlimit(NOFILE) failed"); wlr_log_errno(WLR_ERROR,
"Failed to bump max open files limit: setrlimit(NOFILE) failed");
wlr_log(WLR_INFO, "Running with %d max open files", wlr_log(WLR_INFO, "Running with %d max open files",
(int)original_nofile_rlimit.rlim_cur); (int)original_nofile_rlimit.rlim_cur);
} }
} }

View file

@ -42,7 +42,6 @@ multi_rect_set_size(struct multi_rect *rect, int width, int height)
int line_width = rect->line_width; int line_width = rect->line_width;
for (size_t i = 0; i < 3; i++) { for (size_t i = 0; i < 3; i++) {
/* Reposition, top and left don't ever change */ /* Reposition, top and left don't ever change */
wlr_scene_node_set_position(&rect->right[i]->node, wlr_scene_node_set_position(&rect->right[i]->node,
width - (i + 1) * line_width, i * line_width); width - (i + 1) * line_width, i * line_width);

View file

@ -112,8 +112,8 @@ _handle_node_destroy(struct wl_listener *listener, void *data)
static void static void
_handle_output_enter(struct wl_listener *listener, void *data) _handle_output_enter(struct wl_listener *listener, void *data)
{ {
struct scaled_scene_buffer *self struct scaled_scene_buffer *self =
= wl_container_of(listener, self, output_enter); wl_container_of(listener, self, output_enter);
/* primary_output is the output most of the node area is in */ /* primary_output is the output most of the node area is in */
struct wlr_scene_output *primary = self->scene_buffer->primary_output; struct wlr_scene_output *primary = self->scene_buffer->primary_output;
/* scene_output is the output we just entered */ /* scene_output is the output we just entered */
@ -132,8 +132,8 @@ _handle_output_enter(struct wl_listener *listener, void *data)
static void static void
_handle_output_leave(struct wl_listener *listener, void *data) _handle_output_leave(struct wl_listener *listener, void *data)
{ {
struct scaled_scene_buffer *self struct scaled_scene_buffer *self =
= wl_container_of(listener, self, output_leave); wl_container_of(listener, self, output_leave);
/* primary_output is the output most of the node area is in */ /* primary_output is the output most of the node area is in */
struct wlr_scene_output *primary = self->scene_buffer->primary_output; struct wlr_scene_output *primary = self->scene_buffer->primary_output;

View file

@ -608,7 +608,6 @@ load_default_mouse_bindings(void)
|| strcmp(current->context, mouse_combos[i - 1].context) || strcmp(current->context, mouse_combos[i - 1].context)
|| strcmp(current->button, mouse_combos[i - 1].button) || strcmp(current->button, mouse_combos[i - 1].button)
|| strcmp(current->event, mouse_combos[i - 1].event)) { || strcmp(current->event, mouse_combos[i - 1].event)) {
/* Create new mousebind */ /* Create new mousebind */
m = mousebind_create(current->context); m = mousebind_create(current->context);
m->button = mousebind_button_from_str(current->button, m->button = mousebind_button_from_str(current->button,
@ -640,7 +639,6 @@ merge_mouse_bindings(void)
if (existing->context == current->context if (existing->context == current->context
&& existing->button == current->button && existing->button == current->button
&& existing->mouse_event == current->mouse_event) { && existing->mouse_event == current->mouse_event) {
wl_list_remove(&existing->link); wl_list_remove(&existing->link);
action_list_free(&existing->actions); action_list_free(&existing->actions);
free(existing); free(existing);

View file

@ -124,10 +124,10 @@ get_special(struct server *server, struct wlr_scene_node *node,
struct wlr_scene_tree *grand_parent = struct wlr_scene_tree *grand_parent =
node->parent ? node->parent->node.parent : NULL; node->parent ? node->parent->node.parent : NULL;
if (grand_parent == server->view_tree) { if (grand_parent == server->view_tree) {
*last_view = node_view_from_node(node); *last_view = node_view_from_node(node);
} }
if (node->parent == server->view_tree_always_on_top) { if (node->parent == server->view_tree_always_on_top) {
*last_view = node_view_from_node(node); *last_view = node_view_from_node(node);
} }
const char *view_part = get_view_part(*last_view, node); const char *view_part = get_view_part(*last_view, node);
if (view_part) { if (view_part) {

View file

@ -225,7 +225,7 @@ desktop_cycle_view(struct server *server, struct view *start_view,
assert(node->parent); assert(node->parent);
struct wl_list *list_head = &node->parent->children; struct wl_list *list_head = &node->parent->children;
struct wl_list *list_item = &node->link; struct wl_list *list_item = &node->link;
struct wl_list *(*iter)(struct wl_list *); struct wl_list *(*iter)(struct wl_list *list);
/* Scene nodes are ordered like last node == displayed topmost */ /* Scene nodes are ordered like last node == displayed topmost */
iter = dir == LAB_CYCLE_DIR_FORWARD ? get_prev_item : get_next_item; iter = dir == LAB_CYCLE_DIR_FORWARD ? get_prev_item : get_next_item;
@ -336,8 +336,12 @@ get_cursor_context(struct server *server)
} }
return ret; return ret;
case LAB_NODE_DESC_SSD_BUTTON: { case LAB_NODE_DESC_SSD_BUTTON: {
/* Always return the top scene node for SSD buttons */ /*
struct ssd_button *button = node_ssd_button_from_node(node); * Always return the top scene node for SSD
* buttons
*/
struct ssd_button *button =
node_ssd_button_from_node(node);
ret.node = node; ret.node = node;
ret.type = button->type; ret.type = button->type;
ret.view = button->view; ret.view = button->view;

View file

@ -24,7 +24,7 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
* If you think there is a good reason to allow it * If you think there is a good reason to allow it
* feel free to open an issue explaining your use-case. * feel free to open an issue explaining your use-case.
*/ */
return; return;
} }
if (mode == LAB_INPUT_STATE_RESIZE if (mode == LAB_INPUT_STATE_RESIZE
&& (view->fullscreen || view->maximized)) { && (view->fullscreen || view->maximized)) {

View file

@ -328,7 +328,8 @@ osd_update(struct server *server)
PangoWeight weight = pango_font_description_get_weight(desc); PangoWeight weight = pango_font_description_get_weight(desc);
pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD); pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
pango_layout_set_font_description(layout, desc); pango_layout_set_font_description(layout, desc);
pango_layout_set_text(layout, server->workspace_current->name, -1); pango_layout_set_text(layout,
server->workspace_current->name, -1);
pango_cairo_show_layout(cairo, layout); pango_cairo_show_layout(cairo, layout);
pango_font_description_set_weight(desc, weight); pango_font_description_set_weight(desc, weight);
pango_layout_set_font_description(layout, desc); pango_layout_set_font_description(layout, desc);

View file

@ -278,7 +278,8 @@ output_config_apply(struct server *server,
/* Only do Layout specific actions if the commit went trough */ /* Only do Layout specific actions if the commit went trough */
if (need_to_add) { if (need_to_add) {
wlr_output_layout_add_auto(server->output_layout, o); wlr_output_layout_add_auto(server->output_layout, o);
output->scene_output = wlr_scene_get_scene_output(server->scene, o); output->scene_output =
wlr_scene_get_scene_output(server->scene, o);
assert(output->scene_output); assert(output->scene_output);
} }
@ -291,7 +292,6 @@ output_config_apply(struct server *server,
wlr_output_layout_remove(server->output_layout, o); wlr_output_layout_remove(server->output_layout, o);
output->scene_output = NULL; output->scene_output = NULL;
} }
} }
server->pending_output_layout_change--; server->pending_output_layout_change--;

View file

@ -158,7 +158,7 @@ handle_drm_lease_request(struct wl_listener *listener, void *data)
return; return;
} }
for(size_t i = 0; i < req->n_connectors; ++i) { for (size_t i = 0; i < req->n_connectors; ++i) {
struct output *output = req->connectors[i]->output->data; struct output *output = req->connectors[i]->output->data;
if (!output) { if (!output) {
continue; continue;
@ -167,7 +167,8 @@ handle_drm_lease_request(struct wl_listener *listener, void *data)
wlr_output_enable(output->wlr_output, false); wlr_output_enable(output->wlr_output, false);
wlr_output_commit(output->wlr_output); wlr_output_commit(output->wlr_output);
wlr_output_layout_remove(output->server->output_layout, output->wlr_output); wlr_output_layout_remove(output->server->output_layout,
output->wlr_output);
output->scene_output = NULL; output->scene_output = NULL;
output->leased = true; output->leased = true;
@ -470,7 +471,6 @@ server_start(struct server *server)
void void
server_finish(struct server *server) server_finish(struct server *server)
{ {
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
wlr_xwayland_destroy(server->xwayland); wlr_xwayland_destroy(server->xwayland);
#endif #endif

View file

@ -304,6 +304,7 @@ set_fallback_geometry(struct view *view)
&view->natural_geometry.x, &view->natural_geometry.x,
&view->natural_geometry.y); &view->natural_geometry.y);
} }
#undef LAB_FALLBACK_WIDTH #undef LAB_FALLBACK_WIDTH
#undef LAB_FALLBACK_HEIGHT #undef LAB_FALLBACK_HEIGHT

View file

@ -49,7 +49,6 @@ parse_workspace_index(const char *name)
static void static void
_osd_update(struct server *server) _osd_update(struct server *server)
{ {
struct theme *theme = server->theme; struct theme *theme = server->theme;
/* Settings */ /* Settings */
@ -138,7 +137,7 @@ _osd_update(struct server *server)
+ (output->usable_area.width - width) / 2 + (output->usable_area.width - width) / 2
+ output_box.x; + output_box.x;
int ly = output->usable_area.y int ly = output->usable_area.y
+ (output->usable_area.height - height ) / 2 + (output->usable_area.height - height) / 2
+ output_box.y; + output_box.y;
wlr_scene_node_set_position(&output->workspace_osd->node, lx, ly); wlr_scene_node_set_position(&output->workspace_osd->node, lx, ly);
wlr_scene_buffer_set_buffer(output->workspace_osd, &buffer->base); wlr_scene_buffer_set_buffer(output->workspace_osd, &buffer->base);
@ -281,7 +280,6 @@ workspaces_send_to(struct view *view, struct workspace *target)
view->workspace = target; view->workspace = target;
} }
void void
workspaces_osd_hide(struct seat *seat) workspaces_osd_hide(struct seat *seat)
{ {