While studying wayland protocol, I found code that functions takes struct type as parameter.
#include <wayland-server.h>
static struct wl_compositor_interface compositor_interface =
{&compositor_create_surface, &compositor_create_region};
int main() {
wl_global_create (display, &wl_compositor_interface, 3, NULL,
&compositor_bind);
}
signature of wl_global_create is
struct wl_global* wl_global_create (struct wl_display *display,
const struct wl_interface *interface,
int version,
void *data,
wl_global_bind_func_t bind)
wl_compositor_interface is structure type, not a variable name. but wl_global_create() take structure type as function parameter. can someone explain how this works?
the source code I read is here. https://github.com/eyelash/tutorials/blob/master/wayland-compositor/wayland-compositor.c