1. 23 Apr, 2020 1 commit
    • Guido Günther's avatar
      scanner: Guard interface declarations · cc8b6aa3
      Guido Günther authored
      
      
      This allows to include client and server headers in the same file
      fixing warnings like
      
      In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16,
                       from ../src/desktop.h:16,
                       from ../src/server.h:13,
                       from ../tests/testlib.c:8:
      tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:80:34: warning: redundant redeclaration of ‘zwlr_layer_shell_v1_interface’ [-Wredundant-decls]
         80 | extern const struct wl_interface zwlr_layer_shell_v1_interface;
            |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from ../tests/testlib.h:8,
                       from ../tests/testlib.c:7:
      tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:77:34: note: previous declaration of ‘zwlr_layer_shell_v1_interface’ was here
         77 | extern const struct wl_interface zwlr_layer_shell_v1_interface;
            |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16,
                       from ../src/desktop.h:16,
                       from ../src/server.h:13,
                       from ../tests/testlib.c:8:
      tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:106:34: warning: redundant redeclaration of ‘zwlr_layer_surface_v1_interface’ [-Wredundant-decls]
        106 | extern const struct wl_interface zwlr_layer_surface_v1_interface;
            |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from ../tests/testlib.h:8,
                       from ../tests/testlib.c:7:
      tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:103:34: note: previous declaration of ‘zwlr_layer_surface_v1_interface’ was here
        103 | extern const struct wl_interface zwlr_layer_surface_v1_interface;
      Signed-off-by: Guido Günther's avatarGuido Günther <agx@sigxcpu.org>
      Closes: #158
      cc8b6aa3
  2. 10 Jan, 2020 1 commit
  3. 05 Nov, 2019 1 commit
  4. 11 Sep, 2019 1 commit
  5. 02 May, 2019 2 commits
    • Antonio Borneo's avatar
      log: remove "%m" from format strings by using strerror(errno) · 294ed97e
      Antonio Borneo authored
      
      
      The printf() format specifier "%m" is a glibc extension to print
      the string returned by strerror(errno). While supported by other
      libraries (e.g. uClibc and musl), it is not widely portable.
      
      In Wayland code the format string is often passed to a logging
      function that calls other syscalls before the conversion of "%m"
      takes place. If one of such syscall modifies the value in errno,
      the conversion of "%m" will incorrectly report the error string
      corresponding to the new value of errno.
      
      Remove all the occurrences of the specifier "%m" in Wayland code
      by using directly the string returned by strerror(errno).
      Signed-off-by: Antonio Borneo's avatarAntonio Borneo <borneo.antonio@gmail.com>
      294ed97e
    • Manuel Stoeckl's avatar
      scanner: error when element names will not compile · 6ce4bbb3
      Manuel Stoeckl authored
      
      
      This change checks that the "name" fields of the various structures in
      a Wayland protocol XML file will be converted into C identifiers that
      can be successfully compiled.
      
      For names which will be inserted as the prefix of an identifier
      enforce a match with [_a-zA-Z][_0-9a-zA-Z]* . For types only inserted
      as the suffix of an identifier (enum, entry), enforce a format of
      [_0-9a-zA-Z]+ .
      
      Unicode characters (and escape sequences like \u0394) are not allowed,
      because most older and some newer C compilers do not support them by
      default.
      
      For sake of simplicity, this patch does not check for collisions
      with reserved words or standard library names.
      Signed-off-by: default avatarManuel Stoeckl <code@mstoeckl.com>
      6ce4bbb3
  6. 29 Aug, 2018 3 commits
  7. 07 Jun, 2018 1 commit
  8. 23 Feb, 2018 1 commit
  9. 22 Feb, 2018 2 commits
  10. 04 Dec, 2017 1 commit
  11. 18 Aug, 2017 1 commit
  12. 17 Mar, 2017 1 commit
  13. 24 Jan, 2017 2 commits
  14. 16 Nov, 2016 1 commit
  15. 10 Nov, 2016 1 commit
  16. 11 Aug, 2016 1 commit
    • Quentin Glidic's avatar
      scanner: Generate all SINCE_VERSION macros for everyone · 5636cb2f
      Quentin Glidic authored
      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's avatarQuentin Glidic <sardemff7+git@sardemff7.net>
      Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      [Pekka: add paragraphs to commit message.]
      5636cb2f
  17. 26 Jul, 2016 1 commit
  18. 18 Jul, 2016 1 commit
  19. 11 Jul, 2016 1 commit
  20. 07 Jun, 2016 3 commits
  21. 20 May, 2016 1 commit
  22. 06 May, 2016 1 commit
  23. 03 May, 2016 1 commit
    • Auke Booij's avatar
      protocol: add support for cross-interface enum attributes · 7ccf35d4
      Auke Booij authored
      The enum attribute, for which scanner support was introduced in
      1771299a
      
      , 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: default avatarAuke Booij <auke@tulcod.com>
      Reviewed-by: default avatarNils Christopher Brause <nilschrbrause@googlemail.com>
      Reviewed-by: Bill Spitzak's avatarBill Spitzak <spitzak@gmail.com>
      [Pekka: rebased across cde251a1
      
      ]
      [Pekka: wrap lines and space fixes in scanner.c]
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      7ccf35d4
  24. 19 Apr, 2016 1 commit
  25. 01 Apr, 2016 1 commit
  26. 07 Mar, 2016 1 commit
    • Peter Hutterer's avatar
      doc: generate doxygen html output from the scanner · 2b5310a3
      Peter Hutterer authored
      
      
      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's avatarPeter Hutterer <peter.hutterer@who-t.net>
      Reviewed-by: default avatarBryce Harrington <bryce@osg.samsung.com>
      2b5310a3
  27. 29 Feb, 2016 1 commit
  28. 04 Feb, 2016 1 commit
  29. 02 Feb, 2016 1 commit
  30. 19 Jan, 2016 1 commit
    • Jason Ekstrand's avatar
      Track protocol object versions inside wl_proxy. · 557032e3
      Jason Ekstrand authored
      
      
      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's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      
      Second trivial commit squashed into this one:
      Authored by Derek Foreman <derekf@osg.samsung.com>
      Signed-off-by: default avatarDerek 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's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
      557032e3
  31. 12 Jan, 2016 2 commits
  32. 17 Nov, 2015 1 commit
    • Peter Hutterer's avatar
      Validate the protocol xml during scanning · f66e2d53
      Peter Hutterer authored
      
      
      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's avatarPeter Hutterer <peter.hutterer@who-t.net>
      Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      f66e2d53