CodeStyle: prevent space in code indents

This commit is contained in:
Consolatis 2023-01-31 11:43:45 +01:00 committed by Johan Malm
parent a3fff9f87b
commit 1995a33df9
12 changed files with 76 additions and 67 deletions

View file

@ -401,8 +401,7 @@ void seat_set_pressed(struct seat *seat, struct view *view,
struct wlr_surface *toplevel, uint32_t resize_edges); struct wlr_surface *toplevel, uint32_t resize_edges);
void seat_reset_pressed(struct seat *seat); void seat_reset_pressed(struct seat *seat);
void interactive_begin(struct view *view, enum input_mode mode, void interactive_begin(struct view *view, enum input_mode mode, uint32_t edges);
uint32_t edges);
void interactive_finish(struct view *view); void interactive_finish(struct view *view);
void interactive_cancel(struct view *view); void interactive_cancel(struct view *view);

View file

@ -3738,6 +3738,14 @@ sub process {
# check we are in a valid source file C or perl if not then ignore this hunk # check we are in a valid source file C or perl if not then ignore this hunk
next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/); next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/);
# at the beginning of a line in a .c file there should be no
# spaces unless it is a single space in front of a multiline comment
if ($realfile =~ /\.c$/ && $rawline =~ /^\+\t* [^*]/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
WARN("CODE_INDENT",
"code indent should never contain spaces\n" . $herevet);
}
# at the beginning of a line any tabs must come first and anything # at the beginning of a line any tabs must come first and anything
# more than $tabsize must use tabs. # more than $tabsize must use tabs.
if ($rawline =~ /^\+\s* \t\s*\S/ || if ($rawline =~ /^\+\s* \t\s*\S/ ||

View file

@ -122,10 +122,12 @@ config_dir(void)
if (buf[0] != '\0') { if (buf[0] != '\0') {
return buf; return buf;
} }
struct ctx ctx = { .build_path_fn = build_config_path, struct ctx ctx = {
.build_path_fn = build_config_path,
.buf = buf, .buf = buf,
.len = sizeof(buf), .len = sizeof(buf),
.dirs = config_dirs }; .dirs = config_dirs
};
return find_dir(&ctx); return find_dir(&ctx);
} }
@ -133,10 +135,12 @@ char *
theme_dir(const char *theme_name) theme_dir(const char *theme_name)
{ {
static char buf[4096] = { 0 }; static char buf[4096] = { 0 };
struct ctx ctx = { .build_path_fn = build_theme_path, struct ctx ctx = {
.build_path_fn = build_theme_path,
.buf = buf, .buf = buf,
.len = sizeof(buf), .len = sizeof(buf),
.dirs = theme_dirs, .dirs = theme_dirs,
.theme_name = theme_name }; .theme_name = theme_name
};
return find_dir(&ctx); return find_dir(&ctx);
} }

View file

