[PATCH] update protocol specification to match wire protocol

Boyan Ding stu_dby at 126.com
Thu Sep 4 20:33:35 PDT 2014


Hi,

Actually it is not a hack, it is a very well-defined behavior (though
not clearly documented at present). We'll update the documentation to
reflect that. The mechanic of creating objects undergoes some change as
Pekka mentioned [1] and now it's been stable and won't change anymore (I
have to iterate again that if you change how it works now, the world
will break before you). The tool you mentioned seems implement an older
version of the specification and if you want to use that tool, you
should change the code generation to the way wayland-scanner works now.

Regards,
Boyan Ding

[1]
http://lists.freedesktop.org/archives/wayland-devel/2014-September/017087.html
On Thu, 2014-09-04 at 22:05 -0500, Paul Sbarra wrote:
> I agree it's a hack, but it's also one that invalidates the protocol
> specification.  If the wire protocol requires four arguments then the
> specification needs to reflect that.  Currently if another tool or
> protocol implementation (like the gowl example previously mentioned)
> attempts to generate code from the specification they end up code that
> is not compatible with libwayland applications.  In my opinion that's
> a pretty bad outcome for a hack, documented or not.
> 
> 
> Attached is a patch that resolves the problem (at least it limits the
> scope of the hack to the wayland code generator) while maintaining the
> existing api.  Thank you in advance for reviewing and considering this
> patch.
> 
> 
> Paul
> 
> 
> On Wed, Sep 3, 2014 at 11:04 PM, Jasper St. Pierre
> <jstpierre at mecheye.net> wrote:
>         The fact that we have an undocumented hack like that in our
>         scanner clearly isn't great. We need to document it.
>         
>         On Sep 3, 2014 8:55 PM, "Boyan Ding" <stu_dby at 126.com> wrote:
>                 Hi,
>                 
>                 It is actually not a fault in wayland, instead it is
>                 designed to be so.
>                 new_id's without interface specified in the protocol
>                 (such as the one in
>                 wl_registry::bind) must come with 3 arguments (s:
>                 interface name, u:
>                 version, n: the actual new_id). That's why 'n' turns
>                 into 'sun'. If a
>                 language binding generates the wrong code, please
>                 contact the author of
>                 the language binding and let him correct it. If you
>                 are changing how
>                 wayland-scanner (the official C code generator) works,
>                 the whole world
>                 will break before you.
>                 
>                 Refer to "How protocol objects are created" section in
>                 [1] to see the
>                 details.
>                 
>                 Regards,
>                 Boyan Ding
>                 
>                 [1]
>                 http://ppaalanen.blogspot.fi/2014/07/wayland-protocol-design-object-lifespan.html
>                 
>                 On Wed, 2014-09-03 at 22:32 -0500, Paul Sbarra wrote:
>                 > I tried to start some discussion on this topic
>                 previously, but it
>                 > apparently didn't make it through the moderator, so
>                 I'm trying again
>                 > having now joined the list.
>                 >
>                 >
>                 > I've recently taken an interest in the gowl
>                 implementation of the
>                 > wayland protocol and noticed that the specification
>                 doesn't match the
>                 > interface that gets generated by the wayland
>                 scanner.
>                 >
>                 >
>                 > If I attempt to code-gen gowl using the wayland.xml
>                 file the
>                 > wl_registry bind interface is missing a couple
>                 arguments that weston
>                 > expects, resulting in the following runtime error:
>                 > libwayland: message too short, object (2), message
>                 bind(usun)
>                 >
>                 >
>                 > However, the spec indicates a bind request signature
>                 of "un".
>                 >
>                 >
>                 > I tracked this down into some curious logic in the
>                 scanner and have
>                 > been working on a patch to try and allow the
>                 corrected signature to be
>                 > specified in the protocol.  Unfortunately this has
>                 become more
>                 > interesting then I'd anticipated.
>                 >
>                 >
>                 > Attached is my naive attempt at resolving this
>                 issue.  I'm horrified
>                 > by the string->interface lookup and the
>                 wl_registry_bind api change
>                 > but I'm not sure what else one can do.  Any feedback
>                 or additional
>                 > help would be appreciated.
>                 >
>                 >
>                 > Note that this patch applies to the 1.5.91 tagged
>                 commit and compiles
>                 > cleanly (for wayland).  Weston didn't like having
>                 the lookup function
>                 > defined in multiple files, so maybe there would be a
>                 better place to
>                 > put such functionality.
>                 >
>                 > Thanks,
>                 > Paul
>                 >
>                 > _______________________________________________
>                 > wayland-devel mailing list
>                 > wayland-devel at lists.freedesktop.org
>                 >
>                 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>                 
>                 
>                 
>                 _______________________________________________
>                 wayland-devel mailing list
>                 wayland-devel at lists.freedesktop.org
>                 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
> 
> 提示图标 邮件带有附件预览链接,若您转发或回复此邮件时不希望对方预览附
> 件,建议您手动删除链接。
> 共有 1 个附件
> 0001-update-specification-to-match-the-wire-protocol.patch(5K)
>         极速下载 在线预览 





More information about the wayland-devel mailing list