Using libweston with GTK/GDK

Pekka Paalanen ppaalanen at gmail.com
Thu May 16 08:58:57 UTC 2019


On Thu, 16 May 2019 05:59:20 +0100
adlo <adloconwy at gmail.com> 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 (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?

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20190516/12eb1d7f/attachment.sig>


More information about the wayland-devel mailing list