]> git.mdlowis.com Git - proto/labwc.git/commit
view: fix some inconsistencies in view_ functions
authorJohn Lindgren <john@jlindgren.net>
Tue, 26 Sep 2023 02:42:06 +0000 (22:42 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 9 Oct 2023 19:34:13 +0000 (20:34 +0100)
commit1f541be4815894bfe886692cdd2cb931cd7a9d57
tree52a62a5e2a8b124946aaeecd08e4cb44c3e97e21
parentd00f76e5627cfb303ecbb633743d7984af076db3
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.
include/view.h
src/desktop.c
src/keyboard.c
src/osd.c
src/view.c