0

this is questions raised from can struct type itself be passed to function as parameter in c?

from the previous question, I found that "wl_compositor_interface" is used as struct tag and variable both in header file "wayland-server-protocol.h".

struct wl_compositor_interface {
         void (*create_surface)(struct wl_client *client,
                                struct wl_resource *resource,
                                uint32_t id);
         void (*create_region)(struct wl_client *client,
                               struct wl_resource *resource,
                               uint32_t id);
 };


extern const struct wl_interface wl_compositor_interface;

however, the header file just declared the variable as extern const struct wl_interface wl_compositor_interface; I cannot find where the variable is defined. similarly, all variables with pattern "wl_***_interface are declared in the header file but have no definition. can someone help me to find the definition? wayland source is here wayland github

I also looked at documentation, there was no description about wl_***_interface

Community
  • 1
  • 1
Yeongbae
  • 57
  • 6

1 Answers1

0

This is because the struct wl_interface wl_compositor_interface - that you have to use when binding to the wl_compositor global - is in the generated protocol code, usually in $SRC/protocol/wayland-protocol.c.

The struct wl_compositor_interface is the structure used by the compositor to register functions where it will receive requests from clients (for its own wl_resource structs that represent the compositor global seen by the clients).

Marcus Borkenhagen
  • 6,536
  • 1
  • 30
  • 33