Add -Wshadow + reformat switch cases

Adding -Wshadow will prevent unintentional variable overrides.

Also, wrapping switch cases with declarations with braces will make our
logic more robust by limiting lifetimes of variables.
This commit is contained in:
tokyo4j 2025-05-23 13:09:15 +09:00 committed by Johan Malm
parent e19f0fc267
commit 68bf55d724
4 changed files with 91 additions and 94 deletions

View file

@ -101,11 +101,11 @@ _osd_update(struct server *server)
/* Border */
set_cairo_color(cairo, theme->osd_border_color);
struct wlr_fbox fbox = {
struct wlr_fbox border_fbox = {
.width = width,
.height = height,
};
draw_cairo_border(cairo, fbox, theme->osd_border_width);
draw_cairo_border(cairo, border_fbox, theme->osd_border_width);
/* Boxes */
uint16_t x;
@ -385,9 +385,9 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
* below that should take care of the issue.
*/
if (update_focus) {
struct view *view = server->active_view;
if (!view || (!view->visible_on_all_workspaces
&& !view_is_always_on_top(view))) {
struct view *active_view = server->active_view;
if (!active_view || (!active_view->visible_on_all_workspaces
&& !view_is_always_on_top(active_view))) {
desktop_focus_topmost_view(server);
}
}