Using libweston with GTK/GDK

adlo adloconwy at gmail.com
Thu May 16 04:59:20 UTC 2019


On Wed, 2019-05-01 at 12:34 +0300, Pekka Paalanen wrote:
> 
> it is all just the normal Wayland protocol exchange but with a new
> interface of your own design. I'm not sure if there is a really
> minimal example, but I'll list at least some.
> 
> One example of such private protocol extension is
> https://gitlab.freedesktop.org/wayland/weston/blob/master/protocol/weston-desktop-shell.xml
> 

I wrote a test client to test an initial limited implementation of my
protocol. WAYLAND_DEBUG indicates that my client binds to the
interface, but my protocol's server-side bind() function doesn't run.

Here is some of my code:

Server-side:

static void
bind_desktop_shell(struct wl_client *client,
		   void *data, uint32_t version, uint32_t id)
{

  // This log message never appears
  weston_log ("\nbind desktop shell\n");

}

void shell_init ()
{

  wl_global_create (server->compositor->wl_display,
                    &xyz_shell_interface, 1,
                    server, bind_desktop_shell);

}

Client-side:

void global_add(void *our_data,
        struct wl_registry *registry,
        uint32_t name,
        const char *interface,
        uint32_t version) {

   if (strcmp(interface, "xyz_shell") == 0) {
          struct xyz_shell *xshell = NULL;
          xshell = wl_registry_bind (registry, 1, &xyz_shell_interface,
                               1);
          }

}

int main (int    argc,
          char **argv)
{
  display = wl_display_connect (NULL);

  registry = wl_display_get_registry (display);

  wl_registry_add_listener(registry, &registry_listener, NULL);

  wl_display_dispatch (display);
  wl_display_dispatch (display);

  return 0;
}

How can I fix this?

Regards

adlo



More information about the wayland-devel mailing list