view: fix some inconsistencies in view_ functions

... especially regarding whether a (view *) parameter may be NULL. It's
confusing when some functions accept NULL and others don't, and could
trip someone up.

I'm partly to blame for the inconsistency, since (if memory serves) I
added view_is_tiled() and view_is_floating(), which do accept NULL.

In detail:

- Make view_is_tiled() and view_is_floating() no longer accept NULL.

- Rename view_isfocusable -> view_is_focusable for consistency with
  other view_is_ functions.

- Eliminate view_inhibits_keybinds() as it only existed to safely accept
  NULL and check a single flag, which can be checked directly.

- Add assert(view) to remaining public view_ functions to catch
  accidentally passing NULL.

- Inline inhibit_keybinds() into view_toggle_keybinds(). It is closely
  related and not called from anywhere else; inlining it allows
  eliminating an extra assert() which is now impossible.
This commit is contained in:
John Lindgren 2023-09-25 22:42:06 -04:00 committed by Johan Malm
parent d00f76e562
commit 1f541be481
5 changed files with 27 additions and 33 deletions

View file

@ -94,7 +94,8 @@ handle_keybinding(struct server *server, uint32_t modifiers, xkb_keysym_t sym, x
continue;
}
if (server->seat.nr_inhibited_keybind_views
&& view_inhibits_keybinds(server->focused_view)
&& server->focused_view
&& server->focused_view->inhibits_keybinds
&& !actions_contain_toggle_keybinds(&keybind->actions)) {
continue;
}