Re: Using libweston with GTK/GDK

2019-05-16 Thread adlo
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, ®istry_listener, NULL);

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


int main (intargc,
  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

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Re: Using libweston with GTK/GDK

2019-05-16 Thread Pekka Paalanen
On Thu, 16 May 2019 05:59:20 +0100
adlo  wrote:

> 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 (intargc,
>   char **argv)
> {
>   display = wl_display_connect (NULL);
> 
>   registry = wl_display_get_registry (display);
> 
>   wl_registry_add_listener(registry, ®istry_listener, NULL);
> 
>   wl_display_dispatch (display);
>   wl_display_dispatch (display);
> 
>   return 0;
> }
> 
> How can I fix this?

Hi,

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()


Thanks,
pq


pgp6YY_kou3F9.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel