Using libweston with GTK/GDK

Pekka Paalanen ppaalanen at gmail.com
Tue Jun 4 07:55:54 UTC 2019


On Mon, 3 Jun 2019 18:53:28 +0100
adlo <adloconwy at gmail.com> wrote:

> > On 1 May 2019, at 10:34, Pekka Paalanen <ppaalanen at gmail.com> 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
> > 
> > The server-side implementation of it is in shell.c and the
> > entrypoint to that is
> > https://gitlab.freedesktop.org/wayland/weston/blob/master/desktop-shell/shell.c#L5143
> > 
> >    wl_global_create(ec->wl_display,
> >                 &weston_desktop_shell_interface, 1,
> >                 shell, bind_desktop_shell)
> > 
> > which installs the protocol extension in the compositor. You can
> > see everything about the implementation by following all callbacks
> > that get registered, starting with bind_desktop_shell().
> > 
> > The privacy of the protocol extension, the installed wayland global
> > really, is achieved in
> > https://gitlab.freedesktop.org/wayland/weston/blob/master/desktop-shell/shell.c#L4366
> > 
> >    shell->child.client = weston_client_start(shell->compositor,
> >                          shell->client);
> > 
> > which creates the Wayland connection before forking the child
> > process and bind_desktop_shell() then verifying the client trying
> > to bind to the global is the client that was forked.
> >   
> 
> Is it required that the helper client be a separate binary that must
> be launched through a path? Is it possible for the client to just be
> a function in my main program?

Hi,

if you really absolutely want to, you can play with threads and all
the problems that threads create. Or you could fork() and choose not to
exec() but instead continue as if you're a client, but I'm not sure how
you would clean up the server bits from the child process. I would
recommend against both of these approaches, they make things messy and
hard to debug.

It is still the easiest and cleanest to just have a separate binary
file to launch in my opinion.


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/20190604/60c49f02/attachment.sig>


More information about the wayland-devel mailing list