[PATCH] Declare enumeration wl_output.transform as bitfield.
Nils Christopher Brause
nilschrbrause at gmail.com
Fri Nov 6 05:03:31 PST 2015
The enumeration wl_output.transform is clearly a bitfield.
The definition of a bitfield is that each bit has a distinct
meaning. This is clearly the case in the enumeration
wl_output.transform:
- bit 0: rotate by 90 degree
- bit 1: rotate by 180 degree
- bit 2: flip around vertical axis
Every other value can be constructed by ORing together the
above bits:
- "270" = "90" | "180"
- "flipped_90" = "90" | "flipped"
- "flipped_180" = "180" | "flipped"
- "flipped_270" = "90" | "180" | "flipped"
Therefore the bitfield="true" attribute has been added to
the enumeration declaration. Since this bitfield is
transferred as signed integer, the scanner had to be
modified to accept that behaviour. This was also noted in
the documentation.
---
doc/publican/sources/Protocol.xml | 5 ++---
protocol/wayland.xml | 2 +-
src/scanner.c | 4 ----
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/doc/publican/sources/Protocol.xml b/doc/publican/sources/Protocol.xml
index 66cebfb..853b7bb 100644
--- a/doc/publican/sources/Protocol.xml
+++ b/doc/publican/sources/Protocol.xml
@@ -42,9 +42,8 @@
</para>
<para>
The <type>enum</type> attribute can be used on either <type>uint</type>
- or <type>int</type> arguments, however if the <type>enum</type> is
- defined as a <type>bitfield</type>, it can only be used on
- <type>uint</type> args.
+ or <type>int</type> arguments, regardless of having the bitfield
+ attribute set.
</para>
<para>
The server sends back events to the client, each event is emitted from
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 9c22d45..798c1b6 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -1789,7 +1789,7 @@
<entry name="vertical_bgr" value="5"/>
</enum>
- <enum name="transform">
+ <enum name="transform" bitfield="true">
<description summary="transform from framebuffer to output">
This describes the transform that a compositor will apply to a
surface to compensate for the rotation or mirroring of an
diff --git a/src/scanner.c b/src/scanner.c
index 8ecdd56..e0aa66a 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -748,10 +748,6 @@ verify_arguments(struct parse_context *ctx, struct wl_list *messages, struct wl_
switch (a->type) {
case INT:
- if (f->bitfield)
- fail(&ctx->loc,
- "bitfield-style enum must only be referenced by uint");
- break;
case UNSIGNED:
break;
default:
--
2.6.2
More information about the wayland-devel
mailing list