Two wayland connection in single process context
Vikas Patil
vikasmpatil at gmail.com
Fri Jul 29 09:33:39 UTC 2016
On Fri, Jul 29, 2016 at 1:17 PM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Wed, 27 Jul 2016 17:06:04 +0530
> Vikas Patil <vikasmpatil at gmail.com> wrote:
>
>> Dear All,
>>
>> Could you comment/suggest on following approach of using two different
>> wayland connection in single process?
>>
>> First wayland connection for creating wl_shm backed wayland surface
>> for receiving touch inputs in main thread or as separate thread. Like
>> simple-touch.c example but without painting and transparent.
>>
>> Second wayland connection for another egl wayland surface for
>> rendering in shared library which will be loaded by above application.
>> Like simple-egl.c example.
>
> Hi,
>
> if you never want your first connection to handle input events on the
> surface created on the second connection, I suppose it would work. You
> also will not be able position your surfaces from the different
> connections relative to each other at all.
>
> The main thing to remember is that *everything* is private to a
> connection. If you create a wl_surface on one connection, it is as if
> it does not exist at all for any other connection. It does not matter
> if the connections come from the same thread, process, or not.
>
> If you expect any sort of interoperability, you *must* use the same
> connection for everything. Opening a second connection from the same
> program to the same server is practically always a design mistake.
>
> Of course, one could make Wayland extensions to work around this, but
> don't go there.
>
> So, in short: don't do it.
>
>> Will this work? Is it this the right way to do it or is there any
>> other mechanism available for such requirement?
>
> What do you want to achieve?
> You didn't explain what you really want to do.
>
I have a video rendering library (which handles all media related
functions too) which is used by application, and that library make use
of first wayland connection and don't handle the touch events as there
is no way to pass that information to application so thinking to make
transparent wayland surface on top of wayland surface to which the
video is rendered by library to handle the touch events by creating
second wayland connection in application.
I tried creating and handling touch event (similar to simple-touch.c)
with second wayland connection after the application loads the library
but it gave me following errors. So I thought it might not be
possible. Also I think you hinted same here
https://lists.freedesktop.org/archives/wayland-devel/2015-September/024211.html
Error communicating with wayland: Protocol error
Error communicating with wayland: Protocol error
Error communicating with wayland: Protocol error
Error communicating with wayland: Protocol error
Error communicating with wayland: Protocol error
Thanks & Regards,
Vikash
More information about the wayland-devel
mailing list