@ -27,9 +27,8 @@ keyboard_any_modifiers_pressed(struct wlr_keyboard *keyboard)
{ {
xkb_mod_index_t i; xkb_mod_index_t i;
for (i = 0; i < xkb_keymap_num_mods(keyboard->keymap); i++) { for (i = 0; i < xkb_keymap_num_mods(keyboard->keymap); i++) {
if (xkb_state_mod_index_is_active if (xkb_state_mod_index_is_active(keyboard->xkb_state,
(keyboard->xkb_state, i, i, XKB_STATE_MODS_DEPRESSED)) {
XKB_STATE_MODS_DEPRESSED)) {
return true; return true;
} }
} }
@ -99,14 +98,14 @@ handle_keybinding(struct server *server, uint32_t modifiers, xkb_keysym_t sym)
static bool is_modifier_key(xkb_keysym_t sym) static bool is_modifier_key(xkb_keysym_t sym)
{ {
return sym == XKB_KEY_Shift_L || return sym == XKB_KEY_Shift_L
sym == XKB_KEY_Shift_R || || sym == XKB_KEY_Shift_R
sym == XKB_KEY_Alt_L || || sym == XKB_KEY_Alt_L
sym == XKB_KEY_Alt_R || || sym == XKB_KEY_Alt_R
sym == XKB_KEY_Control_L || || sym == XKB_KEY_Control_L
sym == XKB_KEY_Control_R || || sym == XKB_KEY_Control_R
sym == XKB_KEY_Super_L || || sym == XKB_KEY_Super_L
sym == XKB_KEY_Super_R; || sym == XKB_KEY_Super_R;
} }
static bool static bool

View file

@ -76,15 +76,14 @@ seat_inhibit_input(struct seat *seat, struct wl_client *active_client)
{ {
seat->active_client_while_inhibited = active_client; seat->active_client_while_inhibited = active_client;
if (seat->focused_layer && if (seat->focused_layer && active_client !=
(wl_resource_get_client(seat->focused_layer->resource) != wl_resource_get_client(seat->focused_layer->resource)) {
active_client)) {
seat_set_focus_layer(seat, NULL); seat_set_focus_layer(seat, NULL);
} }
struct wlr_surface *previous_kb_surface = struct wlr_surface *previous_kb_surface =
seat->seat->keyboard_state.focused_surface; seat->seat->keyboard_state.focused_surface;
if (previous_kb_surface && if (previous_kb_surface && active_client !=
wl_resource_get_client(previous_kb_surface->resource) != active_client) { wl_resource_get_client(previous_kb_surface->resource)) {
seat_focus_surface(seat, NULL); /* keyboard focus */ seat_focus_surface(seat, NULL); /* keyboard focus */
} }
@ -327,9 +326,9 @@ server_init(struct server *server)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
wlr_server_decoration_manager_set_default_mode( wlr_server_decoration_manager_set_default_mode(
deco_mgr, rc.xdg_shell_server_side_deco ? deco_mgr, rc.xdg_shell_server_side_deco
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER : ? WLR_SERVER_DECORATION_MANAGER_MODE_SERVER
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT); : WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT);
struct wlr_presentation *presentation = struct wlr_presentation *presentation =
wlr_presentation_create(server->wl_display, server->backend); wlr_presentation_create(server->wl_display, server->backend);

View file

@ -28,8 +28,8 @@ static char *
xbm_path(const char *button) xbm_path(const char *button)
{ {
static char buffer[4096] = { 0 }; static char buffer[4096] = { 0 };
snprintf(buffer, sizeof(buffer), "%s/%s", theme_dir(rc.theme_name), snprintf(buffer, sizeof(buffer), "%s/%s",
button); theme_dir(rc.theme_name), button);
return buffer; return buffer;
} }
@ -65,28 +65,28 @@ void
xbm_load(struct theme *theme) xbm_load(struct theme *theme)
{ {
parse_set_color(theme->window_active_button_menu_unpressed_image_color); parse_set_color(theme->window_active_button_menu_unpressed_image_color);
load_button("menu.xbm", &theme->xbm_menu_active_unpressed, load_button("menu.xbm",
menu_button_normal); &theme->xbm_menu_active_unpressed, menu_button_normal);
parse_set_color(theme->window_active_button_iconify_unpressed_image_color); parse_set_color(theme->window_active_button_iconify_unpressed_image_color);
load_button("iconify.xbm", &theme->xbm_iconify_active_unpressed, load_button("iconify.xbm",
iconify_button_normal); &theme->xbm_iconify_active_unpressed, iconify_button_normal);
parse_set_color(theme->window_active_button_max_unpressed_image_color); parse_set_color(theme->window_active_button_max_unpressed_image_color);
load_button("max.xbm", &theme->xbm_maximize_active_unpressed, load_button("max.xbm",
max_button_normal); &theme->xbm_maximize_active_unpressed, max_button_normal);
parse_set_color(theme->window_active_button_close_unpressed_image_color); parse_set_color(theme->window_active_button_close_unpressed_image_color);
load_button("close.xbm", &theme->xbm_close_active_unpressed, load_button("close.xbm",
close_button_normal); &theme->xbm_close_active_unpressed, close_button_normal);
parse_set_color(theme->window_inactive_button_menu_unpressed_image_color); parse_set_color(theme->window_inactive_button_menu_unpressed_image_color);
load_button("menu.xbm", &theme->xbm_menu_inactive_unpressed, load_button("menu.xbm",
menu_button_normal); &theme->xbm_menu_inactive_unpressed, menu_button_normal);
parse_set_color(theme->window_inactive_button_iconify_unpressed_image_color); parse_set_color(theme->window_inactive_button_iconify_unpressed_image_color);
load_button("iconify.xbm", &theme->xbm_iconify_inactive_unpressed, load_button("iconify.xbm",
iconify_button_normal); &theme->xbm_iconify_inactive_unpressed, iconify_button_normal);
parse_set_color(theme->window_inactive_button_max_unpressed_image_color); parse_set_color(theme->window_inactive_button_max_unpressed_image_color);
load_button("max.xbm", &theme->xbm_maximize_inactive_unpressed, load_button("max.xbm",
max_button_normal); &theme->xbm_maximize_inactive_unpressed, max_button_normal);
parse_set_color(theme->window_inactive_button_close_unpressed_image_color); parse_set_color(theme->window_inactive_button_close_unpressed_image_color);
load_button("close.xbm", &theme->xbm_close_inactive_unpressed, load_button("close.xbm",
close_button_normal); &theme->xbm_close_inactive_unpressed, close_button_normal);
} }

View file

@ -418,8 +418,8 @@ set_initial_position(struct view *view,
{ {
/* Don't center views with position explicitly specified */ /* Don't center views with position explicitly specified */
bool has_position = xwayland_surface->size_hints && bool has_position = xwayland_surface->size_hints &&
(xwayland_surface->size_hints->flags & (xwayland_surface->size_hints->flags & (
(XCB_ICCCM_SIZE_HINT_US_POSITION | XCB_ICCCM_SIZE_HINT_US_POSITION |
XCB_ICCCM_SIZE_HINT_P_POSITION)); XCB_ICCCM_SIZE_HINT_P_POSITION));
if (has_position) { if (has_position) {
@ -693,8 +693,8 @@ xwayland_server_init(struct server *server, struct wlr_compositor *compositor)
} }
struct wlr_xcursor *xcursor; struct wlr_xcursor *xcursor;
xcursor = wlr_xcursor_manager_get_xcursor(server->seat.xcursor_manager, xcursor = wlr_xcursor_manager_get_xcursor(
XCURSOR_DEFAULT, 1); server->seat.xcursor_manager, XCURSOR_DEFAULT, 1);
if (xcursor) { if (xcursor) {
struct wlr_xcursor_image *image = xcursor->images[0]; struct wlr_xcursor_image *image = xcursor->images[0];
wlr_xwayland_set_cursor(server->xwayland, image->buffer, wlr_xwayland_set_cursor(server->xwayland, image->buffer,