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 information.
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to