[PATCH V2] wayland.xml: add "enum", "bitfield" and "is_bitfield" attributes

Bill Spitzak spitzak at gmail.com
Mon Sep 22 13:05:31 PDT 2014

On 09/22/2014 12:48 PM, Jasper St. Pierre wrote:

> xdg_shell.resize_edges. It is both a bitfield (top / left / right /
> bottom edges are powers of two) and an enum (top right / bottom left
> corner convenience values, with top / bottom being left out as it is
> undefined).

That actually is a better example, but otherwise the same as the 
transform example below:

>     The example of wl_output.transform is an enum because every
>     possibility is enumerated.  From C or a similar language, you can do
>     fun stuff like "if (transform & WL_OUTPUT_TRANSFORM_FLIPPED)" to
>     determine if there is a flip.  In a strongly typed language, you
>     can't do this and we shouldn't bend over backwards to make it
>     possible.  If we try and come up with some convoluted system that
>     makes this possible with typed languages, we're going to cause far
>     more pain than it's worth.

Since there are concievable reasons in the future to do sets that don't 
have assigned names (sucha as top+bottom to perhaps indicate vertical 
scaling) it may make sense to change the edges to a bitfield. And maybe 
even the transform.

An alternative is to declare it twice with the same name, once as an 
enum and once as a bitfield with only the values equal to single bits 
listed. I'm not sure if this would really work without violating any 
syntax rules and whether any bindings could take advantage of that 

More information about the wayland-devel mailing list