Age | Commit message (Collapse) | Author | Files | Lines |
|
Practical example: a client supporting version 2 of wl_output will wait
for the wl_output.done event before starting wl_output-related
operations. However, if the server only supports version 1, no event
will ever come, and it must fallback to use the wl_output.geometry event
alone.
Without this macro, it cannot check for that in a nice way.
This patch introduces the same #defines in both server and client
headers. We rely on both being generated from the same XML file and
https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html
to not cause compiler errors or warning due to redefinitions. We also
assume that no-one uses the same name in the same interface for both a
request and an event.
If this patch does cause grief due to identical redefinitions, the
contingency plan is to change the generator to produce
#ifndef/#define/#endif instead of just #define.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: add paragraphs to commit message.]
|
|
Some headers and source files have been using types such as uint32_t
without explicitly including stdint.h.
Explicitly include stdint.h where appropriate.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
|
|
uint32_t is C99 defined stdint type
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
|
|
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
|
|
PROGRAM_NAME was defined within the if block of HAVE_LIBXML, causing a
compilation failure when libxml is not present.
Move the define of PROGRAM_NAME out of the if block.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
|
|
wayland-client-protocol.h and wayland-server-protocol.h use a tab
between the identifier and token of generated #defines for request/event
opcodes and versions. While this sometimes enables vertical alignment,
it more frequently doesn't, and leads to awkward spacing.
Replace the tab with a space, for consistency and readability.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
|
|
'wayland-scanner -v' (correctly) reports the program as named
"wayland-scanner", but 'wayland-scanner -h' was inconsistent, referring
to it as './scanner'.
Also refactor this and other references to the program name to use a
common #define, PROGRAM_NAME.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
|
|
wayland-client-protocol.h had forward declarations for wl_client and
wl_resource, yet nothing on the client side references these types.
Add a 'side' condition to only generate these forward declarations in the
server protocol header.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
This adds a command line argument to print wayland-scanner version.
It also makes wayland-scanner emit a comment with wayland library
version to every file it generates.
v2: separate variable definitions into their own lines and remove
old style "version" argument
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
The enum attribute, for which scanner support was introduced in
1771299, can be used to link message arguments to <enum>s. However,
some arguments refer to <enum>s in a different <interface>.
This adds scanner support for referring to an <enum> in a different
<interface> using dot notation. It also sets the attributes in this
style in the wayland XML protocol (wl_shm_pool::create_buffer::format
to wl_shm::format, and wl_surface::set_buffer_transform::transform to
wl_output::transform), and updates the documentation XSL so that this
new style is supported.
Changes since v2:
- add object:: prefix for all enumerations in the documentation
- fix whitespace in scanner.c
- minor code fixup to return early and avoid casts in scanner.c
Changes since v1:
- several implementation bugs fixed
Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bill Spitzak <spitzak@gmail.com>
[Pekka: rebased across cde251a124d41977b447098cc530fcad2834a45f]
[Pekka: wrap lines and space fixes in scanner.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
Adding extern "C" wrapper before includes (especially system ones) is
illadvised as the headers themselves can behave diffently in that case.
See the section "Including C Headers in C++ Code" in the following
http://www.oracle.com/technetwork/articles/servers-storage-dev/mixingcandcpluspluscode-305840.html
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
|
|
Adds one space to the @param lines in generated .h files,
aligning the indentation with the rest of the comment block.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
This switches the scanner to generate doxygen-compatible tags for the
generated protocol headers, and hooks up the doxygen build to generate server
and client-side API documentation. That documentation is now in
Client/ and Server/, respectively.
GENERATE_HTML is on by default and must be disabled for the xml/man targets to
avoid messing up the new documentation. We disable all three three targets in
the doxyfile (xml and man default to NO anyway) to make it obvious that they
need to be set in the per-target instructions.
Each protocol is a separate doxygen @page, with each interface a @subpage.
Wayland only has one protocol, wayland-protocols will have these nested.
Each protocol page has a list of interfaces and the copyright and description
where available.
All interfaces are grouped by doxygen @defgroup and @ingroups and appear in
"Modules" in the generated output. Each interface subpage has the description
and a link to the actual API doc.
Function, struct and #defines are documented in doxygen style and associated
with the matching interface.
Note that pages and groups have fixed HTML file names and are directly
linkable/bookmark-able.
The @mainpage is a separate file that's included at build time. It doesn't
contain much other than links to where the interesting bits are. It's a static
file though that supports markdown, so we can extend it easily in the future.
For doxygen we need the new options EXTRACT_ALL and OPTIMIZE_OUTPUT_FOR_C so
it scans C code properly. EXTRACT_STATIC is needed since most of the protocol
hooks are static.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
When configured with --disable-dtd-validation:
CPPAS src/dtddata.o
src/dtddata.S: Assembler messages:
src/dtddata.S:39: Error: file not found: src/wayland.dtd.embed
Makefile:1520: recipe for target 'src/dtddata.o' failed
This is because the variable name used does not match the implicit
variable name in autoconf.
Fix the variable name, making both --disable-dtd-validation and
--enable-dtd-validation to what they should.
Do not try to build dtddata.S if dtd-validation is disabled. It depends
on wayland.dtd.embed which is created by configure only if
dtd-validation is enabled.
If not building dtddata.S, also make sure the extern definitions in
scanner.c are compiled out.
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=575212
Reported-by: leio@gentoo.org
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
Some copyright strings could result in broken generated header files with
unmatched */
This change:
Runs the loop long enough so the copyright[i] == 0 test can actually
happen. (if there was no \n no copyright text was printed, */ still was)
Prints the opening /* even if there was whitespace at the start of
the very first line.
Only emits a */ if a /* was printed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
Don't just print prefix the errors with "protocol", but the actual file
name, if wayland-scanner was passed with the filename of the protocol
file. If wayland-scanner is reading from stdin, errors will be prefixed
with "<stdin>" instead of "protocol".
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
This provides a standardized mechanism for tracking protocol object
versions in client code. The wl_display object is created with version 1.
Every time an object is created from within wl_registry_bind, it gets the
bound version. Every other time an object is created, it simply inherits
it's version from the parent object that created it.
(comments and minor reformatting added
by Derek Foreman <derekf@osg.samsung.com>)
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Second trivial commit squashed into this one:
Authored by Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
(it's literally one of code and a lot of comments)
This sets wl_display's version (for proxy version query purposes)
to 0. Any proxy created with unversioned API (this happens when
a client compiled with old headers links against new wayland)
will inherit this 0.
This gives us a way for new libraries linked by old clients to
realize they can't know a proxy's version.
wl_display's version being unqueryable (always returning 0) is
an acceptable side effect, since it's a special object you can't
bind specific versions of anyway.
Second half:
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
|
|
If an event or request have a "since" attribute that is larger than
the version of the interface it is in, fail with an explaining error
message.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
|
|
A statement was added at the same indentation level as the true branch
of the if statement, but since there were no brackets, it would be
executed independently of the result of the if condition.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
|
|
Embed the wayland.dtd protocol data into the scanner binary so we can validate
external protocol files without requiring makefile changes. Hat-tip to Pekka
Paalanen for the embedding trick.
The embedding trick doesn't work well if the to-be-embedded file is in a
different location than the source file, so copy/link it during configure and
then build it in from the local directory.
The current expat parser is not a validating parser, moving scanner.c to
another parser has the risk of breaking compatibility. This patch adds libxml2
as extra (optional) dependency, but that also requires parsing the input
twice.
If the protocol fails validation a warning is printed but no error is returned
otherwise.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
The scanner now checks whether arguments that have an associated
<enum> have the right type.
An argument with an enum attribute must be of type int or uint,
and if the <enum> with that name has the bitfield attribute
set to true, then the argument must be of type uint.
Changes since v3:
- Remove useless allow_null check
- Switch to using bool
- Clearer message on errorous input
- Minor formatting fix
Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
|
|
Generated code was unconditionally adding a space to lines
in comments for copyright blocks even if the line was blank.
Updated to not add trailing whitespace for blank lines.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
|
|
We already generate WL_[INTERFACE]_[REQUEST]_SINCE_VERSION macros for
events in the server protocol headers. Lets do the same for requests in
the client protocol headers as well.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
|
|
Addresses this error reported by Denis Denisov:
[src/scanner.c:1415]: (error) Resource leak: input
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v2: Also close input for other exit points in main.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: David FORT <contact@hardening-consulting.com>
|
|
scanner does not complain if we put into version attribute
things like -1 1x 1:3 etc.
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
Use xzalloc instead of xmalloc. This allows us to get rid
of manual initializing the memory to 0s and the code is
shorter and cleaner
Suggested by Bryce Harrington
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
Free all the memory we have allocated during running.
v2.: split creating objects and getting rid of leaks
into two patches
move check for NULL description into free_description
v3.: rebase after previous patch fixes
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
wrap creating and initializing objects (structures)
into functions and use them in the code.
v2. make create_.* functions consistent
(no func will return NULL)
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
We were emitting the extern declarations of all types used in the protocol,
even if not defined in it. This caused warnings to be produced when using
the -Wredundant-decls compiler flag when building an extension that uses
e.g. wl_surface. However we only need the extern declarations if the
protocol defines a factory for those external interfaces. That is a
bad design and can be however done by including the dependent protocol
header first.
So only emit the extern declarations for the types that the protocol
actually defines, this restoring the behavior we were using in 1.7.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=90677
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Arnaud Vrac <rawoul@gmail.com>
|
|
Remove trailing whitespaces because they are not needed and jumping to
the end of al ine should do just that and not jump to the whitespace.
|
|
Use the same retvals for both short and long options.
Whitespace fixes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
When using this new option the generated code will include the new
core headers instead of the old ones. The default needs to remain
unchanged for backward compatibility with old code.
With this change the generated headers will now forward declare all
types and interfaces it uses; that is needed when generating headers
for a my-extension.xml with --include-core-only, since it may use
types defined in wayland.xml.
The same is done also without --include-core-only, since it is an
harmless change.
getopt_long() is used for the option handling.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
Without this patch, the scanner would generate invalid C which wouldn't
compile anyway, so lets be nice and fail earlier and point out where the
error is.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
Add support for direct file reading and writing in wayland-scanner.
Signed-off-by: Jussi Pakkanen <jpakkane@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: David Fort <rdp.effort@gmail.com>
|
|
Server protocols headers should include wayland-server.h,
instead of wayland-util.h. Otherwise they're not useable
with C++ compiler unless wayland-server.h was included
earlier.
Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
|
|
Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
|
|
Signed-off-by: Imran Zaman <imran.zaman@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
[Pekka Paalanen: change is_nullable_type() return value to bool.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
Print the parse error and exit with a failure if expat can't parse the
XML.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
"is_interface" is a really terrible name for the client or server
variants, and instead of checking whether we were passed the requests or
the events, just pass an argument through.
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
Commit 99a72777f96f63e4e25dc528bb37115424adac59 introduced a new error
for when the 'since' version decreases. It also reset the version for
messages without a version to 1. Versioning semantics in the spec files
was a little under-specified and we don't want to break projects caught in
this grey zone.
This commits replaces previous configure.ac as the 1.4.93 tag and the
final 1.5 RC.
|
|
This could be useful for compositors who need to be able to not send
events if the client bound a version lower than the newest provided.
Event version numbers are exposed as
[INTERFACE_NAME]_[EVENT_NAME]_SINCE_VERSION for example wl_output.scale
will have the version macro WL_OUTPUT_SCALE_SINCE_VERSION.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
Fail if a message with version implicitly set to 1 (i.e. not specified)
comes after a message with since-version > 1.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
|
|
Just sort the types and only print unique type names. We avoid using
the GCC pragma.
|
|
The code very intentionally emits a lot of redundant declarations
to simplify the scanner code. Somebody building with -Wredundant-decls
would have compile errors, so emit special pragmas to turn those
warnings off.
These pragmas should be ignored outside of gcc/clang.
|
|
POSIX says to set errno=0 before calling strtol since
the return value alne cannot tell a failure.
on ubuntu armel I get:
../src/wayland-scanner client-header < ../../protocol/wayland.xml > wayland-client-protocol.h
<stdin>:1188: error: invalid integer (2)
Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
|