treewide: remove empty statements in switch cases

For longer cases, factor out the logic to new functions.
For very short cases, just move the declaration before the switch.

v2: in one case, replace the switch with if/else.
This commit is contained in:
John Lindgren 2025-05-22 10:53:58 -04:00 committed by Johan Malm
parent fbb92e2e30
commit a3d6226728
5 changed files with 59 additions and 50 deletions

View file

@ -77,10 +77,9 @@ desktop_focus_view(struct view *view, bool raise)
workspaces_switch_to(view->workspace, /*update_focus*/ false);
}
struct seat *seat = &view->server->seat;
switch (view_wants_focus(view)) {
case VIEW_WANTS_FOCUS_ALWAYS:
; /* works around "a label can only be part of a statement" */
struct seat *seat = &view->server->seat;
if (view->surface != seat->seat->keyboard_state.focused_surface) {
seat_focus_surface(seat, view->surface);
}