allow NULL callbacks in listeners
A client has to provide callback function pointers for all callbacks in a listener even if these are not used.
Example:
It is not possible to define a wl_keyboard_listener
with only a subset of callbacks defined:
static const struct wl_keyboard_listener keyboard_listener = {
.keymap = keyboard_keymap,
.key = keyboard_key,
.modifiers = keyboard_modifiers,
};
Since the enter
and leave
callbacks are not defined, the client execution will fail with listener function for opcode 1 of wl_keyboard is NULL
.
One has to define the empty functions:
void keyboard_enter(...)
{
//
}
void keyboard_leave(...)
{
//
}
to work around this issue. This produces a lot of code clutter.
To remove the need to provide function pointers for unused callbacks, the wayland client library should handle undefined (NULL) callback function pointers and simply ignore (skip) these callbacks if they are not defined.