Projects
openEuler:Mainline
wayland
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:wayland.spec
Changed
@@ -1,15 +1,16 @@ Name: wayland -Version: 1.20.0 -Release: 4 +Version: 1.21.0 +Release: 2 Summary: Wayland Compositor Infrastructure License: MIT -URL: http://wayland.freedesktop.org/ -Source0: http://wayland.freedesktop.org/releases/%{name}-%{version}.tar.xz +URL: https://wayland.freedesktop.org/ +Source0: https://gitlab.freedesktop.org/wayland/wayland/-/archive/%{version}/%{name}-%{version}.tar.gz BuildRequires: gcc gcc-c++ docbook-style-xsl doxygen expat-devel BuildRequires: libxml2-devel libxslt pkgconfig(libffi) xmlto graphviz meson chrpath Provides: libwayland-client = %{version}-%{release} libwayland-cursor = %{version}-%{release} +Provides: libwayland-client%{?_isa} = %{version}-%{release} libwayland-cursor%{?_isa} = %{version}-%{release} Obsoletes: libwayland-client < %{version}-%{release} libwayland-cursor < %{version}-%{release} Provides: libwayland-egl = %{version}-%{release} libwayland-server = %{version}-%{release} Obsoletes: libwayland-egl < %{version}-%{release} libwayland-server < %{version}-%{release} @@ -92,6 +93,15 @@ %{_datadir}/doc/wayland/ %changelog +* Fri Dec 30 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 1.21.0-2 +- add Provides:libwayland-client%{?_isa} and libwayland-cursor%{?_isa} + +* Wed Dec 14 2022 lijian <lijian2@kylinos.cn> - 1.21.0-1 +- update to 1.21.0 + +* Sat Aug 27 2022 tianlijing <tianlijing@kylinos.cn> - 1.20.92-1 +- update to 1.20.92 + * Thu Jun 16 2022 wangkerong <wangkerong@h-partners.com> - 1.20.0-4 - CVE:NA - SUG:NA
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/wayland.git</param> - <param name="revision">4a51662d7cc84362db574c353f6b7a333b8e25e9</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:wayland-1.20.0.tar.xz/publish-doc
Deleted
@@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - - -e doc || (echo "Run this from the project root" && exit 1) - -make - -DOC_HTML=./doc/publican/Wayland/en-US/html/ - - -e "${DOC_HTML}" || (echo "HTML documentation failed to build at ${DOC_HTML}" && exit 1) - -chmod -R g+x ${DOC_HTML} - -rsync --delete -avz ${DOC_HTML} freedesktop.org:/srv/wayland.freedesktop.org/www/docs/html/
View file
_service:tar_scm:wayland-1.20.0.tar.xz/.gitlab-ci.yml -> _service:tar_scm:wayland-1.21.0.tar.gz/.gitlab-ci.yml
Changed
@@ -74,10 +74,10 @@ BUILD_OS: debian FDO_DISTRIBUTION_VERSION: buster FDO_DISTRIBUTION_PACKAGES: 'build-essential pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl python3-pip python3-setuptools ninja-build' - FDO_DISTRIBUTION_EXEC: 'pip3 install meson==0.52.1' + FDO_DISTRIBUTION_EXEC: 'pip3 install meson==0.56.0' # bump this tag every time you change something which requires rebuilding the # base image - FDO_DISTRIBUTION_TAG: "2021-08-03.0" + FDO_DISTRIBUTION_TAG: "2022-02-05.0" .debian-x86_64: extends:
View file
_service:tar_scm:wayland-1.20.0.tar.xz/cursor/os-compatibility.c -> _service:tar_scm:wayland-1.21.0.tar.gz/cursor/os-compatibility.c
Changed
@@ -31,7 +31,9 @@ #include <unistd.h> #include <fcntl.h> #include <errno.h> +#include <signal.h> #include <string.h> +#include <stdio.h> #include <stdlib.h> #ifdef HAVE_MEMFD_CREATE @@ -118,6 +120,7 @@ static const char template = "/wayland-cursor-shared-XXXXXX"; const char *path; char *name; + size_t name_size; int fd; #ifdef HAVE_MEMFD_CREATE @@ -134,17 +137,17 @@ #endif { path = getenv("XDG_RUNTIME_DIR"); - if (!path) { + if (!path || path0 != '/') { errno = ENOENT; return -1; } - name = malloc(strlen(path) + sizeof(template)); + name_size = strlen(path) + sizeof(template); + name = malloc(name_size); if (!name) return -1; - strcpy(name, path); - strcat(name, template); + snprintf(name, name_size, "%s%s", path, template); fd = create_tmpfile_cloexec(name); @@ -166,11 +169,28 @@ os_resize_anonymous_file(int fd, off_t size) { #ifdef HAVE_POSIX_FALLOCATE - /* - * Filesystems that do support fallocate will return EINVAL or + sigset_t mask; + sigset_t old_mask; + + /* + * posix_fallocate() might be interrupted, so we need to check + * for EINTR and retry in that case. + * However, in the presence of an alarm, the interrupt may trigger + * repeatedly and prevent a large posix_fallocate() to ever complete + * successfully, so we need to first block SIGALRM to prevent + * this. + */ + sigemptyset(&mask); + sigaddset(&mask, SIGALRM); + sigprocmask(SIG_BLOCK, &mask, &old_mask); + /* + * Filesystems that do not support fallocate will return EINVAL or * EOPNOTSUPP. In this case we need to fall back to ftruncate */ - errno = posix_fallocate(fd, 0, size); + do { + errno = posix_fallocate(fd, 0, size); + } while (errno == EINTR); + sigprocmask(SIG_SETMASK, &old_mask, NULL); if (errno == 0) return 0; else if (errno != EINVAL && errno != EOPNOTSUPP)
View file
_service:tar_scm:wayland-1.20.0.tar.xz/cursor/wayland-cursor.c -> _service:tar_scm:wayland-1.21.0.tar.gz/cursor/wayland-cursor.c
Changed
@@ -92,7 +92,7 @@ pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, pool->fd, 0); - if (pool->data == (void *)-1) + if (pool->data == MAP_FAILED) return 0; pool->size = size; @@ -274,7 +274,7 @@ } static struct wl_cursor * -wl_cursor_create_from_xcursor_images(XcursorImages *images, +wl_cursor_create_from_xcursor_images(struct xcursor_images *images, struct wl_cursor_theme *theme) { struct cursor *cursor; @@ -335,13 +335,13 @@ } static void -load_callback(XcursorImages *images, void *data) +load_callback(struct xcursor_images *images, void *data) { struct wl_cursor_theme *theme = data; struct wl_cursor *cursor; if (wl_cursor_theme_get_cursor(theme, images->name)) { - XcursorImagesDestroy(images); + xcursor_images_destroy(images); return; } @@ -361,7 +361,7 @@ } } - XcursorImagesDestroy(images); + xcursor_images_destroy(images); } /** Load a cursor theme to memory shared with the compositor
View file
_service:tar_scm:wayland-1.20.0.tar.xz/cursor/xcursor.c -> _service:tar_scm:wayland-1.21.0.tar.gz/cursor/xcursor.c
Changed
@@ -23,20 +23,15 @@ * SOFTWARE. */ +#define _GNU_SOURCE #include "xcursor.h" +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> /* - * From libXcursor/include/X11/extensions/Xcursor.h - */ - -#define XcursorTrue 1 -#define XcursorFalse 0 - -/* * Cursor files start with a header. The header * contains a magic number, a version number and a * table of contents which has type and offset information @@ -67,43 +62,31 @@ * CARD32 position absolute file position */ -#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */ - -/* - * Current Xcursor version number. Will be substituted by configure - * from the version in the libXcursor configure.ac file. - */ - -#define XCURSOR_LIB_MAJOR 1 -#define XCURSOR_LIB_MINOR 1 -#define XCURSOR_LIB_REVISION 13 -#define XCURSOR_LIB_VERSION ((XCURSOR_LIB_MAJOR * 10000) + \ - (XCURSOR_LIB_MINOR * 100) + \ - (XCURSOR_LIB_REVISION)) +#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */ /* * This version number is stored in cursor files; changes to the * file format require updating this version number */ -#define XCURSOR_FILE_MAJOR 1 -#define XCURSOR_FILE_MINOR 0 -#define XCURSOR_FILE_VERSION ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR)) -#define XCURSOR_FILE_HEADER_LEN (4 * 4) -#define XCURSOR_FILE_TOC_LEN (3 * 4) - -typedef struct _XcursorFileToc { - XcursorUInt type; /* chunk type */ - XcursorUInt subtype; /* subtype (size for images) */ - XcursorUInt position; /* absolute position in file */ -} XcursorFileToc; - -typedef struct _XcursorFileHeader { - XcursorUInt magic; /* magic number */ - XcursorUInt header; /* byte length of header */ - XcursorUInt version; /* file version number */ - XcursorUInt ntoc; /* number of toc entries */ - XcursorFileToc *tocs; /* table of contents */ -} XcursorFileHeader; +#define XCURSOR_FILE_MAJOR 1 +#define XCURSOR_FILE_MINOR 0 +#define XCURSOR_FILE_VERSION ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR)) +#define XCURSOR_FILE_HEADER_LEN (4 * 4) +#define XCURSOR_FILE_TOC_LEN (3 * 4) + +struct xcursor_file_toc { + uint32_t type; /* chunk type */ + uint32_t subtype; /* subtype (size for images) */ + uint32_t position; /* absolute position in file */ +}; + +struct xcursor_file_header { + uint32_t magic; /* magic number */ + uint32_t header; /* byte length of header */ + uint32_t version; /* file version number */ + uint32_t ntoc; /* number of toc entries */ + struct xcursor_file_toc *tocs; /* table of contents */ +}; /* * The rest of the file is a list of chunks, each tagged by type @@ -121,42 +104,14 @@ * CARD32 version chunk type version */ -#define XCURSOR_CHUNK_HEADER_LEN (4 * 4) - -typedef struct _XcursorChunkHeader { - XcursorUInt header; /* bytes in chunk header */ - XcursorUInt type; /* chunk type */ - XcursorUInt subtype; /* chunk subtype (size for images) */ - XcursorUInt version; /* version of this type */ -} XcursorChunkHeader; - -/* - * Here's a list of the known chunk types - */ - -/* - * Comments consist of a 4-byte length field followed by - * UTF-8 encoded text - * - * Comment: - * ChunkHeader header chunk header - * CARD32 length bytes in text - * LISTofCARD8 text UTF-8 encoded text - */ - -#define XCURSOR_COMMENT_TYPE 0xfffe0001 -#define XCURSOR_COMMENT_VERSION 1 -#define XCURSOR_COMMENT_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (1 *4)) -#define XCURSOR_COMMENT_COPYRIGHT 1 -#define XCURSOR_COMMENT_LICENSE 2 -#define XCURSOR_COMMENT_OTHER 3 -#define XCURSOR_COMMENT_MAX_LEN 0x100000 +#define XCURSOR_CHUNK_HEADER_LEN (4 * 4) -typedef struct _XcursorComment { - XcursorUInt version; - XcursorUInt comment_type; - char *comment; -} XcursorComment; +struct xcursor_chunk_header { + uint32_t header; /* bytes in chunk header */ + uint32_t type; /* chunk type */ + uint32_t subtype; /* chunk subtype (size for images) */ + uint32_t version; /* version of this type */ +}; /* * Each cursor image occupies a separate image chunk. @@ -174,439 +129,354 @@ * LISTofCARD32 pixels ARGB pixels */ -#define XCURSOR_IMAGE_TYPE 0xfffd0002 -#define XCURSOR_IMAGE_VERSION 1 -#define XCURSOR_IMAGE_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (5*4)) -#define XCURSOR_IMAGE_MAX_SIZE 0x7fff /* 32767x32767 max cursor size */ - -typedef struct _XcursorFile XcursorFile; - -struct _XcursorFile { - void *closure; - int (*read) (XcursorFile *file, unsigned char *buf, int len); - int (*write) (XcursorFile *file, unsigned char *buf, int len); - int (*seek) (XcursorFile *file, long offset, int whence); -}; - -typedef struct _XcursorComments { - int ncomment; /* number of comments */ - XcursorComment **comments; /* array of XcursorComment pointers */ -} XcursorComments; +#define XCURSOR_IMAGE_TYPE 0xfffd0002 +#define XCURSOR_IMAGE_VERSION 1 +#define XCURSOR_IMAGE_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (5*4)) +#define XCURSOR_IMAGE_MAX_SIZE 0x7fff /* 32767x32767 max cursor size */ /* * From libXcursor/src/file.c */ -static XcursorImage * -XcursorImageCreate (int width, int height) +static struct xcursor_image * +xcursor_image_create(int width, int height) { - XcursorImage *image; - - if (width < 0 || height < 0) - return NULL; - if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE) - return NULL; - - image = malloc (sizeof (XcursorImage) + - width * height * sizeof (XcursorPixel)); - if (!image) - return NULL; - image->version = XCURSOR_IMAGE_VERSION; - image->pixels = (XcursorPixel *) (image + 1); - image->size = width > height ? width : height; - image->width = width; - image->height = height; - image->delay = 0; - return image; + struct xcursor_image *image; + + if (width < 0 || height < 0) + return NULL; + if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE) + return NULL; + + image = malloc(sizeof(struct xcursor_image) + + width * height * sizeof(uint32_t));
View file
_service:tar_scm:wayland-1.20.0.tar.xz/cursor/xcursor.h -> _service:tar_scm:wayland-1.21.0.tar.gz/cursor/xcursor.h
Changed
@@ -28,40 +28,31 @@ #include <stdint.h> -typedef int XcursorBool; -typedef uint32_t XcursorUInt; - -typedef XcursorUInt XcursorDim; -typedef XcursorUInt XcursorPixel; - -typedef struct _XcursorImage { - XcursorUInt version; /* version of the image data */ - XcursorDim size; /* nominal size for matching */ - XcursorDim width; /* actual width */ - XcursorDim height; /* actual height */ - XcursorDim xhot; /* hot spot x (must be inside image) */ - XcursorDim yhot; /* hot spot y (must be inside image) */ - XcursorUInt delay; /* animation delay to next frame (ms) */ - XcursorPixel *pixels; /* pointer to pixels */ -} XcursorImage; +struct xcursor_image { + uint32_t version; /* version of the image data */ + uint32_t size; /* nominal size for matching */ + uint32_t width; /* actual width */ + uint32_t height; /* actual height */ + uint32_t xhot; /* hot spot x (must be inside image) */ + uint32_t yhot; /* hot spot y (must be inside image) */ + uint32_t delay; /* animation delay to next frame (ms) */ + uint32_t *pixels; /* pointer to pixels */ +}; /* * Other data structures exposed by the library API */ -typedef struct _XcursorImages { - int nimage; /* number of images */ - XcursorImage **images; /* array of XcursorImage pointers */ - char *name; /* name used to load images */ -} XcursorImages; - -XcursorImages * -XcursorLibraryLoadImages (const char *file, const char *theme, int size); +struct xcursor_images { + int nimage; /* number of images */ + struct xcursor_image **images; /* array of XcursorImage pointers */ + char *name; /* name used to load images */ +}; void -XcursorImagesDestroy (XcursorImages *images); +xcursor_images_destroy(struct xcursor_images *images); void xcursor_load_theme(const char *theme, int size, - void (*load_callback)(XcursorImages *, void *), - void *user_data); + void (*load_callback)(struct xcursor_images *, void *), + void *user_data); #endif
View file
_service:tar_scm:wayland-1.20.0.tar.xz/doc/doxygen/meson.build -> _service:tar_scm:wayland-1.21.0.tar.gz/doc/doxygen/meson.build
Changed
@@ -13,7 +13,7 @@ doxygen_conf = configuration_data() doxygen_conf.set('VERSION', meson.project_version()) -doxygen_conf.set('top_builddir', meson.build_root()) +doxygen_conf.set('top_builddir', meson.project_build_root()) wayland_doxygen = configure_file( input: 'wayland.doxygen.in', output: 'wayland.doxygen', @@ -76,6 +76,7 @@ # We do not really need an output file, but Meson # will complain if one is not set, so we use a # dummy 'stamp' file + stamp = join_paths(meson.current_build_dir(), '@0@.stamp'.format(t_name)) custom_target( t_name, command: @@ -84,7 +85,7 @@ '--builddir=@OUTDIR@', '--section=@0@'.format(s_name), '--output-format=@0@'.format(f_name), - '--stamp=doc/doxygen/@0@.stamp'.format(t_name), + '--stamp=@0@'.format(stamp), wayland_doxygen, '@INPUT@', , @@ -97,13 +98,14 @@ endforeach man_files = shared_files + server_files + client_files + cursor_files +stamp = join_paths(meson.current_build_dir(), 'man3.stamp') custom_target( 'man-pages-3', command: gen_doxygen, '--builddir=@OUTDIR@', '--output-format=man3', - '--stamp=doc/doxygen/man3.stamp', + '--stamp=@0@'.format(stamp), wayland_doxygen, '@INPUT@', ,
View file
_service:tar_scm:wayland-1.20.0.tar.xz/doc/meson.build -> _service:tar_scm:wayland-1.21.0.tar.gz/doc/meson.build
Changed
@@ -1,3 +1,7 @@ +if not get_option('libraries') + error('-Ddocumentation=true requires -Dlibraries=true') +endif + dot = find_program('dot') doxygen = find_program('doxygen') xsltproc = find_program('xsltproc') @@ -18,7 +22,7 @@ endif manpage_xsl = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' -cmd = run_command(xsltproc, '--nonet', manpage_xsl) +cmd = run_command(xsltproc, '--nonet', manpage_xsl, check: false) if cmd.returncode() != 0 error('The style sheet for man pages providing "@0@" was not found.'.format(manpage_xsl)) endif
View file
_service:tar_scm:wayland-1.20.0.tar.xz/doc/publican/meson.build -> _service:tar_scm:wayland-1.21.0.tar.gz/doc/publican/meson.build
Changed
@@ -7,6 +7,7 @@ command: xmlto, '--skip-validation', + '--stringparam', 'chunker.output.encoding=UTF-8', '--stringparam', 'chunk.section.depth=0', '--stringparam', 'toc.section.depth=1', '--stringparam', 'generate.consistent.ids=1',
View file
_service:tar_scm:wayland-1.20.0.tar.xz/doc/publican/sources/Protocol.xml -> _service:tar_scm:wayland-1.21.0.tar.gz/doc/publican/sources/Protocol.xml
Changed
@@ -149,9 +149,9 @@ <term>string</term> <listitem> <para> - Starts with an unsigned 32-bit length, followed by the - string contents, including terminating null byte, then padding - to a 32-bit boundary. + Starts with an unsigned 32-bit length (including null terminator), + followed by the string contents, including terminating null byte, + then padding to a 32-bit boundary. </para> </listitem> </varlistentry> @@ -194,6 +194,21 @@ </varlistentry> </variablelist> </para> + <para> + The protocol does not specify the exact position of the ancillary data + in the stream, except that the order of file descriptors is the same as + the order of messages and <code>fd</code> arguments within messages on + the wire. + </para> + <para> + In particular, it means that any byte of the stream, even the message + header, may carry the ancillary data with file descriptors. + </para> + <para> + Clients and compositors should queue incoming data until they have + whole messages to process, as file descriptors may arrive earlier + or later than the corresponding data bytes. + </para> </section> <xi:include href="ProtocolInterfaces.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> <section id="sect-Protocol-Versioning">
View file
_service:tar_scm:wayland-1.20.0.tar.xz/egl/meson.build -> _service:tar_scm:wayland-1.21.0.tar.gz/egl/meson.build
Changed
@@ -11,7 +11,7 @@ executable('wayland-egl-abi-check', 'wayland-egl-abi-check.c') -nm_path = find_program('nm').path() +nm_path = find_program('nm').full_path() test( 'wayland-egl symbols check',
View file
_service:tar_scm:wayland-1.20.0.tar.xz/meson.build -> _service:tar_scm:wayland-1.21.0.tar.gz/meson.build
Changed
@@ -1,11 +1,12 @@ project( 'wayland', 'c', - version: '1.20.0', + version: '1.21.0', license: 'MIT', - meson_version: '>= 0.52.1', + meson_version: '>= 0.56.0', default_options: 'warning_level=2', - 'buildtype=debugoptimized' + 'buildtype=debugoptimized', + 'c_std=c99', ) wayland_version = meson.project_version().split('.') @@ -14,6 +15,12 @@ config_h.set_quoted('PACKAGE', meson.project_name()) config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) +cc_args = +if host_machine.system() != 'freebsd' + cc_args += '-D_POSIX_C_SOURCE=200809L' +endif +add_project_arguments(cc_args, language: 'c') + compiler_flags = '-Wno-unused-parameter', '-Wstrict-prototypes', @@ -79,7 +86,7 @@ foreach d: decls - if not cc.has_header_symbol(d'header', d'symbol', dependencies: epoll_dep) + if not cc.has_header_symbol(d'header', d'symbol', dependencies: epoll_dep, args: cc_args) error('@0@ is needed to compile Wayland libraries'.format(d'symbol')) endif endforeach @@ -87,7 +94,7 @@ rt_dep = if not cc.has_function('clock_gettime', prefix: '#include <time.h>') rt_dep = cc.find_library('rt') - if not cc.has_function('clock_gettime', prefix: '#include <time.h>', dependencies: rt_dep) + if not cc.has_function('clock_gettime', prefix: '#include <time.h>', dependencies: rt_dep, args: cc_args) error('clock_gettime not found') endif endif @@ -111,12 +118,12 @@ if get_option('libraries') subdir('cursor') subdir('egl') - if get_option('tests') - subdir('tests') - endif - if get_option('documentation') - subdir('doc') - endif +endif +if get_option('tests') + subdir('tests') +endif +if get_option('documentation') + subdir('doc') endif if get_option('scanner')
View file
_service:tar_scm:wayland-1.20.0.tar.xz/meson_options.txt -> _service:tar_scm:wayland-1.21.0.tar.gz/meson_options.txt
Changed
@@ -1,23 +1,23 @@ option('libraries', description: 'Compile Wayland libraries', type: 'boolean', - value: 'true') + value: true) option('scanner', description: 'Compile wayland-scanner binary', type: 'boolean', - value: 'true') + value: true) option('tests', description: 'Compile Wayland tests', type: 'boolean', - value: 'true') + value: true) option('documentation', description: 'Build the documentation (requires Doxygen, dot, xmlto, xsltproc)', type: 'boolean', - value: 'true') + value: true) option('dtd_validation', description: 'Validate the protocol DTD (requires libxml2)', type: 'boolean', - value: 'true') + value: true) option('icon_directory', description: 'Location used to look for cursors (defaults to ${datadir}/icons if unset)', type: 'string',
View file
_service:tar_scm:wayland-1.20.0.tar.xz/protocol/wayland.xml -> _service:tar_scm:wayland-1.21.0.tar.gz/protocol/wayland.xml
Changed
@@ -258,6 +258,12 @@ for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger. + + This request only changes the amount of bytes that are mmapped + by the server and does not touch the file corresponding to the + file descriptor passed at creation time. It is the client's + responsibility to ensure that the file is at least as big as + the new pool size. </description> <arg name="size" type="int" summary="new size of the pool, in bytes"/> </request> @@ -271,8 +277,8 @@ Clients can create wl_shm_pool objects using the create_pool request. - At connection setup time, the wl_shm object emits one or more - format events to inform clients about the valid pixel formats + On binding the wl_shm object one or more format events + are emitted to inform clients about the valid pixel formats that can be used for buffers. </description> @@ -890,7 +896,7 @@ which will subsequently be used in either the data_device.enter event (for drag-and-drop) or the data_device.selection event (for selections). Immediately - following the data_device_data_offer event, the new data_offer + following the data_device.data_offer event, the new data_offer object will send out data_offer.offer events to describe the mime types it offers. </description> @@ -1051,7 +1057,8 @@ a basic surface. Note! This protocol is deprecated and not intended for production use. - For desktop-style user interfaces, use xdg_shell. + For desktop-style user interfaces, use xdg_shell. Compositors and clients + should not implement this interface. </description> <enum name="error"> @@ -1781,7 +1788,7 @@ </request> </interface> - <interface name="wl_seat" version="7"> + <interface name="wl_seat" version="8"> <description summary="group of input devices"> A seat is a group of keyboards, pointer and touch devices. This object is published as a global during start up, or when such a @@ -1914,7 +1921,7 @@ </interface> - <interface name="wl_pointer" version="7"> + <interface name="wl_pointer" version="8"> <description summary="pointer input device"> The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus @@ -2214,6 +2221,9 @@ This event carries the axis value of the wl_pointer.axis event in discrete steps (e.g. mouse wheel clicks). + This event is deprecated with wl_pointer version 8 - this event is not + sent to clients supporting version 8 or later. + This event does not occur on its own, it is coupled with a wl_pointer.axis event that represents this axis value on a continuous scale. The protocol guarantees that each axis_discrete @@ -2221,7 +2231,8 @@ axis number within the same wl_pointer.frame. Note that the protocol allows for other events to occur between the axis_discrete and its coupled axis event, including other axis_discrete or axis - events. + events. A wl_pointer.frame must not contain more than one axis_discrete + event per axis type. This event is optional; continuous scrolling devices like two-finger scrolling on touchpads do not have discrete @@ -2239,9 +2250,37 @@ <arg name="axis" type="uint" enum="axis" summary="axis type"/> <arg name="discrete" type="int" summary="number of steps"/> </event> + + <event name="axis_value120" since="8"> + <description summary="axis high-resolution scroll event"> + Discrete high-resolution scroll information. + + This event carries high-resolution wheel scroll information, + with each multiple of 120 representing one logical scroll step + (a wheel detent). For example, an axis_value120 of 30 is one quarter of + a logical scroll step in the positive direction, a value120 of + -240 are two logical scroll steps in the negative direction within the + same hardware event. + Clients that rely on discrete scrolling should accumulate the + value120 to multiples of 120 before processing the event. + + The value120 must not be zero. + + This event replaces the wl_pointer.axis_discrete event in clients + supporting wl_pointer version 8 or later. + + Where a wl_pointer.axis_source event occurs in the same + wl_pointer.frame, the axis source applies to this event. + + The order of wl_pointer.axis_value120 and wl_pointer.axis_source is + not guaranteed. + </description> + <arg name="axis" type="uint" enum="axis" summary="axis type"/> + <arg name="value120" type="int" summary="scroll distance as fraction of 120"/> + </event> </interface> - <interface name="wl_keyboard" version="7"> + <interface name="wl_keyboard" version="8"> <description summary="keyboard input device"> The wl_keyboard interface represents one or more keyboards associated with a seat. @@ -2255,7 +2294,7 @@ <entry name="no_keymap" value="0" summary="no keymap; client must understand how to interpret the raw keycode"/> <entry name="xkb_v1" value="1" - summary="libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode"/> + summary="libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode"/> </enum> <event name="keymap"> @@ -2368,7 +2407,7 @@ </event> </interface> - <interface name="wl_touch" version="7"> + <interface name="wl_touch" version="8"> <description summary="touchscreen input device"> The wl_touch interface represents a touchscreen associated with a seat.
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/connection.c -> _service:tar_scm:wayland-1.21.0.tar.gz/src/connection.c
Changed
@@ -231,7 +231,7 @@ } static void -build_cmsg(struct wl_ring_buffer *buffer, char *data, int *clen) +build_cmsg(struct wl_ring_buffer *buffer, char *data, size_t *clen) { struct cmsghdr *cmsg; size_t size; @@ -289,9 +289,10 @@ wl_connection_flush(struct wl_connection *connection) { struct iovec iov2; - struct msghdr msg; + struct msghdr msg = {0}; char cmsgCLEN; - int len = 0, count, clen; + int len = 0, count; + size_t clen; uint32_t tail; if (!connection->want_flush) @@ -303,13 +304,10 @@ build_cmsg(&connection->fds_out, cmsg, &clen); - msg.msg_name = NULL; - msg.msg_namelen = 0; msg.msg_iov = iov; msg.msg_iovlen = count; msg.msg_control = (clen > 0) ? cmsg : NULL; msg.msg_controllen = clen; - msg.msg_flags = 0; do { len = sendmsg(connection->fd, &msg, @@ -568,10 +566,10 @@ if (size) { *num_arrays = wl_message_count_arrays(message); - closure = malloc(sizeof *closure + size + + closure = zalloc(sizeof *closure + size + *num_arrays * sizeof(struct wl_array)); } else { - closure = malloc(sizeof *closure); + closure = zalloc(sizeof *closure); } if (!closure) { @@ -810,10 +808,12 @@ } if (wl_map_reserve_new(objects, id) < 0) { - wl_log("not a valid new object id (%u), " - "message %s(%s)\n", - id, message->name, message->signature); - errno = EINVAL; + if (errno == EINVAL) { + wl_log("not a valid new object id (%u), " + "message %s(%s)\n", id, + message->name, + message->signature); + } goto err; } @@ -1272,11 +1272,18 @@ struct timespec tp; unsigned int time; uint32_t nval; + FILE *f; + char *buffer; + size_t buffer_length; + + f = open_memstream(&buffer, &buffer_length); + if (f == NULL) + return; clock_gettime(CLOCK_REALTIME, &tp); time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000); - fprintf(stderr, "%7u.%03u %s%s%s@%u.%s(", + fprintf(f, "%7u.%03u %s%s%s@%u.%s(", time / 1000, time % 1000, discarded ? "discarded " : "", send ? " -> " : "", @@ -1286,41 +1293,41 @@ for (i = 0; i < closure->count; i++) { signature = get_next_argument(signature, &arg); if (i > 0) - fprintf(stderr, ", "); + fprintf(f, ", "); switch (arg.type) { case 'u': - fprintf(stderr, "%u", closure->argsi.u); + fprintf(f, "%u", closure->argsi.u); break; case 'i': - fprintf(stderr, "%d", closure->argsi.i); + fprintf(f, "%d", closure->argsi.i); break; case 'f': /* The magic number 390625 is 1e8 / 256 */ if (closure->argsi.f >= 0) { - fprintf(stderr, "%d.%08d", + fprintf(f, "%d.%08d", closure->argsi.f / 256, 390625 * (closure->argsi.f % 256)); } else { - fprintf(stderr, "-%d.%08d", + fprintf(f, "-%d.%08d", closure->argsi.f / -256, -390625 * (closure->argsi.f % 256)); } break; case 's': if (closure->argsi.s) - fprintf(stderr, "\"%s\"", closure->argsi.s); + fprintf(f, "\"%s\"", closure->argsi.s); else - fprintf(stderr, "nil"); + fprintf(f, "nil"); break; case 'o': if (closure->argsi.o) - fprintf(stderr, "%s@%u", + fprintf(f, "%s@%u", closure->argsi.o->interface->name, closure->argsi.o->id); else - fprintf(stderr, "nil"); + fprintf(f, "nil"); break; case 'n': if (n_parse) @@ -1328,25 +1335,30 @@ else nval = closure->argsi.n; - fprintf(stderr, "new id %s@", + fprintf(f, "new id %s@", (closure->message->typesi) ? closure->message->typesi->name : "unknown"); if (nval != 0) - fprintf(stderr, "%u", nval); + fprintf(f, "%u", nval); else - fprintf(stderr, "nil"); + fprintf(f, "nil"); break; case 'a': - fprintf(stderr, "array%zu", closure->argsi.a->size); + fprintf(f, "array%zu", closure->argsi.a->size); break; case 'h': - fprintf(stderr, "fd %d", closure->argsi.h); + fprintf(f, "fd %d", closure->argsi.h); break; } } - fprintf(stderr, ")\n"); + fprintf(f, ")\n"); + + if (fclose(f) == 0) { + fprintf(stderr, "%s", buffer); + free(buffer); + } } static int
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/event-loop.c -> _service:tar_scm:wayland-1.21.0.tar.gz/src/event-loop.c
Changed
@@ -179,7 +179,7 @@ { struct wl_event_source_fd *source; - source = malloc(sizeof *source); + source = zalloc(sizeof *source); if (source == NULL) return NULL; @@ -568,7 +568,7 @@ if (wl_timer_heap_ensure_timerfd(&loop->timers) < 0) return NULL; - source = malloc(sizeof *source); + source = zalloc(sizeof *source); if (source == NULL) return NULL; @@ -718,7 +718,7 @@ struct wl_event_source_signal *source; sigset_t mask; - source = malloc(sizeof *source); + source = zalloc(sizeof *source); if (source == NULL) return NULL; @@ -775,7 +775,7 @@ { struct wl_event_source_idle *source; - source = malloc(sizeof *source); + source = zalloc(sizeof *source); if (source == NULL) return NULL; @@ -885,7 +885,7 @@ { struct wl_event_loop *loop; - loop = malloc(sizeof *loop); + loop = zalloc(sizeof *loop); if (loop == NULL) return NULL;
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/meson.build -> _service:tar_scm:wayland-1.21.0.tar.gz/src/meson.build
Changed
@@ -1,3 +1,7 @@ +if not (get_option('scanner') or get_option('libraries')) + error('Either -Dscanner=true or -Dlibraries=true is required') +endif + wayland_version_h = configuration_data() wayland_version_h.set('WAYLAND_VERSION', meson.project_version()) wayland_version_h.set('WAYLAND_VERSION_MAJOR', wayland_version0.to_int()) @@ -67,11 +71,15 @@ , filebase: 'wayland-scanner' ) + + if meson.can_run_host_binaries() + meson.override_find_program('wayland-scanner', wayland_scanner) + endif endif if meson.is_cross_build() or not get_option('scanner') scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version()) - wayland_scanner_for_build = find_program(scanner_dep.get_pkgconfig_variable('wayland_scanner')) + wayland_scanner_for_build = find_program(scanner_dep.get_variable(pkgconfig: 'wayland_scanner')) else wayland_scanner_for_build = wayland_scanner endif
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-client.c -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-client.c
Changed
@@ -343,7 +343,7 @@ { struct wl_event_queue *queue; - queue = malloc(sizeof *queue); + queue = zalloc(sizeof *queue); if (queue == NULL) return NULL; @@ -430,6 +430,10 @@ proxy->version = version; proxy->object.id = wl_map_insert_new(&display->objects, 0, proxy); + if (proxy->object.id == 0) { + free(proxy); + return NULL; + } return proxy; } @@ -485,7 +489,10 @@ proxy->refcount = 1; proxy->version = factory->version; - wl_map_insert_at(&display->objects, 0, id, proxy); + if (wl_map_insert_at(&display->objects, 0, id, proxy) == -1) { + free(proxy); + return NULL; + } return proxy; } @@ -1069,8 +1076,8 @@ path_is_absolute = name0 == '/'; runtime_dir = getenv("XDG_RUNTIME_DIR"); - if (!runtime_dir && !path_is_absolute) { - wl_log("error: XDG_RUNTIME_DIR not set in the environment.\n"); + if (((!runtime_dir || runtime_dir0 != '/') && !path_is_absolute)) { + wl_log("error: XDG_RUNTIME_DIR is invalid or not set in the environment.\n"); /* to prevent programs reporting * "failed to create display: Success" */ errno = ENOENT; @@ -1155,11 +1162,16 @@ pthread_cond_init(&display->reader_cond, NULL); display->reader_count = 0; - wl_map_insert_new(&display->objects, 0, NULL); + if (wl_map_insert_at(&display->objects, 0, 0, NULL) == -1) + goto err_connection; - display->proxy.object.interface = &wl_display_interface; display->proxy.object.id = wl_map_insert_new(&display->objects, 0, display); + + if (display->proxy.object.id == 0) + goto err_connection; + + display->proxy.object.interface = &wl_display_interface; display->proxy.display = display; display->proxy.object.implementation = (void(**)(void)) &display_listener; display->proxy.user_data = display; @@ -2299,6 +2311,19 @@ * queued in \c queue from now. If queue is NULL, then the display's * default queue is set to the proxy. * + * In order to guarantee proper handing of all events which were queued + * before the queue change takes effect, it is required to dispatch the + * proxy's old event queue after setting a new event queue. + * + * This is particularly important for multi-threaded setups, where it is + * possible for events to be queued to the proxy's old queue from a + * different thread during the invocation of this function. + * + * To ensure that all events for a newly created proxy are dispatched + * on a particular queue, it is necessary to use a proxy wrapper if + * events are read and dispatched on more than one thread. See + * wl_proxy_create_wrapper() for more details. + * * \note By default, the queue set in proxy is the one inherited from parent. * * \sa wl_display_dispatch_queue() @@ -2308,12 +2333,16 @@ WL_EXPORT void wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue) { + pthread_mutex_lock(&proxy->display->mutex); + if (queue) { assert(proxy->display == queue->display); proxy->queue = queue; } else { proxy->queue = &proxy->display->default_queue; } + + pthread_mutex_unlock(&proxy->display->mutex); } /** Create a proxy wrapper for making queue assignments thread-safe
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-os.c -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-os.c
Changed
@@ -231,21 +231,22 @@ ssize_t new_size, int prot, int flags) { void *result; - /* - * We could try mapping a new block immediately after the current one + + /* Make sure any pending write is flushed. */ + if (msync(old_data, *old_size, MS_SYNC) != 0) + return MAP_FAILED; + + /* We could try mapping a new block immediately after the current one * with MAP_FIXED, however that is not guaranteed to work and breaks * on CHERI-enabled architectures since the data pointer will still - * have the bounds of the previous allocation. As this is not a - * performance-critical path, we always map a new region and copy the - * old data to the new region. + * have the bounds of the previous allocation. */ result = mmap(NULL, new_size, prot, flags, fd, 0); - if (result != MAP_FAILED) { - /* Copy the data over and unmap the old mapping. */ - memcpy(result, old_data, *old_size); - if (munmap(old_data, *old_size) == 0) { - *old_size = 0; /* successfully unmapped old data. */ - } - } + if (result == MAP_FAILED) + return MAP_FAILED; + + if (munmap(old_data, *old_size) == 0) + *old_size = 0; + return result; }
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-private.h -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-private.h
Changed
@@ -45,6 +45,7 @@ #define WL_MAP_SERVER_SIDE 0 #define WL_MAP_CLIENT_SIDE 1 #define WL_SERVER_ID_START 0xff000000 +#define WL_MAP_MAX_OBJECTS 0x00f00000 #define WL_CLOSURE_MAX_ARGS 20 struct wl_object {
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-server-core.h -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-server-core.h
Changed
@@ -279,6 +279,9 @@ const struct wl_interface * wl_global_get_interface(const struct wl_global *global); +uint32_t +wl_global_get_version(const struct wl_global *global); + struct wl_display * wl_global_get_display(const struct wl_global *global); @@ -481,6 +484,9 @@ l->notify(l, data); } +void +wl_signal_emit_mutable(struct wl_signal *signal, void *data); + typedef void (*wl_resource_destroy_func_t)(struct wl_resource *resource); /*
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-server.c -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-server.c
Changed
@@ -578,6 +578,9 @@ * SO_PEERCRED, on the client socket fd. All the pointers can be * NULL, if the caller is not interested in a particular ID. * + * Note, process IDs are subject to race conditions and are not a reliable way + * to identify a client. + * * Be aware that for clients that a compositor forks and execs and * then connects using socketpair(), this function will return the * credentials for the compositor. The credentials for the socketpair @@ -1062,7 +1065,7 @@ if (debug && (strstr(debug, "server") || strstr(debug, "1"))) debug_server = 1; - display = malloc(sizeof *display); + display = zalloc(sizeof *display); if (display == NULL) return NULL; @@ -1205,6 +1208,10 @@ * Setting the filter NULL will result in all globals being * advertised to all clients. The default is no filter. * + * The filter should be installed before any client connects and should always + * take the same decision given a client and a global. Not doing so will result + * in inconsistent filtering and broken wl_registry event sequences. + * * \memberof wl_display */ WL_EXPORT void @@ -1238,7 +1245,7 @@ return NULL; } - global = malloc(sizeof *global); + global = zalloc(sizeof *global); if (global == NULL) return NULL; @@ -1252,11 +1259,12 @@ wl_list_insert(display->global_list.prev, &global->link); wl_list_for_each(resource, &display->registry_resource_list, link) - wl_resource_post_event(resource, - WL_REGISTRY_GLOBAL, - global->name, - global->interface->name, - global->version); + if (wl_global_is_visible(resource->client, global)) + wl_resource_post_event(resource, + WL_REGISTRY_GLOBAL, + global->name, + global->interface->name, + global->version); return global; } @@ -1294,8 +1302,9 @@ global->name); wl_list_for_each(resource, &display->registry_resource_list, link) - wl_resource_post_event(resource, WL_REGISTRY_GLOBAL_REMOVE, - global->name); + if (wl_global_is_visible(resource->client, global)) + wl_resource_post_event(resource, WL_REGISTRY_GLOBAL_REMOVE, + global->name); global->removed = true; } @@ -1315,6 +1324,20 @@ return global->interface; } +/** Get the version of the given global. + * + * \param global The global object. + * \return The version advertised by the global. + * + * \memberof wl_global + * \since 1.21 + */ +WL_EXPORT uint32_t +wl_global_get_version(const struct wl_global *global) +{ + return global->version; +} + /** Get the display object for the given global * * \param global The global object @@ -1543,8 +1566,9 @@ if (name0 != '/') { runtime_dir = getenv("XDG_RUNTIME_DIR"); - if (!runtime_dir) { - wl_log("error: XDG_RUNTIME_DIR not set in the environment\n"); + if (!runtime_dir || runtime_dir0 != '/') { + wl_log("error: XDG_RUNTIME_DIR is invalid or not set in" + " the environment\n"); /* to prevent programs reporting * "failed to add socket: Success" */ @@ -1704,7 +1728,7 @@ * * If the socket name is a relative path, the Unix socket will be created in * the directory pointed to by environment variable XDG_RUNTIME_DIR. If - * XDG_RUNTIME_DIR is not set, then this function fails and returns -1. + * XDG_RUNTIME_DIR is invalid or not set, then this function fails and returns -1. * * If the socket name is an absolute path, then it is used as-is for the * the Unix socket. @@ -1822,12 +1846,17 @@ { struct wl_resource *resource; - resource = malloc(sizeof *resource); + resource = zalloc(sizeof *resource); if (resource == NULL) return NULL; - if (id == 0) + if (id == 0) { id = wl_map_insert_new(&client->objects, 0, NULL); + if (id == 0) { + free(resource); + return NULL; + } + } resource->object.id = id; resource->object.interface = interface; @@ -1843,9 +1872,11 @@ resource->dispatcher = NULL; if (wl_map_insert_at(&client->objects, 0, id, resource) < 0) { - wl_resource_post_error(client->display_resource, - WL_DISPLAY_ERROR_INVALID_OBJECT, - "invalid new id %d", id); + if (errno == EINVAL) { + wl_resource_post_error(client->display_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "invalid new id %d", id); + } free(resource); return NULL; } @@ -1888,7 +1919,7 @@ { struct wl_protocol_logger *logger; - logger = malloc(sizeof *logger); + logger = zalloc(sizeof *logger); if (!logger) return NULL; @@ -2089,6 +2120,69 @@ wl_map_for_each(&client->objects, resource_iterator_helper, &context); } +static void +handle_noop(struct wl_listener *listener, void *data) +{ + /* Do nothing */ +} + +/** Emits this signal, notifying all registered listeners. + * + * A safer version of wl_signal_emit() which can gracefully handle additions + * and deletions of any signal listener from within listener notification + * callbacks. + * + * Listeners deleted during a signal emission and which have not already been + * notified at the time of deletion are not notified by that emission. + * + * Listeners added (or readded) during signal emission are ignored by that + * emission. + * + * Note that repurposing a listener without explicitly removing it and readding + * it is not supported and can lead to unexpected behavior. + * + * \param signal The signal object that will emit the signal + * \param data The data that will be emitted with the signal + * + * \memberof wl_signal + * \since 1.20.90 + */ +WL_EXPORT void +wl_signal_emit_mutable(struct wl_signal *signal, void *data) +{ + struct wl_listener cursor; + struct wl_listener end; + + /* Add two special markers: one cursor and one end marker. This way, we + * know that we've already called listeners on the left of the cursor + * and that we don't want to call listeners on the right of the end + * marker. The 'it' function can remove any element it wants from the + * list without troubles. + * + * There was a previous attempt that used to steal the whole list of + * listeners but then that broke wl_signal_get().
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-shm.c -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-shm.c
Changed
@@ -65,10 +65,12 @@ char *data; ssize_t size; ssize_t new_size; +#ifndef MREMAP_MAYMOVE /* The following three fields are needed for mremap() emulation. */ int mmap_fd; int mmap_flags; int mmap_prot; +#endif bool sigbus_is_impossible; }; @@ -153,7 +155,9 @@ return; munmap(pool->data, pool->size); +#ifndef MREMAP_MAYMOVE close(pool->mmap_fd); +#endif free(pool); } @@ -223,7 +227,7 @@ return; } - buffer = malloc(sizeof *buffer); + buffer = zalloc(sizeof *buffer); if (buffer == NULL) { wl_client_post_no_memory(client); return; @@ -312,7 +316,7 @@ goto err_close; } - pool = malloc(sizeof *pool); + pool = zalloc(sizeof *pool); if (pool == NULL) { wl_client_post_no_memory(client); goto err_close; @@ -344,10 +348,14 @@ strerror(errno)); goto err_free; } +#ifndef MREMAP_MAYMOVE /* We may need to keep the fd, prot and flags to emulate mremap(). */ pool->mmap_fd = fd; pool->mmap_prot = prot; pool->mmap_flags = flags; +#else + close(fd); +#endif pool->resource = wl_resource_create(client, &wl_shm_pool_interface, 1, id); if (!pool->resource) {
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-util.c -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-util.c
Changed
@@ -24,6 +24,7 @@ * SOFTWARE. */ +#include <errno.h> #include <stdlib.h> #include <stdint.h> #include <stdio.h> @@ -197,6 +198,7 @@ union map_entry *start, *entry; struct wl_array *entries; uint32_t base; + uint32_t count; if (map->side == WL_MAP_CLIENT_SIDE) { entries = &map->client_entries; @@ -217,10 +219,26 @@ start = entries->data; } + /* wl_array only grows, so if we have too many objects at + * this point there's no way to clean up. We could be more + * pro-active about trying to avoid this allocation, but + * it doesn't really matter because at this point there is + * nothing to be done but disconnect the client and delete + * the whole array either way. + */ + count = entry - start; + if (count > WL_MAP_MAX_OBJECTS) { + /* entry->data is freshly malloced garbage, so we'd + * better make it a NULL so wl_map_for_each doesn't + * dereference it later. */ + entry->data = NULL; + errno = ENOSPC; + return 0; + } entry->data = data; entry->next |= (flags & 0x1) << 1; - return (entry - start) + base; + return count + base; } int @@ -237,12 +255,21 @@ i -= WL_SERVER_ID_START; } + if (i > WL_MAP_MAX_OBJECTS) { + errno = ENOSPC; + return -1; + } + count = entries->size / sizeof *start; - if (count < i) + if (count < i) { + errno = EINVAL; return -1; + } - if (count == i) - wl_array_add(entries, sizeof *start); + if (count == i) { + if (!wl_array_add(entries, sizeof *start)) + return -1; + } start = entries->data; starti.data = data; @@ -259,30 +286,43 @@ struct wl_array *entries; if (i < WL_SERVER_ID_START) { - if (map->side == WL_MAP_CLIENT_SIDE) + if (map->side == WL_MAP_CLIENT_SIDE) { + errno = EINVAL; return -1; + } entries = &map->client_entries; } else { - if (map->side == WL_MAP_SERVER_SIDE) + if (map->side == WL_MAP_SERVER_SIDE) { + errno = EINVAL; return -1; + } entries = &map->server_entries; i -= WL_SERVER_ID_START; } - count = entries->size / sizeof *start; + if (i > WL_MAP_MAX_OBJECTS) { + errno = ENOSPC; + return -1; + } - if (count < i) + count = entries->size / sizeof *start; + if (count < i) { + errno = EINVAL; return -1; + } if (count == i) { - wl_array_add(entries, sizeof *start); + if (!wl_array_add(entries, sizeof *start)) + return -1; + start = entries->data; starti.data = NULL; } else { start = entries->data; if (starti.data != NULL) { + errno = EINVAL; return -1; } }
View file
_service:tar_scm:wayland-1.20.0.tar.xz/src/wayland-util.h -> _service:tar_scm:wayland-1.21.0.tar.gz/src/wayland-util.h
Changed
@@ -182,7 +182,7 @@ * For example, consider a protocol interface `foo`, marked as version `1`, with * two requests and one event. * - * \code + * \code{.xml} * <interface name="foo" version="1"> * <request name="a"></request> * <request name="b"></request>
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/compositor-introspection-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/compositor-introspection-test.c
Changed
@@ -40,7 +40,7 @@ require_xdg_runtime_dir(void) { char *val = getenv("XDG_RUNTIME_DIR"); - assert(val && "set $XDG_RUNTIME_DIR to run this test"); + assert(val && val0 == '/' && "set $XDG_RUNTIME_DIR to run this test"); return val; }
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/data/example-client.h -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/data/example-client.h
Changed
@@ -2400,7 +2400,7 @@ * which will subsequently be used in either the data_device.enter * event (for drag-and-drop) or the data_device.selection event * (for selections). Immediately following the - * data_device_data_offer event, the new data_offer object will + * data_device.data_offer event, the new data_offer object will * send out data_offer.offer events to describe the mime types it * offers. * @param id the new data_offer object
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/data/example.xml -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/data/example.xml
Changed
@@ -812,7 +812,7 @@ which will subsequently be used in either the data_device.enter event (for drag-and-drop) or the data_device.selection event (for selections). Immediately - following the data_device_data_offer event, the new data_offer + following the data_device.data_offer event, the new data_offer object will send out data_offer.offer events to describe the mime types it offers. </description>
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/display-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/display-test.c
Changed
@@ -24,6 +24,7 @@ * SOFTWARE. */ +#define _GNU_SOURCE #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -1005,9 +1006,16 @@ } } +static void +registry_handle_remove_filtered(void *data, struct wl_registry *registry, + uint32_t id) +{ + assert(false); +} + static const struct wl_registry_listener registry_listener_filtered = { registry_handle_filtered, - NULL + registry_handle_remove_filtered, }; static void @@ -1044,6 +1052,58 @@ } static void +get_dynamic_globals(void *data) +{ + struct client *c = client_connect(); + struct wl_registry *registry; + + registry = wl_display_get_registry(c->wl_display); + wl_registry_add_listener(registry, ®istry_listener_filtered, data); + wl_display_roundtrip(c->wl_display); + + /* Wait for the server to create a new global */ + assert(stop_display(c, 1) >= 0); + + /* Check that we don't see it */ + wl_display_roundtrip(c->wl_display); + + /* Wait for the server to remove that global */ + assert(stop_display(c, 1) >= 0); + + /* Check that we don't get a global_remove event */ + wl_display_roundtrip(c->wl_display); + + wl_registry_destroy(registry); + client_disconnect_nocheck(c); +} + +TEST(filtered_dynamic_global_is_hidden) +{ + struct display *d; + struct wl_global *g; + + d = display_create(); + wl_display_set_global_filter(d->wl_display, global_filter, NULL); + + /* Create a client and let it enumerate the globals */ + client_create_noarg(d, get_dynamic_globals); + display_run(d); + + /* Dynamically create a new global */ + g = wl_global_create(d->wl_display, &wl_data_offer_interface, + 1, d, bind_data_offer); + + display_resume(d); + + /* Dynamically remove the global */ + wl_global_destroy(g); + + display_resume(d); + + display_destroy(d); +} + +static void check_bind_error(struct client *c) { uint32_t errorcode, id;
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/event-loop-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/event-loop-test.c
Changed
@@ -24,6 +24,7 @@ * SOFTWARE. */ +#define _GNU_SOURCE #include <stdlib.h> #include <stdint.h> #include <assert.h>
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/fixed-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/fixed-test.c
Changed
@@ -23,6 +23,7 @@ * SOFTWARE. */ +#define _GNU_SOURCE #include <stdlib.h> #include <stdio.h> #include <assert.h>
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/meson.build -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/meson.build
Changed
@@ -1,3 +1,7 @@ +if not get_option('libraries') + error('-Dtests=true requires -Dlibraries=true') +endif + test_runner = static_library( 'test-runner', sources: @@ -65,7 +69,7 @@ dependencies: test_runner_dep ) -if add_languages('cpp') +if add_languages('cpp', native: false) test( 'cpp-compile-test', executable( @@ -77,7 +81,7 @@ ) endif -sed_path = find_program('sed').path() +sed_path = find_program('sed').full_path() if get_option('scanner') test(
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/os-wrappers-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/os-wrappers-test.c
Changed
@@ -70,7 +70,7 @@ #define REAL(func) (__interceptor_ ## func) ? \ __interceptor_ ## func : \ - (typeof(&__interceptor_ ## func))dlsym(RTLD_NEXT, #func) + (__typeof__(&__interceptor_ ## func))dlsym(RTLD_NEXT, #func) DECL(int, socket, int, int, int); DECL(int, fcntl, int, int, ...);
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/protocol-logger-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/protocol-logger-test.c
Changed
@@ -40,7 +40,7 @@ require_xdg_runtime_dir(void) { char *val = getenv("XDG_RUNTIME_DIR"); - assert(val && "set $XDG_RUNTIME_DIR to run this test"); + assert(val && val0 == '/' && "set $XDG_RUNTIME_DIR to run this test"); return val; }
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/sanity-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/sanity-test.c
Changed
@@ -174,7 +174,7 @@ { struct display *d = display_create(); - client_create_noarg(d, sanity_fd_leak); + client_create_noarg(d, sanity_fd_leak_exec); display_run(d); test_disable_coredumps();
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/signal-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/signal-test.c
Changed
@@ -115,3 +115,44 @@ assert(3 * counter == count); } + +struct signal_emit_mutable_data { + int count; + struct wl_listener *remove_listener; +}; + +static void +signal_notify_mutable(struct wl_listener *listener, void *data) +{ + struct signal_emit_mutable_data *test_data = data; + test_data->count++; +} + +static void +signal_notify_and_remove_mutable(struct wl_listener *listener, void *data) +{ + struct signal_emit_mutable_data *test_data = data; + signal_notify_mutable(listener, test_data); + wl_list_remove(&test_data->remove_listener->link); +} + +TEST(signal_emit_mutable) +{ + struct signal_emit_mutable_data data = {0}; + + /* l2 will remove l3 before l3 is notified */ + struct wl_signal signal; + struct wl_listener l1 = {.notify = signal_notify_mutable}; + struct wl_listener l2 = {.notify = signal_notify_and_remove_mutable}; + struct wl_listener l3 = {.notify = signal_notify_mutable}; + + wl_signal_init(&signal); + wl_signal_add(&signal, &l1); + wl_signal_add(&signal, &l2); + wl_signal_add(&signal, &l3); + + data.remove_listener = &l3; + wl_signal_emit_mutable(&signal, &data); + + assert(data.count == 2); +}
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/socket-test.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/socket-test.c
Changed
@@ -51,7 +51,7 @@ require_xdg_runtime_dir(void) { char *val = getenv("XDG_RUNTIME_DIR"); - assert(val && "set $XDG_RUNTIME_DIR to run this test"); + assert(val && val0 == '/' && "set $XDG_RUNTIME_DIR to run this test"); return val; }
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/test-compositor.h -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/test-compositor.h
Changed
@@ -25,6 +25,7 @@ #include <stdint.h> #include <unistd.h> +#include <stdatomic.h> #include "wayland-server.h" #include "wayland-client.h" @@ -65,7 +66,7 @@ struct wl_display *wl_display; struct test_compositor *tc; - int display_stopped; + atomic_bool display_stopped; }; struct client *client_connect(void);
View file
_service:tar_scm:wayland-1.20.0.tar.xz/tests/test-runner.c -> _service:tar_scm:wayland-1.21.0.tar.gz/tests/test-runner.c
Changed
@@ -180,7 +180,7 @@ xrd_env = getenv("XDG_RUNTIME_DIR"); /* if XDG_RUNTIME_DIR is not set in environ, fallback to /tmp */ assert((snprintf(xdg_runtime_dir, PATH_MAX, "%s/wayland-tests-XXXXXX", - xrd_env ? xrd_env : "/tmp") < PATH_MAX) + (xrd_env && xrd_env0 == '/') ? xrd_env : "/tmp") < PATH_MAX) && "test error: XDG_RUNTIME_DIR too long"); assert(mkdtemp(xdg_runtime_dir) && "test error: mkdtemp failed"); @@ -200,7 +200,7 @@ rmdir_xdg_runtime_dir(void) { const char *xrd_env = getenv("XDG_RUNTIME_DIR"); - assert(xrd_env && "No XDG_RUNTIME_DIR set"); + assert(xrd_env && xrd_env0 == '/' && "No XDG_RUNTIME_DIR set"); /* rmdir may fail if some test didn't do clean up */ if (rmdir(xrd_env) == -1)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2