Using libweston with GTK/GDK

adlo adloconwy at gmail.com
Fri May 17 02:45:10 UTC 2019


On Thu, 2019-05-16 at 11:58 +0300, Pekka Paalanen wrote:
> 
> you should run an actual event loop in the client, which will then
> flush your requests to the compositor. Your issue seems to be a
> missing
> flush.
> 
> See also https://wayland.freedesktop.org/extras.html "Protocol
> dumpers"
> and the link "is not enough".
> 
> See: wl_display_flush()
> 

I'm not sure exactly what you mean. I tried the following, but it still
doesn't work:

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);
          wl_display_flush (display);

          }

}

...

void idle ()
{
  registry = wl_display_get_registry (display);

  wl_registry_add_listener(registry, &registry_listener, NULL);

  wl_display_flush (display);
  wl_display_dispatch (display);
  wl_display_dispatch (display);
  wl_display_flush (display);
}


int main (int    argc,
          char **argv)
{

  struct wl_event_loop *event_loop = wl_event_loop_create ();
  wl_event_loop_add_idle (event_loop, idle, NULL);

  while (true)
    {
      wl_event_loop_dispatch (event_loop, 0);
    }

  return 0;
}

I also tried wl_display_get_event_loop() and tried to add_idle() to
that, but that caused the client to segfault.

I tried putting wl_display_flush() wherever I could think of but to no
avail.

Regards

adlo



More information about the wayland-devel mailing list