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

@ -479,7 +479,7 @@ osd_update(struct server *server)
/* Outline current window */
if (rc.window_switcher.outlines) {
if (view_isfocusable(server->osd_state.cycle_view)) {
if (view_is_focusable(server->osd_state.cycle_view)) {
osd_update_preview_outlines(server->osd_state.cycle_view);
}
}