diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /widget/gtk/wayland | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/gtk/wayland')
-rw-r--r-- | widget/gtk/wayland/gbm.h | 480 | ||||
-rw-r--r-- | widget/gtk/wayland/gtk-primary-selection-client-protocol.h | 580 | ||||
-rw-r--r-- | widget/gtk/wayland/gtk-primary-selection-protocol.c | 115 | ||||
-rw-r--r-- | widget/gtk/wayland/idle-inhibit-unstable-v1-client-protocol.h | 228 | ||||
-rw-r--r-- | widget/gtk/wayland/idle-inhibit-unstable-v1-protocol.c | 60 | ||||
-rw-r--r-- | widget/gtk/wayland/linux-dmabuf-unstable-v1-client-protocol.h | 650 | ||||
-rw-r--r-- | widget/gtk/wayland/linux-dmabuf-unstable-v1-protocol.c | 81 | ||||
-rw-r--r-- | widget/gtk/wayland/moz.build | 35 | ||||
-rw-r--r-- | widget/gtk/wayland/primary-selection-unstable-v1-client-protocol.h | 578 | ||||
-rw-r--r-- | widget/gtk/wayland/primary-selection-unstable-v1-protocol.c | 115 | ||||
-rw-r--r-- | widget/gtk/wayland/va_drmcommon.h | 156 | ||||
-rw-r--r-- | widget/gtk/wayland/xdg-output-unstable-v1-client-protocol.h | 392 | ||||
-rw-r--r-- | widget/gtk/wayland/xdg-output-unstable-v1-protocol.c | 74 |
13 files changed, 3544 insertions, 0 deletions
diff --git a/widget/gtk/wayland/gbm.h b/widget/gtk/wayland/gbm.h new file mode 100644 index 0000000000..bd94fa8967 --- /dev/null +++ b/widget/gtk/wayland/gbm.h @@ -0,0 +1,480 @@ +/* + * Copyright © 2011 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Benjamin Franzke <benjaminfranzke@googlemail.com> + */ + +#ifndef _GBM_H_ +#define _GBM_H_ + +#define __GBM__ 1 + +#include <stddef.h> +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file gbm.h + * \brief Generic Buffer Manager + */ + +struct gbm_device; +struct gbm_bo; +struct gbm_surface; + +/** + * \mainpage The Generic Buffer Manager + * + * This module provides an abstraction that the caller can use to request a + * buffer from the underlying memory management system for the platform. + * + * This allows the creation of portable code whilst still allowing access to + * the underlying memory manager. + */ + +/** + * Abstraction representing the handle to a buffer allocated by the + * manager + */ +union gbm_bo_handle { + void* ptr; + int32_t s32; + uint32_t u32; + int64_t s64; + uint64_t u64; +}; + +/** Format of the allocated buffer */ +enum gbm_bo_format { + /** RGB with 8 bits per channel in a 32 bit value */ + GBM_BO_FORMAT_XRGB8888, + /** ARGB with 8 bits per channel in a 32 bit value */ + GBM_BO_FORMAT_ARGB8888 +}; + +/** + * The FourCC format codes are taken from the drm_fourcc.h definition, and + * re-namespaced. New GBM formats must not be added, unless they are + * identical ports from drm_fourcc. + */ +#define __gbm_fourcc_code(a, b, c, d) \ + ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | \ + ((uint32_t)(d) << 24)) + +#define GBM_FORMAT_BIG_ENDIAN \ + (1 << 31) /* format is big endian instead of little endian */ + +/* color index */ +#define GBM_FORMAT_C8 __gbm_fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ + +/* 8 bpp Red */ +#define GBM_FORMAT_R8 __gbm_fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ + +/* 16 bpp RG */ +#define GBM_FORMAT_GR88 \ + __gbm_fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ + +/* 8 bpp RGB */ +#define GBM_FORMAT_RGB332 \ + __gbm_fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ +#define GBM_FORMAT_BGR233 \ + __gbm_fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ + +/* 16 bpp RGB */ +#define GBM_FORMAT_XRGB4444 \ + __gbm_fourcc_code('X', 'R', '1', \ + '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ +#define GBM_FORMAT_XBGR4444 \ + __gbm_fourcc_code('X', 'B', '1', \ + '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ +#define GBM_FORMAT_RGBX4444 \ + __gbm_fourcc_code('R', 'X', '1', \ + '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ +#define GBM_FORMAT_BGRX4444 \ + __gbm_fourcc_code('B', 'X', '1', \ + '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ + +#define GBM_FORMAT_ARGB4444 \ + __gbm_fourcc_code('A', 'R', '1', \ + '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ +#define GBM_FORMAT_ABGR4444 \ + __gbm_fourcc_code('A', 'B', '1', \ + '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ +#define GBM_FORMAT_RGBA4444 \ + __gbm_fourcc_code('R', 'A', '1', \ + '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ +#define GBM_FORMAT_BGRA4444 \ + __gbm_fourcc_code('B', 'A', '1', \ + '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ + +#define GBM_FORMAT_XRGB1555 \ + __gbm_fourcc_code('X', 'R', '1', \ + '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ +#define GBM_FORMAT_XBGR1555 \ + __gbm_fourcc_code('X', 'B', '1', \ + '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ +#define GBM_FORMAT_RGBX5551 \ + __gbm_fourcc_code('R', 'X', '1', \ + '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ +#define GBM_FORMAT_BGRX5551 \ + __gbm_fourcc_code('B', 'X', '1', \ + '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ + +#define GBM_FORMAT_ARGB1555 \ + __gbm_fourcc_code('A', 'R', '1', \ + '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ +#define GBM_FORMAT_ABGR1555 \ + __gbm_fourcc_code('A', 'B', '1', \ + '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ +#define GBM_FORMAT_RGBA5551 \ + __gbm_fourcc_code('R', 'A', '1', \ + '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ +#define GBM_FORMAT_BGRA5551 \ + __gbm_fourcc_code('B', 'A', '1', \ + '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ + +#define GBM_FORMAT_RGB565 \ + __gbm_fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ +#define GBM_FORMAT_BGR565 \ + __gbm_fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ + +/* 24 bpp RGB */ +#define GBM_FORMAT_RGB888 \ + __gbm_fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ +#define GBM_FORMAT_BGR888 \ + __gbm_fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ + +/* 32 bpp RGB */ +#define GBM_FORMAT_XRGB8888 \ + __gbm_fourcc_code('X', 'R', '2', \ + '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ +#define GBM_FORMAT_XBGR8888 \ + __gbm_fourcc_code('X', 'B', '2', \ + '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ +#define GBM_FORMAT_RGBX8888 \ + __gbm_fourcc_code('R', 'X', '2', \ + '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ +#define GBM_FORMAT_BGRX8888 \ + __gbm_fourcc_code('B', 'X', '2', \ + '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ + +#define GBM_FORMAT_ARGB8888 \ + __gbm_fourcc_code('A', 'R', '2', \ + '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ +#define GBM_FORMAT_ABGR8888 \ + __gbm_fourcc_code('A', 'B', '2', \ + '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ +#define GBM_FORMAT_RGBA8888 \ + __gbm_fourcc_code('R', 'A', '2', \ + '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ +#define GBM_FORMAT_BGRA8888 \ + __gbm_fourcc_code('B', 'A', '2', \ + '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ + +#define GBM_FORMAT_XRGB2101010 \ + __gbm_fourcc_code('X', 'R', '3', \ + '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ +#define GBM_FORMAT_XBGR2101010 \ + __gbm_fourcc_code('X', 'B', '3', \ + '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ +#define GBM_FORMAT_RGBX1010102 \ + __gbm_fourcc_code('R', 'X', '3', \ + '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ +#define GBM_FORMAT_BGRX1010102 \ + __gbm_fourcc_code('B', 'X', '3', \ + '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ + +#define GBM_FORMAT_ARGB2101010 \ + __gbm_fourcc_code('A', 'R', '3', \ + '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ +#define GBM_FORMAT_ABGR2101010 \ + __gbm_fourcc_code('A', 'B', '3', \ + '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ +#define GBM_FORMAT_RGBA1010102 \ + __gbm_fourcc_code('R', 'A', '3', \ + '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ +#define GBM_FORMAT_BGRA1010102 \ + __gbm_fourcc_code('B', 'A', '3', \ + '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ + +/* packed YCbCr */ +#define GBM_FORMAT_YUYV \ + __gbm_fourcc_code('Y', 'U', 'Y', \ + 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ +#define GBM_FORMAT_YVYU \ + __gbm_fourcc_code('Y', 'V', 'Y', \ + 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ +#define GBM_FORMAT_UYVY \ + __gbm_fourcc_code('U', 'Y', 'V', \ + 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ +#define GBM_FORMAT_VYUY \ + __gbm_fourcc_code('V', 'Y', 'U', \ + 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ + +#define GBM_FORMAT_AYUV \ + __gbm_fourcc_code('A', 'Y', 'U', \ + 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ + +/* + * 2 plane YCbCr + * index 0 = Y plane, [7:0] Y + * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian + * or + * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian + */ +#define GBM_FORMAT_NV12 \ + __gbm_fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ +#define GBM_FORMAT_NV21 \ + __gbm_fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ +#define GBM_FORMAT_NV16 \ + __gbm_fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ +#define GBM_FORMAT_NV61 \ + __gbm_fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ + +/* + * 3 plane YCbCr + * index 0: Y plane, [7:0] Y + * index 1: Cb plane, [7:0] Cb + * index 2: Cr plane, [7:0] Cr + * or + * index 1: Cr plane, [7:0] Cr + * index 2: Cb plane, [7:0] Cb + */ +#define GBM_FORMAT_YUV410 \ + __gbm_fourcc_code('Y', 'U', 'V', \ + '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ +#define GBM_FORMAT_YVU410 \ + __gbm_fourcc_code('Y', 'V', 'U', \ + '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ +#define GBM_FORMAT_YUV411 \ + __gbm_fourcc_code('Y', 'U', '1', \ + '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ +#define GBM_FORMAT_YVU411 \ + __gbm_fourcc_code('Y', 'V', '1', \ + '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ +#define GBM_FORMAT_YUV420 \ + __gbm_fourcc_code('Y', 'U', '1', \ + '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ +#define GBM_FORMAT_YVU420 \ + __gbm_fourcc_code('Y', 'V', '1', \ + '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ +#define GBM_FORMAT_YUV422 \ + __gbm_fourcc_code('Y', 'U', '1', \ + '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ +#define GBM_FORMAT_YVU422 \ + __gbm_fourcc_code('Y', 'V', '1', \ + '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ +#define GBM_FORMAT_YUV444 \ + __gbm_fourcc_code('Y', 'U', '2', \ + '4') /* non-subsampled Cb (1) and Cr (2) planes */ +#define GBM_FORMAT_YVU444 \ + __gbm_fourcc_code('Y', 'V', '2', \ + '4') /* non-subsampled Cr (1) and Cb (2) planes */ + +struct gbm_format_name_desc { + char name[5]; +}; + +/** + * Flags to indicate the intended use for the buffer - these are passed into + * gbm_bo_create(). The caller must set the union of all the flags that are + * appropriate + * + * \sa Use gbm_device_is_format_supported() to check if the combination of + * format and use flags are supported + */ +enum gbm_bo_flags { + /** + * Buffer is going to be presented to the screen using an API such as KMS + */ + GBM_BO_USE_SCANOUT = (1 << 0), + /** + * Buffer is going to be used as cursor + */ + GBM_BO_USE_CURSOR = (1 << 1), + /** + * Deprecated + */ + GBM_BO_USE_CURSOR_64X64 = GBM_BO_USE_CURSOR, + /** + * Buffer is to be used for rendering - for example it is going to be used + * as the storage for a color buffer + */ + GBM_BO_USE_RENDERING = (1 << 2), + /** + * Buffer can be used for gbm_bo_write. This is guaranteed to work + * with GBM_BO_USE_CURSOR, but may not work for other combinations. + */ + GBM_BO_USE_WRITE = (1 << 3), + /** + * Buffer is linear, i.e. not tiled. + */ + GBM_BO_USE_LINEAR = (1 << 4), +}; + +int gbm_device_get_fd(struct gbm_device* gbm); + +const char* gbm_device_get_backend_name(struct gbm_device* gbm); + +int gbm_device_is_format_supported(struct gbm_device* gbm, uint32_t format, + uint32_t usage); + +int gbm_device_get_format_modifier_plane_count(struct gbm_device* gbm, + uint32_t format, + uint64_t modifier); + +void gbm_device_destroy(struct gbm_device* gbm); + +struct gbm_device* gbm_create_device(int fd); + +struct gbm_bo* gbm_bo_create(struct gbm_device* gbm, uint32_t width, + uint32_t height, uint32_t format, uint32_t flags); + +struct gbm_bo* gbm_bo_create_with_modifiers(struct gbm_device* gbm, + uint32_t width, uint32_t height, + uint32_t format, + const uint64_t* modifiers, + const unsigned int count); +#define GBM_BO_IMPORT_WL_BUFFER 0x5501 +#define GBM_BO_IMPORT_EGL_IMAGE 0x5502 +#define GBM_BO_IMPORT_FD 0x5503 +#define GBM_BO_IMPORT_FD_MODIFIER 0x5504 + +struct gbm_import_fd_data { + int fd; + uint32_t width; + uint32_t height; + uint32_t stride; + uint32_t format; +}; + +struct gbm_import_fd_modifier_data { + uint32_t width; + uint32_t height; + uint32_t format; + uint32_t num_fds; + int fds[4]; + int strides[4]; + int offsets[4]; + uint64_t modifier; +}; + +struct gbm_bo* gbm_bo_import(struct gbm_device* gbm, uint32_t type, + void* buffer, uint32_t usage); + +/** + * Flags to indicate the type of mapping for the buffer - these are + * passed into gbm_bo_map(). The caller must set the union of all the + * flags that are appropriate. + * + * These flags are independent of the GBM_BO_USE_* creation flags. However, + * mapping the buffer may require copying to/from a staging buffer. + * + * See also: pipe_transfer_usage + */ +enum gbm_bo_transfer_flags { + /** + * Buffer contents read back (or accessed directly) at transfer + * create time. + */ + GBM_BO_TRANSFER_READ = (1 << 0), + /** + * Buffer contents will be written back at unmap time + * (or modified as a result of being accessed directly). + */ + GBM_BO_TRANSFER_WRITE = (1 << 1), + /** + * Read/modify/write + */ + GBM_BO_TRANSFER_READ_WRITE = (GBM_BO_TRANSFER_READ | GBM_BO_TRANSFER_WRITE), +}; + +void* gbm_bo_map(struct gbm_bo* bo, uint32_t x, uint32_t y, uint32_t width, + uint32_t height, uint32_t flags, uint32_t* stride, + void** map_data); + +void gbm_bo_unmap(struct gbm_bo* bo, void* map_data); + +uint32_t gbm_bo_get_width(struct gbm_bo* bo); + +uint32_t gbm_bo_get_height(struct gbm_bo* bo); + +uint32_t gbm_bo_get_stride(struct gbm_bo* bo); + +uint32_t gbm_bo_get_stride_for_plane(struct gbm_bo* bo, int plane); + +uint32_t gbm_bo_get_format(struct gbm_bo* bo); + +uint32_t gbm_bo_get_bpp(struct gbm_bo* bo); + +uint32_t gbm_bo_get_offset(struct gbm_bo* bo, int plane); + +struct gbm_device* gbm_bo_get_device(struct gbm_bo* bo); + +union gbm_bo_handle gbm_bo_get_handle(struct gbm_bo* bo); + +int gbm_bo_get_fd(struct gbm_bo* bo); + +uint64_t gbm_bo_get_modifier(struct gbm_bo* bo); + +int gbm_bo_get_plane_count(struct gbm_bo* bo); + +union gbm_bo_handle gbm_bo_get_handle_for_plane(struct gbm_bo* bo, int plane); + +int gbm_bo_write(struct gbm_bo* bo, const void* buf, size_t count); + +void gbm_bo_set_user_data(struct gbm_bo* bo, void* data, + void (*destroy_user_data)(struct gbm_bo*, void*)); + +void* gbm_bo_get_user_data(struct gbm_bo* bo); + +void gbm_bo_destroy(struct gbm_bo* bo); + +struct gbm_surface* gbm_surface_create(struct gbm_device* gbm, uint32_t width, + uint32_t height, uint32_t format, + uint32_t flags); + +struct gbm_surface* gbm_surface_create_with_modifiers( + struct gbm_device* gbm, uint32_t width, uint32_t height, uint32_t format, + const uint64_t* modifiers, const unsigned int count); + +struct gbm_bo* gbm_surface_lock_front_buffer(struct gbm_surface* surface); + +void gbm_surface_release_buffer(struct gbm_surface* surface, struct gbm_bo* bo); + +int gbm_surface_has_free_buffers(struct gbm_surface* surface); + +void gbm_surface_destroy(struct gbm_surface* surface); + +char* gbm_format_get_name(uint32_t gbm_format, + struct gbm_format_name_desc* desc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/widget/gtk/wayland/gtk-primary-selection-client-protocol.h b/widget/gtk/wayland/gtk-primary-selection-client-protocol.h new file mode 100644 index 0000000000..770c35e03f --- /dev/null +++ b/widget/gtk/wayland/gtk-primary-selection-client-protocol.h @@ -0,0 +1,580 @@ +/* Generated by wayland-scanner 1.18.0 */ + +#ifndef GTK_PRIMARY_SELECTION_CLIENT_PROTOCOL_H +#define GTK_PRIMARY_SELECTION_CLIENT_PROTOCOL_H + +#include <stdint.h> +#include <stddef.h> +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_gtk_primary_selection The gtk_primary_selection protocol + * Primary selection protocol + * + * @section page_desc_gtk_primary_selection Description + * + * This protocol provides the ability to have a primary selection device to + * match that of the X server. This primary selection is a shortcut to the + * common clipboard selection, where text just needs to be selected in order + * to allow copying it elsewhere. The de facto way to perform this action + * is the middle mouse button, although it is not limited to this one. + * + * Clients wishing to honor primary selection should create a primary + * selection source and set it as the selection through + * wp_primary_selection_device.set_selection whenever the text selection + * changes. In order to minimize calls in pointer-driven text selection, + * it should happen only once after the operation finished. Similarly, + * a NULL source should be set when text is unselected. + * + * wp_primary_selection_offer objects are first announced through the + * wp_primary_selection_device.data_offer event. Immediately after this event, + * the primary data offer will emit wp_primary_selection_offer.offer events + * to let know of the mime types being offered. + * + * When the primary selection changes, the client with the keyboard focus + * will receive wp_primary_selection_device.selection events. Only the client + * with the keyboard focus will receive such events with a non-NULL + * wp_primary_selection_offer. Across keyboard focus changes, previously + * focused clients will receive wp_primary_selection_device.events with a + * NULL wp_primary_selection_offer. + * + * In order to request the primary selection data, the client must pass + * a recent serial pertaining to the press event that is triggering the + * operation, if the compositor deems the serial valid and recent, the + * wp_primary_selection_source.send event will happen in the other end + * to let the transfer begin. The client owning the primary selection + * should write the requested data, and close the file descriptor + * immediately. + * + * If the primary selection owner client disappeared during the transfer, + * the client reading the data will receive a + * wp_primary_selection_device.selection event with a NULL + * wp_primary_selection_offer, the client should take this as a hint + * to finish the reads related to the no longer existing offer. + * + * The primary selection owner should be checking for errors during + * writes, merely cancelling the ongoing transfer if any happened. + * + * @section page_ifaces_gtk_primary_selection Interfaces + * - @subpage page_iface_gtk_primary_selection_device_manager - X primary selection emulation + * - @subpage page_iface_gtk_primary_selection_device - + * - @subpage page_iface_gtk_primary_selection_offer - offer to transfer primary selection contents + * - @subpage page_iface_gtk_primary_selection_source - offer to replace the contents of the primary selection + * @section page_copyright_gtk_primary_selection Copyright + * <pre> + * + * Copyright © 2015, 2016 Red Hat + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * </pre> + */ +struct gtk_primary_selection_device; +struct gtk_primary_selection_device_manager; +struct gtk_primary_selection_offer; +struct gtk_primary_selection_source; +struct wl_seat; + +/** + * @page page_iface_gtk_primary_selection_device_manager gtk_primary_selection_device_manager + * @section page_iface_gtk_primary_selection_device_manager_desc Description + * + * The primary selection device manager is a singleton global object that + * provides access to the primary selection. It allows to create + * wp_primary_selection_source objects, as well as retrieving the per-seat + * wp_primary_selection_device objects. + * @section page_iface_gtk_primary_selection_device_manager_api API + * See @ref iface_gtk_primary_selection_device_manager. + */ +/** + * @defgroup iface_gtk_primary_selection_device_manager The gtk_primary_selection_device_manager interface + * + * The primary selection device manager is a singleton global object that + * provides access to the primary selection. It allows to create + * wp_primary_selection_source objects, as well as retrieving the per-seat + * wp_primary_selection_device objects. + */ +extern const struct wl_interface gtk_primary_selection_device_manager_interface; +/** + * @page page_iface_gtk_primary_selection_device gtk_primary_selection_device + * @section page_iface_gtk_primary_selection_device_api API + * See @ref iface_gtk_primary_selection_device. + */ +/** + * @defgroup iface_gtk_primary_selection_device The gtk_primary_selection_device interface + */ +extern const struct wl_interface gtk_primary_selection_device_interface; +/** + * @page page_iface_gtk_primary_selection_offer gtk_primary_selection_offer + * @section page_iface_gtk_primary_selection_offer_desc Description + * + * A wp_primary_selection_offer represents an offer to transfer the contents + * of the primary selection clipboard to the client. Similar to + * wl_data_offer, the offer also describes the mime types that the source + * will transferthat the + * data can be converted to and provides the mechanisms for transferring the + * data directly to the client. + * @section page_iface_gtk_primary_selection_offer_api API + * See @ref iface_gtk_primary_selection_offer. + */ +/** + * @defgroup iface_gtk_primary_selection_offer The gtk_primary_selection_offer interface + * + * A wp_primary_selection_offer represents an offer to transfer the contents + * of the primary selection clipboard to the client. Similar to + * wl_data_offer, the offer also describes the mime types that the source + * will transferthat the + * data can be converted to and provides the mechanisms for transferring the + * data directly to the client. + */ +extern const struct wl_interface gtk_primary_selection_offer_interface; +/** + * @page page_iface_gtk_primary_selection_source gtk_primary_selection_source + * @section page_iface_gtk_primary_selection_source_desc Description + * + * The source side of a wp_primary_selection_offer, it provides a way to + * describe the offered data and respond to requests to transfer the + * requested contents of the primary selection clipboard. + * @section page_iface_gtk_primary_selection_source_api API + * See @ref iface_gtk_primary_selection_source. + */ +/** + * @defgroup iface_gtk_primary_selection_source The gtk_primary_selection_source interface + * + * The source side of a wp_primary_selection_offer, it provides a way to + * describe the offered data and respond to requests to transfer the + * requested contents of the primary selection clipboard. + */ +extern const struct wl_interface gtk_primary_selection_source_interface; + +#define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_CREATE_SOURCE 0 +#define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_GET_DEVICE 1 +#define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_DESTROY 2 + + +/** + * @ingroup iface_gtk_primary_selection_device_manager + */ +#define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_CREATE_SOURCE_SINCE_VERSION 1 +/** + * @ingroup iface_gtk_primary_selection_device_manager + */ +#define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_GET_DEVICE_SINCE_VERSION 1 +/** + * @ingroup iface_gtk_primary_selection_device_manager + */ +#define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_gtk_primary_selection_device_manager */ +static inline void +gtk_primary_selection_device_manager_set_user_data(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_device_manager, user_data); +} + +/** @ingroup iface_gtk_primary_selection_device_manager */ +static inline void * +gtk_primary_selection_device_manager_get_user_data(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager) +{ + return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_device_manager); +} + +static inline uint32_t +gtk_primary_selection_device_manager_get_version(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager) +{ + return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device_manager); +} + +/** + * @ingroup iface_gtk_primary_selection_device_manager + * + * Create a new primary selection source. + */ +static inline struct gtk_primary_selection_source * +gtk_primary_selection_device_manager_create_source(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_constructor((struct wl_proxy *) gtk_primary_selection_device_manager, + GTK_PRIMARY_SELECTION_DEVICE_MANAGER_CREATE_SOURCE, >k_primary_selection_source_interface, NULL); + + return (struct gtk_primary_selection_source *) id; +} + +/** + * @ingroup iface_gtk_primary_selection_device_manager + * + * Create a new data device for a given seat. + */ +static inline struct gtk_primary_selection_device * +gtk_primary_selection_device_manager_get_device(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager, struct wl_seat *seat) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_constructor((struct wl_proxy *) gtk_primary_selection_device_manager, + GTK_PRIMARY_SELECTION_DEVICE_MANAGER_GET_DEVICE, >k_primary_selection_device_interface, NULL, seat); + + return (struct gtk_primary_selection_device *) id; +} + +/** + * @ingroup iface_gtk_primary_selection_device_manager + * + * Destroy the primary selection device manager. + */ +static inline void +gtk_primary_selection_device_manager_destroy(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager) +{ + wl_proxy_marshal((struct wl_proxy *) gtk_primary_selection_device_manager, + GTK_PRIMARY_SELECTION_DEVICE_MANAGER_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) gtk_primary_selection_device_manager); +} + +/** + * @ingroup iface_gtk_primary_selection_device + * @struct gtk_primary_selection_device_listener + */ +struct gtk_primary_selection_device_listener { + /** + * introduce a new wp_primary_selection_offer + * + * Introduces a new wp_primary_selection_offer object that may be + * used to receive the current primary selection. Immediately + * following this event, the new wp_primary_selection_offer object + * will send wp_primary_selection_offer.offer events to describe + * the offered mime types. + */ + void (*data_offer)(void *data, + struct gtk_primary_selection_device *gtk_primary_selection_device, + struct gtk_primary_selection_offer *offer); + /** + * advertise a new primary selection + * + * The wp_primary_selection_device.selection event is sent to + * notify the client of a new primary selection. This event is sent + * after the wp_primary_selection.data_offer event introducing this + * object, and after the offer has announced its mimetypes through + * wp_primary_selection_offer.offer. + * + * The data_offer is valid until a new offer or NULL is received or + * until the client loses keyboard focus. The client must destroy + * the previous selection data_offer, if any, upon receiving this + * event. + */ + void (*selection)(void *data, + struct gtk_primary_selection_device *gtk_primary_selection_device, + struct gtk_primary_selection_offer *id); +}; + +/** + * @ingroup iface_gtk_primary_selection_device + */ +static inline int +gtk_primary_selection_device_add_listener(struct gtk_primary_selection_device *gtk_primary_selection_device, + const struct gtk_primary_selection_device_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) gtk_primary_selection_device, + (void (**)(void)) listener, data); +} + +#define GTK_PRIMARY_SELECTION_DEVICE_SET_SELECTION 0 +#define GTK_PRIMARY_SELECTION_DEVICE_DESTROY 1 + +/** + * @ingroup iface_gtk_primary_selection_device + */ +#define GTK_PRIMARY_SELECTION_DEVICE_DATA_OFFER_SINCE_VERSION 1 +/** + * @ingroup iface_gtk_primary_selection_device + */ +#define GTK_PRIMARY_SELECTION_DEVICE_SELECTION_SINCE_VERSION 1 + +/** + * @ingroup iface_gtk_primary_selection_device + */ +#define GTK_PRIMARY_SELECTION_DEVICE_SET_SELECTION_SINCE_VERSION 1 +/** + * @ingroup iface_gtk_primary_selection_device + */ +#define GTK_PRIMARY_SELECTION_DEVICE_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_gtk_primary_selection_device */ +static inline void +gtk_primary_selection_device_set_user_data(struct gtk_primary_selection_device *gtk_primary_selection_device, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_device, user_data); +} + +/** @ingroup iface_gtk_primary_selection_device */ +static inline void * +gtk_primary_selection_device_get_user_data(struct gtk_primary_selection_device *gtk_primary_selection_device) +{ + return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_device); +} + +static inline uint32_t +gtk_primary_selection_device_get_version(struct gtk_primary_selection_device *gtk_primary_selection_device) +{ + return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device); +} + +/** + * @ingroup iface_gtk_primary_selection_device + * + * Replaces the current selection. The previous owner of the primary selection + * will receive a wp_primary_selection_source.cancelled event. + * + * To unset the selection, set the source to NULL. + */ +static inline void +gtk_primary_selection_device_set_selection(struct gtk_primary_selection_device *gtk_primary_selection_device, struct gtk_primary_selection_source *source, uint32_t serial) +{ + wl_proxy_marshal((struct wl_proxy *) gtk_primary_selection_device, + GTK_PRIMARY_SELECTION_DEVICE_SET_SELECTION, source, serial); +} + +/** + * @ingroup iface_gtk_primary_selection_device + * + * Destroy the primary selection device. + */ +static inline void +gtk_primary_selection_device_destroy(struct gtk_primary_selection_device *gtk_primary_selection_device) +{ + wl_proxy_marshal((struct wl_proxy *) gtk_primary_selection_device, + GTK_PRIMARY_SELECTION_DEVICE_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) gtk_primary_selection_device); +} + +/** + * @ingroup iface_gtk_primary_selection_offer + * @struct gtk_primary_selection_offer_listener + */ +struct gtk_primary_selection_offer_listener { + /** + * advertise offered mime type + * + * Sent immediately after creating announcing the + * wp_primary_selection_offer through + * wp_primary_selection_device.data_offer. One event is sent per + * offered mime type. + */ + void (*offer)(void *data, + struct gtk_primary_selection_offer *gtk_primary_selection_offer, + const char *mime_type); +}; + +/** + * @ingroup iface_gtk_primary_selection_offer + */ +static inline int +gtk_primary_selection_offer_add_listener(struct gtk_primary_selection_offer *gtk_primary_selection_offer, + const struct gtk_primary_selection_offer_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) gtk_primary_selection_offer, + (void (**)(void)) listener, data); +} + +#define GTK_PRIMARY_SELECTION_OFFER_RECEIVE 0 +#define GTK_PRIMARY_SELECTION_OFFER_DESTROY 1 + +/** + * @ingroup iface_gtk_primary_selection_offer + */ +#define GTK_PRIMARY_SELECTION_OFFER_OFFER_SINCE_VERSION 1 + +/** + * @ingroup iface_gtk_primary_selection_offer + */ +#define GTK_PRIMARY_SELECTION_OFFER_RECEIVE_SINCE_VERSION 1 +/** + * @ingroup iface_gtk_primary_selection_offer + */ +#define GTK_PRIMARY_SELECTION_OFFER_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_gtk_primary_selection_offer */ +static inline void +gtk_primary_selection_offer_set_user_data(struct gtk_primary_selection_offer *gtk_primary_selection_offer, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_offer, user_data); +} + +/** @ingroup iface_gtk_primary_selection_offer */ +static inline void * +gtk_primary_selection_offer_get_user_data(struct gtk_primary_selection_offer *gtk_primary_selection_offer) +{ + return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_offer); +} + +static inline uint32_t +gtk_primary_selection_offer_get_version(struct gtk_primary_selection_offer *gtk_primary_selection_offer) +{ + return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_offer); +} + +/** + * @ingroup iface_gtk_primary_selection_offer + * + * To transfer the contents of the primary selection clipboard, the client + * issues this request and indicates the mime type that it wants to + * receive. The transfer happens through the passed file descriptor + * (typically created with the pipe system call). The source client writes + * the data in the mime type representation requested and then closes the + * file descriptor. + * + * The receiving client reads from the read end of the pipe until EOF and + * closes its end, at which point the transfer is complete. + */ +static inline void +gtk_primary_selection_offer_receive(struct gtk_primary_selection_offer *gtk_primary_selection_offer, const char *mime_type, int32_t fd) +{ + wl_proxy_marshal((struct wl_proxy *) gtk_primary_selection_offer, + GTK_PRIMARY_SELECTION_OFFER_RECEIVE, mime_type, fd); +} + +/** + * @ingroup iface_gtk_primary_selection_offer + * + * Destroy the primary selection offer. + */ +static inline void +gtk_primary_selection_offer_destroy(struct gtk_primary_selection_offer *gtk_primary_selection_offer) +{ + wl_proxy_marshal((struct wl_proxy *) gtk_primary_selection_offer, + GTK_PRIMARY_SELECTION_OFFER_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) gtk_primary_selection_offer); +} + +/** + * @ingroup iface_gtk_primary_selection_source + * @struct gtk_primary_selection_source_listener + */ +struct gtk_primary_selection_source_listener { + /** + * send the primary selection contents + * + * Request for the current primary selection contents from the + * client. Send the specified mime type over the passed file + * descriptor, then close it. + */ + void (*send)(void *data, + struct gtk_primary_selection_source *gtk_primary_selection_source, + const char *mime_type, + int32_t fd); + /** + * request for primary selection contents was canceled + * + * This primary selection source is no longer valid. The client + * should clean up and destroy this primary selection source. + */ + void (*cancelled)(void *data, + struct gtk_primary_selection_source *gtk_primary_selection_source); +}; + +/** + * @ingroup iface_gtk_primary_selection_source + */ +static inline int +gtk_primary_selection_source_add_listener(struct gtk_primary_selection_source *gtk_primary_selection_source, + const struct gtk_primary_selection_source_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) gtk_primary_selection_source, + (void (**)(void)) listener, data); +} + +#define GTK_PRIMARY_SELECTION_SOURCE_OFFER 0 +#define GTK_PRIMARY_SELECTION_SOURCE_DESTROY 1 + +/** + * @ingroup iface_gtk_primary_selection_source + */ +#define GTK_PRIMARY_SELECTION_SOURCE_SEND_SINCE_VERSION 1 +/** + * @ingroup iface_gtk_primary_selection_source + */ +#define GTK_PRIMARY_SELECTION_SOURCE_CANCELLED_SINCE_VERSION 1 + +/** + * @ingroup iface_gtk_primary_selection_source + */ +#define GTK_PRIMARY_SELECTION_SOURCE_OFFER_SINCE_VERSION 1 +/** + * @ingroup iface_gtk_primary_selection_source + */ +#define GTK_PRIMARY_SELECTION_SOURCE_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_gtk_primary_selection_source */ +static inline void +gtk_primary_selection_source_set_user_data(struct gtk_primary_selection_source *gtk_primary_selection_source, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_source, user_data); +} + +/** @ingroup iface_gtk_primary_selection_source */ +static inline void * +gtk_primary_selection_source_get_user_data(struct gtk_primary_selection_source *gtk_primary_selection_source) +{ + return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_source); +} + +static inline uint32_t +gtk_primary_selection_source_get_version(struct gtk_primary_selection_source *gtk_primary_selection_source) +{ + return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_source); +} + +/** + * @ingroup iface_gtk_primary_selection_source + * + * This request adds a mime type to the set of mime types advertised to + * targets. Can be called several times to offer multiple types. + */ +static inline void +gtk_primary_selection_source_offer(struct gtk_primary_selection_source *gtk_primary_selection_source, const char *mime_type) +{ + wl_proxy_marshal((struct wl_proxy *) gtk_primary_selection_source, + GTK_PRIMARY_SELECTION_SOURCE_OFFER, mime_type); +} + +/** + * @ingroup iface_gtk_primary_selection_source + * + * Destroy the primary selection source. + */ +static inline void +gtk_primary_selection_source_destroy(struct gtk_primary_selection_source *gtk_primary_selection_source) +{ + wl_proxy_marshal((struct wl_proxy *) gtk_primary_selection_source, + GTK_PRIMARY_SELECTION_SOURCE_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) gtk_primary_selection_source); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/widget/gtk/wayland/gtk-primary-selection-protocol.c b/widget/gtk/wayland/gtk-primary-selection-protocol.c new file mode 100644 index 0000000000..8a1166d2a2 --- /dev/null +++ b/widget/gtk/wayland/gtk-primary-selection-protocol.c @@ -0,0 +1,115 @@ +/* Generated by wayland-scanner 1.18.0 */ + +/* + * Copyright © 2015, 2016 Red Hat + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdlib.h> +#include <stdint.h> +#include <gdk/gdkwayland.h> +#include "wayland-util.h" + +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif + +#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) +#define WL_PRIVATE __attribute__ ((visibility("hidden"))) +#else +#define WL_PRIVATE +#endif + +extern const struct wl_interface gtk_primary_selection_device_interface; +extern const struct wl_interface gtk_primary_selection_offer_interface; +extern const struct wl_interface gtk_primary_selection_source_interface; +extern const struct wl_interface wl_seat_interface; + +static const struct wl_interface *gtk_primary_selection_types[] = { + NULL, + NULL, + >k_primary_selection_source_interface, + >k_primary_selection_device_interface, + &wl_seat_interface, + >k_primary_selection_source_interface, + NULL, + >k_primary_selection_offer_interface, + >k_primary_selection_offer_interface, +}; + +static const struct wl_message gtk_primary_selection_device_manager_requests[] = { + { "create_source", "n", gtk_primary_selection_types + 2 }, + { "get_device", "no", gtk_primary_selection_types + 3 }, + { "destroy", "", gtk_primary_selection_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface gtk_primary_selection_device_manager_interface = { + "gtk_primary_selection_device_manager", 1, + 3, gtk_primary_selection_device_manager_requests, + 0, NULL, +}; + +static const struct wl_message gtk_primary_selection_device_requests[] = { + { "set_selection", "?ou", gtk_primary_selection_types + 5 }, + { "destroy", "", gtk_primary_selection_types + 0 }, +}; + +static const struct wl_message gtk_primary_selection_device_events[] = { + { "data_offer", "n", gtk_primary_selection_types + 7 }, + { "selection", "?o", gtk_primary_selection_types + 8 }, +}; + +WL_PRIVATE const struct wl_interface gtk_primary_selection_device_interface = { + "gtk_primary_selection_device", 1, + 2, gtk_primary_selection_device_requests, + 2, gtk_primary_selection_device_events, +}; + +static const struct wl_message gtk_primary_selection_offer_requests[] = { + { "receive", "sh", gtk_primary_selection_types + 0 }, + { "destroy", "", gtk_primary_selection_types + 0 }, +}; + +static const struct wl_message gtk_primary_selection_offer_events[] = { + { "offer", "s", gtk_primary_selection_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface gtk_primary_selection_offer_interface = { + "gtk_primary_selection_offer", 1, + 2, gtk_primary_selection_offer_requests, + 1, gtk_primary_selection_offer_events, +}; + +static const struct wl_message gtk_primary_selection_source_requests[] = { + { "offer", "s", gtk_primary_selection_types + 0 }, + { "destroy", "", gtk_primary_selection_types + 0 }, +}; + +static const struct wl_message gtk_primary_selection_source_events[] = { + { "send", "sh", gtk_primary_selection_types + 0 }, + { "cancelled", "", gtk_primary_selection_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface gtk_primary_selection_source_interface = { + "gtk_primary_selection_source", 1, + 2, gtk_primary_selection_source_requests, + 2, gtk_primary_selection_source_events, +}; diff --git a/widget/gtk/wayland/idle-inhibit-unstable-v1-client-protocol.h b/widget/gtk/wayland/idle-inhibit-unstable-v1-client-protocol.h new file mode 100644 index 0000000000..3ae2303b3c --- /dev/null +++ b/widget/gtk/wayland/idle-inhibit-unstable-v1-client-protocol.h @@ -0,0 +1,228 @@ +/* Generated by wayland-scanner 1.16.0 */ + +#ifndef IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H +#define IDLE_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H + +#include <stdint.h> +#include <stddef.h> +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_idle_inhibit_unstable_v1 The idle_inhibit_unstable_v1 protocol + * @section page_ifaces_idle_inhibit_unstable_v1 Interfaces + * - @subpage page_iface_zwp_idle_inhibit_manager_v1 - control behavior when + * display idles + * - @subpage page_iface_zwp_idle_inhibitor_v1 - context object for inhibiting + * idle behavior + * @section page_copyright_idle_inhibit_unstable_v1 Copyright + * <pre> + * + * Copyright © 2015 Samsung Electronics Co., Ltd + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * </pre> + */ +struct wl_surface; +struct zwp_idle_inhibit_manager_v1; +struct zwp_idle_inhibitor_v1; + +/** + * @page page_iface_zwp_idle_inhibit_manager_v1 zwp_idle_inhibit_manager_v1 + * @section page_iface_zwp_idle_inhibit_manager_v1_desc Description + * + * This interface permits inhibiting the idle behavior such as screen + * blanking, locking, and screensaving. The client binds the idle manager + * globally, then creates idle-inhibitor objects for each surface. + * + * Warning! The protocol described in this file is experimental and + * backward incompatible changes may be made. Backward compatible changes + * may be added together with the corresponding interface version bump. + * Backward incompatible changes are done by bumping the version number in + * the protocol and interface names and resetting the interface version. + * Once the protocol is to be declared stable, the 'z' prefix and the + * version number in the protocol and interface names are removed and the + * interface version number is reset. + * @section page_iface_zwp_idle_inhibit_manager_v1_api API + * See @ref iface_zwp_idle_inhibit_manager_v1. + */ +/** + * @defgroup iface_zwp_idle_inhibit_manager_v1 The zwp_idle_inhibit_manager_v1 + * interface + * + * This interface permits inhibiting the idle behavior such as screen + * blanking, locking, and screensaving. The client binds the idle manager + * globally, then creates idle-inhibitor objects for each surface. + * + * Warning! The protocol described in this file is experimental and + * backward incompatible changes may be made. Backward compatible changes + * may be added together with the corresponding interface version bump. + * Backward incompatible changes are done by bumping the version number in + * the protocol and interface names and resetting the interface version. + * Once the protocol is to be declared stable, the 'z' prefix and the + * version number in the protocol and interface names are removed and the + * interface version number is reset. + */ +extern const struct wl_interface zwp_idle_inhibit_manager_v1_interface; +/** + * @page page_iface_zwp_idle_inhibitor_v1 zwp_idle_inhibitor_v1 + * @section page_iface_zwp_idle_inhibitor_v1_desc Description + * + * An idle inhibitor prevents the output that the associated surface is + * visible on from being set to a state where it is not visually usable due + * to lack of user interaction (e.g. blanked, dimmed, locked, set to power + * save, etc.) Any screensaver processes are also blocked from displaying. + * + * If the surface is destroyed, unmapped, becomes occluded, loses + * visibility, or otherwise becomes not visually relevant for the user, the + * idle inhibitor will not be honored by the compositor; if the surface + * subsequently regains visibility the inhibitor takes effect once again. + * Likewise, the inhibitor isn't honored if the system was already idled at + * the time the inhibitor was established, although if the system later + * de-idles and re-idles the inhibitor will take effect. + * @section page_iface_zwp_idle_inhibitor_v1_api API + * See @ref iface_zwp_idle_inhibitor_v1. + */ +/** + * @defgroup iface_zwp_idle_inhibitor_v1 The zwp_idle_inhibitor_v1 interface + * + * An idle inhibitor prevents the output that the associated surface is + * visible on from being set to a state where it is not visually usable due + * to lack of user interaction (e.g. blanked, dimmed, locked, set to power + * save, etc.) Any screensaver processes are also blocked from displaying. + * + * If the surface is destroyed, unmapped, becomes occluded, loses + * visibility, or otherwise becomes not visually relevant for the user, the + * idle inhibitor will not be honored by the compositor; if the surface + * subsequently regains visibility the inhibitor takes effect once again. + * Likewise, the inhibitor isn't honored if the system was already idled at + * the time the inhibitor was established, although if the system later + * de-idles and re-idles the inhibitor will take effect. + */ +extern const struct wl_interface zwp_idle_inhibitor_v1_interface; + +#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY 0 +#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR 1 + +/** + * @ingroup iface_zwp_idle_inhibit_manager_v1 + */ +#define ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_idle_inhibit_manager_v1 + */ +#define ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR_SINCE_VERSION 1 + +/** @ingroup iface_zwp_idle_inhibit_manager_v1 */ +static inline void zwp_idle_inhibit_manager_v1_set_user_data( + struct zwp_idle_inhibit_manager_v1* zwp_idle_inhibit_manager_v1, + void* user_data) { + wl_proxy_set_user_data((struct wl_proxy*)zwp_idle_inhibit_manager_v1, + user_data); +} + +/** @ingroup iface_zwp_idle_inhibit_manager_v1 */ +static inline void* zwp_idle_inhibit_manager_v1_get_user_data( + struct zwp_idle_inhibit_manager_v1* zwp_idle_inhibit_manager_v1) { + return wl_proxy_get_user_data((struct wl_proxy*)zwp_idle_inhibit_manager_v1); +} + +static inline uint32_t zwp_idle_inhibit_manager_v1_get_version( + struct zwp_idle_inhibit_manager_v1* zwp_idle_inhibit_manager_v1) { + return wl_proxy_get_version((struct wl_proxy*)zwp_idle_inhibit_manager_v1); +} + +/** + * @ingroup iface_zwp_idle_inhibit_manager_v1 + * + * Destroy the inhibit manager. + */ +static inline void zwp_idle_inhibit_manager_v1_destroy( + struct zwp_idle_inhibit_manager_v1* zwp_idle_inhibit_manager_v1) { + wl_proxy_marshal((struct wl_proxy*)zwp_idle_inhibit_manager_v1, + ZWP_IDLE_INHIBIT_MANAGER_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy*)zwp_idle_inhibit_manager_v1); +} + +/** + * @ingroup iface_zwp_idle_inhibit_manager_v1 + * + * Create a new inhibitor object associated with the given surface. + */ +static inline struct zwp_idle_inhibitor_v1* +zwp_idle_inhibit_manager_v1_create_inhibitor( + struct zwp_idle_inhibit_manager_v1* zwp_idle_inhibit_manager_v1, + struct wl_surface* surface) { + struct wl_proxy* id; + + id = wl_proxy_marshal_constructor( + (struct wl_proxy*)zwp_idle_inhibit_manager_v1, + ZWP_IDLE_INHIBIT_MANAGER_V1_CREATE_INHIBITOR, + &zwp_idle_inhibitor_v1_interface, NULL, surface); + + return (struct zwp_idle_inhibitor_v1*)id; +} + +#define ZWP_IDLE_INHIBITOR_V1_DESTROY 0 + +/** + * @ingroup iface_zwp_idle_inhibitor_v1 + */ +#define ZWP_IDLE_INHIBITOR_V1_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_zwp_idle_inhibitor_v1 */ +static inline void zwp_idle_inhibitor_v1_set_user_data( + struct zwp_idle_inhibitor_v1* zwp_idle_inhibitor_v1, void* user_data) { + wl_proxy_set_user_data((struct wl_proxy*)zwp_idle_inhibitor_v1, user_data); +} + +/** @ingroup iface_zwp_idle_inhibitor_v1 */ +static inline void* zwp_idle_inhibitor_v1_get_user_data( + struct zwp_idle_inhibitor_v1* zwp_idle_inhibitor_v1) { + return wl_proxy_get_user_data((struct wl_proxy*)zwp_idle_inhibitor_v1); +} + +static inline uint32_t zwp_idle_inhibitor_v1_get_version( + struct zwp_idle_inhibitor_v1* zwp_idle_inhibitor_v1) { + return wl_proxy_get_version((struct wl_proxy*)zwp_idle_inhibitor_v1); +} + +/** + * @ingroup iface_zwp_idle_inhibitor_v1 + * + * Remove the inhibitor effect from the associated wl_surface. + */ +static inline void zwp_idle_inhibitor_v1_destroy( + struct zwp_idle_inhibitor_v1* zwp_idle_inhibitor_v1) { + wl_proxy_marshal((struct wl_proxy*)zwp_idle_inhibitor_v1, + ZWP_IDLE_INHIBITOR_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy*)zwp_idle_inhibitor_v1); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/widget/gtk/wayland/idle-inhibit-unstable-v1-protocol.c b/widget/gtk/wayland/idle-inhibit-unstable-v1-protocol.c new file mode 100644 index 0000000000..579095e003 --- /dev/null +++ b/widget/gtk/wayland/idle-inhibit-unstable-v1-protocol.c @@ -0,0 +1,60 @@ +/* Generated by wayland-scanner 1.16.0 */ + +/* + * Copyright © 2015 Samsung Electronics Co., Ltd + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdlib.h> +#include <stdint.h> +#include "wayland-util.h" + +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif + +#pragma GCC visibility push(default) +extern const struct wl_interface wl_surface_interface; +extern const struct wl_interface zwp_idle_inhibitor_v1_interface; +#pragma GCC visibility pop + +static const struct wl_interface* types[] = { + &zwp_idle_inhibitor_v1_interface, + &wl_surface_interface, +}; + +static const struct wl_message zwp_idle_inhibit_manager_v1_requests[] = { + {"destroy", "", types + 0}, + {"create_inhibitor", "no", types + 0}, +}; + +const struct wl_interface zwp_idle_inhibit_manager_v1_interface = { + "zwp_idle_inhibit_manager_v1", 1, 2, + zwp_idle_inhibit_manager_v1_requests, 0, NULL, +}; + +static const struct wl_message zwp_idle_inhibitor_v1_requests[] = { + {"destroy", "", types + 0}, +}; + +const struct wl_interface zwp_idle_inhibitor_v1_interface = { + "zwp_idle_inhibitor_v1", 1, 1, zwp_idle_inhibitor_v1_requests, 0, NULL, +}; diff --git a/widget/gtk/wayland/linux-dmabuf-unstable-v1-client-protocol.h b/widget/gtk/wayland/linux-dmabuf-unstable-v1-client-protocol.h new file mode 100644 index 0000000000..cff0426a9c --- /dev/null +++ b/widget/gtk/wayland/linux-dmabuf-unstable-v1-client-protocol.h @@ -0,0 +1,650 @@ +/* Generated by wayland-scanner 1.17.0 */ + +#ifndef LINUX_DMABUF_UNSTABLE_V1_CLIENT_PROTOCOL_H +#define LINUX_DMABUF_UNSTABLE_V1_CLIENT_PROTOCOL_H + +#include <stdint.h> +#include <stddef.h> +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_linux_dmabuf_unstable_v1 The linux_dmabuf_unstable_v1 protocol + * @section page_ifaces_linux_dmabuf_unstable_v1 Interfaces + * - @subpage page_iface_zwp_linux_dmabuf_v1 - factory for creating dmabuf-based + * wl_buffers + * - @subpage page_iface_zwp_linux_buffer_params_v1 - parameters for creating a + * dmabuf-based wl_buffer + * @section page_copyright_linux_dmabuf_unstable_v1 Copyright + * <pre> + * + * Copyright © 2014, 2015 Collabora, Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * </pre> + */ +struct wl_buffer; +struct zwp_linux_buffer_params_v1; +struct zwp_linux_dmabuf_v1; + +/** + * @page page_iface_zwp_linux_dmabuf_v1 zwp_linux_dmabuf_v1 + * @section page_iface_zwp_linux_dmabuf_v1_desc Description + * + * Following the interfaces from: + * https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt + * and the Linux DRM sub-system's AddFb2 ioctl. + * + * This interface offers ways to create generic dmabuf-based + * wl_buffers. Immediately after a client binds to this interface, + * the set of supported formats and format modifiers is sent with + * 'format' and 'modifier' events. + * + * The following are required from clients: + * + * - Clients must ensure that either all data in the dma-buf is + * coherent for all subsequent read access or that coherency is + * correctly handled by the underlying kernel-side dma-buf + * implementation. + * + * - Don't make any more attachments after sending the buffer to the + * compositor. Making more attachments later increases the risk of + * the compositor not being able to use (re-import) an existing + * dmabuf-based wl_buffer. + * + * The underlying graphics stack must ensure the following: + * + * - The dmabuf file descriptors relayed to the server will stay valid + * for the whole lifetime of the wl_buffer. This means the server may + * at any time use those fds to import the dmabuf into any kernel + * sub-system that might accept it. + * + * To create a wl_buffer from one or more dmabufs, a client creates a + * zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params + * request. All planes required by the intended format are added with + * the 'add' request. Finally, a 'create' or 'create_immed' request is + * issued, which has the following outcome depending on the import success. + * + * The 'create' request, + * - on success, triggers a 'created' event which provides the final + * wl_buffer to the client. + * - on failure, triggers a 'failed' event to convey that the server + * cannot use the dmabufs received from the client. + * + * For the 'create_immed' request, + * - on success, the server immediately imports the added dmabufs to + * create a wl_buffer. No event is sent from the server in this case. + * - on failure, the server can choose to either: + * - terminate the client by raising a fatal error. + * - mark the wl_buffer as failed, and send a 'failed' event to the + * client. If the client uses a failed wl_buffer as an argument to any + * request, the behaviour is compositor implementation-defined. + * + * Warning! The protocol described in this file is experimental and + * backward incompatible changes may be made. Backward compatible changes + * may be added together with the corresponding interface version bump. + * Backward incompatible changes are done by bumping the version number in + * the protocol and interface names and resetting the interface version. + * Once the protocol is to be declared stable, the 'z' prefix and the + * version number in the protocol and interface names are removed and the + * interface version number is reset. + * @section page_iface_zwp_linux_dmabuf_v1_api API + * See @ref iface_zwp_linux_dmabuf_v1. + */ +/** + * @defgroup iface_zwp_linux_dmabuf_v1 The zwp_linux_dmabuf_v1 interface + * + * Following the interfaces from: + * https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt + * and the Linux DRM sub-system's AddFb2 ioctl. + * + * This interface offers ways to create generic dmabuf-based + * wl_buffers. Immediately after a client binds to this interface, + * the set of supported formats and format modifiers is sent with + * 'format' and 'modifier' events. + * + * The following are required from clients: + * + * - Clients must ensure that either all data in the dma-buf is + * coherent for all subsequent read access or that coherency is + * correctly handled by the underlying kernel-side dma-buf + * implementation. + * + * - Don't make any more attachments after sending the buffer to the + * compositor. Making more attachments later increases the risk of + * the compositor not being able to use (re-import) an existing + * dmabuf-based wl_buffer. + * + * The underlying graphics stack must ensure the following: + * + * - The dmabuf file descriptors relayed to the server will stay valid + * for the whole lifetime of the wl_buffer. This means the server may + * at any time use those fds to import the dmabuf into any kernel + * sub-system that might accept it. + * + * To create a wl_buffer from one or more dmabufs, a client creates a + * zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params + * request. All planes required by the intended format are added with + * the 'add' request. Finally, a 'create' or 'create_immed' request is + * issued, which has the following outcome depending on the import success. + * + * The 'create' request, + * - on success, triggers a 'created' event which provides the final + * wl_buffer to the client. + * - on failure, triggers a 'failed' event to convey that the server + * cannot use the dmabufs received from the client. + * + * For the 'create_immed' request, + * - on success, the server immediately imports the added dmabufs to + * create a wl_buffer. No event is sent from the server in this case. + * - on failure, the server can choose to either: + * - terminate the client by raising a fatal error. + * - mark the wl_buffer as failed, and send a 'failed' event to the + * client. If the client uses a failed wl_buffer as an argument to any + * request, the behaviour is compositor implementation-defined. + * + * Warning! The protocol described in this file is experimental and + * backward incompatible changes may be made. Backward compatible changes + * may be added together with the corresponding interface version bump. + * Backward incompatible changes are done by bumping the version number in + * the protocol and interface names and resetting the interface version. + * Once the protocol is to be declared stable, the 'z' prefix and the + * version number in the protocol and interface names are removed and the + * interface version number is reset. + */ +extern const struct wl_interface zwp_linux_dmabuf_v1_interface; +/** + * @page page_iface_zwp_linux_buffer_params_v1 zwp_linux_buffer_params_v1 + * @section page_iface_zwp_linux_buffer_params_v1_desc Description + * + * This temporary object is a collection of dmabufs and other + * parameters that together form a single logical buffer. The temporary + * object may eventually create one wl_buffer unless cancelled by + * destroying it before requesting 'create'. + * + * Single-planar formats only require one dmabuf, however + * multi-planar formats may require more than one dmabuf. For all + * formats, an 'add' request must be called once per plane (even if the + * underlying dmabuf fd is identical). + * + * You must use consecutive plane indices ('plane_idx' argument for 'add') + * from zero to the number of planes used by the drm_fourcc format code. + * All planes required by the format must be given exactly once, but can + * be given in any order. Each plane index can be set only once. + * @section page_iface_zwp_linux_buffer_params_v1_api API + * See @ref iface_zwp_linux_buffer_params_v1. + */ +/** + * @defgroup iface_zwp_linux_buffer_params_v1 The zwp_linux_buffer_params_v1 + * interface + * + * This temporary object is a collection of dmabufs and other + * parameters that together form a single logical buffer. The temporary + * object may eventually create one wl_buffer unless cancelled by + * destroying it before requesting 'create'. + * + * Single-planar formats only require one dmabuf, however + * multi-planar formats may require more than one dmabuf. For all + * formats, an 'add' request must be called once per plane (even if the + * underlying dmabuf fd is identical). + * + * You must use consecutive plane indices ('plane_idx' argument for 'add') + * from zero to the number of planes used by the drm_fourcc format code. + * All planes required by the format must be given exactly once, but can + * be given in any order. Each plane index can be set only once. + */ +extern const struct wl_interface zwp_linux_buffer_params_v1_interface; + +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + * @struct zwp_linux_dmabuf_v1_listener + */ +struct zwp_linux_dmabuf_v1_listener { + /** + * supported buffer format + * + * This event advertises one buffer format that the server + * supports. All the supported formats are advertised once when the + * client binds to this interface. A roundtrip after binding + * guarantees that the client has received all supported formats. + * + * For the definition of the format codes, see the + * zwp_linux_buffer_params_v1::create request. + * + * Warning: the 'format' event is likely to be deprecated and + * replaced with the 'modifier' event introduced in + * zwp_linux_dmabuf_v1 version 3, described below. Please refrain + * from using the information received from this event. + * @param format DRM_FORMAT code + */ + void (*format)(void* data, struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, + uint32_t format); + /** + * supported buffer format modifier + * + * This event advertises the formats that the server supports, + * along with the modifiers supported for each format. All the + * supported modifiers for all the supported formats are advertised + * once when the client binds to this interface. A roundtrip after + * binding guarantees that the client has received all supported + * format-modifier pairs. + * + * For the definition of the format and modifier codes, see the + * zwp_linux_buffer_params_v1::create request. + * @param format DRM_FORMAT code + * @param modifier_hi high 32 bits of layout modifier + * @param modifier_lo low 32 bits of layout modifier + * @since 3 + */ + void (*modifier)(void* data, struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, + uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo); +}; + +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + */ +static inline int zwp_linux_dmabuf_v1_add_listener( + struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, + const struct zwp_linux_dmabuf_v1_listener* listener, void* data) { + return wl_proxy_add_listener((struct wl_proxy*)zwp_linux_dmabuf_v1, + (void (**)(void))listener, data); +} + +#define ZWP_LINUX_DMABUF_V1_DESTROY 0 +#define ZWP_LINUX_DMABUF_V1_CREATE_PARAMS 1 + +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + */ +#define ZWP_LINUX_DMABUF_V1_FORMAT_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + */ +#define ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION 3 + +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + */ +#define ZWP_LINUX_DMABUF_V1_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + */ +#define ZWP_LINUX_DMABUF_V1_CREATE_PARAMS_SINCE_VERSION 1 + +/** @ingroup iface_zwp_linux_dmabuf_v1 */ +static inline void zwp_linux_dmabuf_v1_set_user_data( + struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, void* user_data) { + wl_proxy_set_user_data((struct wl_proxy*)zwp_linux_dmabuf_v1, user_data); +} + +/** @ingroup iface_zwp_linux_dmabuf_v1 */ +static inline void* zwp_linux_dmabuf_v1_get_user_data( + struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { + return wl_proxy_get_user_data((struct wl_proxy*)zwp_linux_dmabuf_v1); +} + +static inline uint32_t zwp_linux_dmabuf_v1_get_version( + struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { + return wl_proxy_get_version((struct wl_proxy*)zwp_linux_dmabuf_v1); +} + +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + * + * Objects created through this interface, especially wl_buffers, will + * remain valid. + */ +static inline void zwp_linux_dmabuf_v1_destroy( + struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { + wl_proxy_marshal((struct wl_proxy*)zwp_linux_dmabuf_v1, + ZWP_LINUX_DMABUF_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy*)zwp_linux_dmabuf_v1); +} + +/** + * @ingroup iface_zwp_linux_dmabuf_v1 + * + * This temporary object is used to collect multiple dmabuf handles into + * a single batch to create a wl_buffer. It can only be used once and + * should be destroyed after a 'created' or 'failed' event has been + * received. + */ +static inline struct zwp_linux_buffer_params_v1* +zwp_linux_dmabuf_v1_create_params( + struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { + struct wl_proxy* params_id; + + params_id = wl_proxy_marshal_constructor( + (struct wl_proxy*)zwp_linux_dmabuf_v1, ZWP_LINUX_DMABUF_V1_CREATE_PARAMS, + &zwp_linux_buffer_params_v1_interface, NULL); + + return (struct zwp_linux_buffer_params_v1*)params_id; +} + +#ifndef ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM +# define ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM +enum zwp_linux_buffer_params_v1_error { + /** + * the dmabuf_batch object has already been used to create a wl_buffer + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ALREADY_USED = 0, + /** + * plane index out of bounds + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_IDX = 1, + /** + * the plane index was already set + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_SET = 2, + /** + * missing or too many planes to create a buffer + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE = 3, + /** + * format not supported + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT = 4, + /** + * invalid width or height + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_DIMENSIONS = 5, + /** + * offset + stride * height goes out of dmabuf bounds + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_OUT_OF_BOUNDS = 6, + /** + * invalid wl_buffer resulted from importing dmabufs via the + * create_immed request on given buffer_params + */ + ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_WL_BUFFER = 7, +}; +#endif /* ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM */ + +#ifndef ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM +# define ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM +enum zwp_linux_buffer_params_v1_flags { + /** + * contents are y-inverted + */ + ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT = 1, + /** + * content is interlaced + */ + ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED = 2, + /** + * bottom field first + */ + ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST = 4, +}; +#endif /* ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM */ + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + * @struct zwp_linux_buffer_params_v1_listener + */ +struct zwp_linux_buffer_params_v1_listener { + /** + * buffer creation succeeded + * + * This event indicates that the attempted buffer creation was + * successful. It provides the new wl_buffer referencing the + * dmabuf(s). + * + * Upon receiving this event, the client should destroy the + * zlinux_dmabuf_params object. + * @param buffer the newly created wl_buffer + */ + void (*created)(void* data, + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, + struct wl_buffer* buffer); + /** + * buffer creation failed + * + * This event indicates that the attempted buffer creation has + * failed. It usually means that one of the dmabuf constraints has + * not been fulfilled. + * + * Upon receiving this event, the client should destroy the + * zlinux_buffer_params object. + */ + void (*failed)(void* data, + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1); +}; + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + */ +static inline int zwp_linux_buffer_params_v1_add_listener( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, + const struct zwp_linux_buffer_params_v1_listener* listener, void* data) { + return wl_proxy_add_listener((struct wl_proxy*)zwp_linux_buffer_params_v1, + (void (**)(void))listener, data); +} + +#define ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY 0 +#define ZWP_LINUX_BUFFER_PARAMS_V1_ADD 1 +#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE 2 +#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED 3 + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + */ +#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATED_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + */ +#define ZWP_LINUX_BUFFER_PARAMS_V1_FAILED_SINCE_VERSION 1 + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + */ +#define ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + */ +#define ZWP_LINUX_BUFFER_PARAMS_V1_ADD_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + */ +#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + */ +#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED_SINCE_VERSION 2 + +/** @ingroup iface_zwp_linux_buffer_params_v1 */ +static inline void zwp_linux_buffer_params_v1_set_user_data( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, + void* user_data) { + wl_proxy_set_user_data((struct wl_proxy*)zwp_linux_buffer_params_v1, + user_data); +} + +/** @ingroup iface_zwp_linux_buffer_params_v1 */ +static inline void* zwp_linux_buffer_params_v1_get_user_data( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1) { + return wl_proxy_get_user_data((struct wl_proxy*)zwp_linux_buffer_params_v1); +} + +static inline uint32_t zwp_linux_buffer_params_v1_get_version( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1) { + return wl_proxy_get_version((struct wl_proxy*)zwp_linux_buffer_params_v1); +} + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + * + * Cleans up the temporary data sent to the server for dmabuf-based + * wl_buffer creation. + */ +static inline void zwp_linux_buffer_params_v1_destroy( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1) { + wl_proxy_marshal((struct wl_proxy*)zwp_linux_buffer_params_v1, + ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy*)zwp_linux_buffer_params_v1); +} + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + * + * This request adds one dmabuf to the set in this + * zwp_linux_buffer_params_v1. + * + * The 64-bit unsigned value combined from modifier_hi and modifier_lo + * is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the + * fb modifier, which is defined in drm_mode.h of Linux UAPI. + * This is an opaque token. Drivers use this token to express tiling, + * compression, etc. driver-specific modifications to the base format + * defined by the DRM fourcc code. + * + * This request raises the PLANE_IDX error if plane_idx is too large. + * The error PLANE_SET is raised if attempting to set a plane that + * was already set. + */ +static inline void zwp_linux_buffer_params_v1_add( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, int32_t fd, + uint32_t plane_idx, uint32_t offset, uint32_t stride, uint32_t modifier_hi, + uint32_t modifier_lo) { + wl_proxy_marshal((struct wl_proxy*)zwp_linux_buffer_params_v1, + ZWP_LINUX_BUFFER_PARAMS_V1_ADD, fd, plane_idx, offset, + stride, modifier_hi, modifier_lo); +} + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + * + * This asks for creation of a wl_buffer from the added dmabuf + * buffers. The wl_buffer is not created immediately but returned via + * the 'created' event if the dmabuf sharing succeeds. The sharing + * may fail at runtime for reasons a client cannot predict, in + * which case the 'failed' event is triggered. + * + * The 'format' argument is a DRM_FORMAT code, as defined by the + * libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the + * authoritative source on how the format codes should work. + * + * The 'flags' is a bitfield of the flags defined in enum "flags". + * 'y_invert' means the that the image needs to be y-flipped. + * + * Flag 'interlaced' means that the frame in the buffer is not + * progressive as usual, but interlaced. An interlaced buffer as + * supported here must always contain both top and bottom fields. + * The top field always begins on the first pixel row. The temporal + * ordering between the two fields is top field first, unless + * 'bottom_first' is specified. It is undefined whether 'bottom_first' + * is ignored if 'interlaced' is not set. + * + * This protocol does not convey any information about field rate, + * duration, or timing, other than the relative ordering between the + * two fields in one buffer. A compositor may have to estimate the + * intended field rate from the incoming buffer rate. It is undefined + * whether the time of receiving wl_surface.commit with a new buffer + * attached, applying the wl_surface state, wl_surface.frame callback + * trigger, presentation, or any other point in the compositor cycle + * is used to measure the frame or field times. There is no support + * for detecting missed or late frames/fields/buffers either, and + * there is no support whatsoever for cooperating with interlaced + * compositor output. + * + * The composited image quality resulting from the use of interlaced + * buffers is explicitly undefined. A compositor may use elaborate + * hardware features or software to deinterlace and create progressive + * output frames from a sequence of interlaced input buffers, or it + * may produce substandard image quality. However, compositors that + * cannot guarantee reasonable image quality in all cases are recommended + * to just reject all interlaced buffers. + * + * Any argument errors, including non-positive width or height, + * mismatch between the number of planes and the format, bad + * format, bad offset or stride, may be indicated by fatal protocol + * errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, + * OUT_OF_BOUNDS. + * + * Dmabuf import errors in the server that are not obvious client + * bugs are returned via the 'failed' event as non-fatal. This + * allows attempting dmabuf sharing and falling back in the client + * if it fails. + * + * This request can be sent only once in the object's lifetime, after + * which the only legal request is destroy. This object should be + * destroyed after issuing a 'create' request. Attempting to use this + * object after issuing 'create' raises ALREADY_USED protocol error. + * + * It is not mandatory to issue 'create'. If a client wants to + * cancel the buffer creation, it can just destroy this object. + */ +static inline void zwp_linux_buffer_params_v1_create( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, + int32_t width, int32_t height, uint32_t format, uint32_t flags) { + wl_proxy_marshal((struct wl_proxy*)zwp_linux_buffer_params_v1, + ZWP_LINUX_BUFFER_PARAMS_V1_CREATE, width, height, format, + flags); +} + +/** + * @ingroup iface_zwp_linux_buffer_params_v1 + * + * This asks for immediate creation of a wl_buffer by importing the + * added dmabufs. + * + * In case of import success, no event is sent from the server, and the + * wl_buffer is ready to be used by the client. + * + * Upon import failure, either of the following may happen, as seen fit + * by the implementation: + * - the client is terminated with one of the following fatal protocol + * errors: + * - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS, + * in case of argument errors such as mismatch between the number + * of planes and the format, bad format, non-positive width or + * height, or bad offset or stride. + * - INVALID_WL_BUFFER, in case the cause for failure is unknown or + * plaform specific. + * - the server creates an invalid wl_buffer, marks it as failed and + * sends a 'failed' event to the client. The result of using this + * invalid wl_buffer as an argument in any request by the client is + * defined by the compositor implementation. + * + * This takes the same arguments as a 'create' request, and obeys the + * same restrictions. + */ +static inline struct wl_buffer* zwp_linux_buffer_params_v1_create_immed( + struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, + int32_t width, int32_t height, uint32_t format, uint32_t flags) { + struct wl_proxy* buffer_id; + + buffer_id = wl_proxy_marshal_constructor( + (struct wl_proxy*)zwp_linux_buffer_params_v1, + ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED, &wl_buffer_interface, NULL, + width, height, format, flags); + + return (struct wl_buffer*)buffer_id; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/widget/gtk/wayland/linux-dmabuf-unstable-v1-protocol.c b/widget/gtk/wayland/linux-dmabuf-unstable-v1-protocol.c new file mode 100644 index 0000000000..51c1e8e575 --- /dev/null +++ b/widget/gtk/wayland/linux-dmabuf-unstable-v1-protocol.c @@ -0,0 +1,81 @@ +/* Generated by wayland-scanner 1.17.0 */ + +/* + * Copyright © 2014, 2015 Collabora, Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdlib.h> +#include <stdint.h> +#include "wayland-util.h" + +#pragma GCC visibility push(default) +extern const struct wl_interface wl_buffer_interface; +extern const struct wl_interface zwp_linux_buffer_params_v1_interface; +#pragma GCC visibility pop + +static const struct wl_interface* types[] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + &zwp_linux_buffer_params_v1_interface, + &wl_buffer_interface, + NULL, + NULL, + NULL, + NULL, + &wl_buffer_interface, +}; + +static const struct wl_message zwp_linux_dmabuf_v1_requests[] = { + {"destroy", "", types + 0}, + {"create_params", "n", types + 6}, +}; + +static const struct wl_message zwp_linux_dmabuf_v1_events[] = { + {"format", "u", types + 0}, + {"modifier", "3uuu", types + 0}, +}; + +const struct wl_interface zwp_linux_dmabuf_v1_interface = { + "zwp_linux_dmabuf_v1", 3, 2, + zwp_linux_dmabuf_v1_requests, 2, zwp_linux_dmabuf_v1_events, +}; + +static const struct wl_message zwp_linux_buffer_params_v1_requests[] = { + {"destroy", "", types + 0}, + {"add", "huuuuu", types + 0}, + {"create", "iiuu", types + 0}, + {"create_immed", "2niiuu", types + 7}, +}; + +static const struct wl_message zwp_linux_buffer_params_v1_events[] = { + {"created", "n", types + 12}, + {"failed", "", types + 0}, +}; + +const struct wl_interface zwp_linux_buffer_params_v1_interface = { + "zwp_linux_buffer_params_v1", 3, 4, + zwp_linux_buffer_params_v1_requests, 2, zwp_linux_buffer_params_v1_events, +}; diff --git a/widget/gtk/wayland/moz.build b/widget/gtk/wayland/moz.build new file mode 100644 index 0000000000..a6d4adbdc3 --- /dev/null +++ b/widget/gtk/wayland/moz.build @@ -0,0 +1,35 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +with Files("**"): + BUG_COMPONENT = ("Core", "Widget: Gtk") + +SOURCES += [ + "gtk-primary-selection-protocol.c", + "idle-inhibit-unstable-v1-protocol.c", + "linux-dmabuf-unstable-v1-protocol.c", + "primary-selection-unstable-v1-protocol.c", + "xdg-output-unstable-v1-protocol.c", +] + +EXPORTS.mozilla.widget += [ + "gbm.h", + "gtk-primary-selection-client-protocol.h", + "idle-inhibit-unstable-v1-client-protocol.h", + "linux-dmabuf-unstable-v1-client-protocol.h", + "primary-selection-unstable-v1-client-protocol.h", + "va_drmcommon.h", + "xdg-output-unstable-v1-client-protocol.h", +] + +include("/ipc/chromium/chromium-config.mozbuild") + +FINAL_LIBRARY = "xul" + +CFLAGS += CONFIG["TK_CFLAGS"] +CXXFLAGS += CONFIG["TK_CFLAGS"] + +CXXFLAGS += ["-Wno-error=shadow"] diff --git a/widget/gtk/wayland/primary-selection-unstable-v1-client-protocol.h b/widget/gtk/wayland/primary-selection-unstable-v1-client-protocol.h new file mode 100644 index 0000000000..998266c3db --- /dev/null +++ b/widget/gtk/wayland/primary-selection-unstable-v1-client-protocol.h @@ -0,0 +1,578 @@ +/* Generated by wayland-scanner 1.18.0 */ + +#ifndef WP_PRIMARY_SELECTION_UNSTABLE_V1_CLIENT_PROTOCOL_H +#define WP_PRIMARY_SELECTION_UNSTABLE_V1_CLIENT_PROTOCOL_H + +#include <stdint.h> +#include <stddef.h> +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_wp_primary_selection_unstable_v1 The wp_primary_selection_unstable_v1 protocol + * Primary selection protocol + * + * @section page_desc_wp_primary_selection_unstable_v1 Description + * + * This protocol provides the ability to have a primary selection device to + * match that of the X server. This primary selection is a shortcut to the + * common clipboard selection, where text just needs to be selected in order + * to allow copying it elsewhere. The de facto way to perform this action + * is the middle mouse button, although it is not limited to this one. + * + * Clients wishing to honor primary selection should create a primary + * selection source and set it as the selection through + * wp_primary_selection_device.set_selection whenever the text selection + * changes. In order to minimize calls in pointer-driven text selection, + * it should happen only once after the operation finished. Similarly, + * a NULL source should be set when text is unselected. + * + * wp_primary_selection_offer objects are first announced through the + * wp_primary_selection_device.data_offer event. Immediately after this event, + * the primary data offer will emit wp_primary_selection_offer.offer events + * to let know of the mime types being offered. + * + * When the primary selection changes, the client with the keyboard focus + * will receive wp_primary_selection_device.selection events. Only the client + * with the keyboard focus will receive such events with a non-NULL + * wp_primary_selection_offer. Across keyboard focus changes, previously + * focused clients will receive wp_primary_selection_device.events with a + * NULL wp_primary_selection_offer. + * + * In order to request the primary selection data, the client must pass + * a recent serial pertaining to the press event that is triggering the + * operation, if the compositor deems the serial valid and recent, the + * wp_primary_selection_source.send event will happen in the other end + * to let the transfer begin. The client owning the primary selection + * should write the requested data, and close the file descriptor + * immediately. + * + * If the primary selection owner client disappeared during the transfer, + * the client reading the data will receive a + * wp_primary_selection_device.selection event with a NULL + * wp_primary_selection_offer, the client should take this as a hint + * to finish the reads related to the no longer existing offer. + * + * The primary selection owner should be checking for errors during + * writes, merely cancelling the ongoing transfer if any happened. + * + * @section page_ifaces_wp_primary_selection_unstable_v1 Interfaces + * - @subpage page_iface_zwp_primary_selection_device_manager_v1 - X primary selection emulation + * - @subpage page_iface_zwp_primary_selection_device_v1 - + * - @subpage page_iface_zwp_primary_selection_offer_v1 - offer to transfer primary selection contents + * - @subpage page_iface_zwp_primary_selection_source_v1 - offer to replace the contents of the primary selection + * @section page_copyright_wp_primary_selection_unstable_v1 Copyright + * <pre> + * + * Copyright © 2015, 2016 Red Hat + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * </pre> + */ +struct wl_seat; +struct zwp_primary_selection_device_manager_v1; +struct zwp_primary_selection_device_v1; +struct zwp_primary_selection_offer_v1; +struct zwp_primary_selection_source_v1; + +/** + * @page page_iface_zwp_primary_selection_device_manager_v1 zwp_primary_selection_device_manager_v1 + * @section page_iface_zwp_primary_selection_device_manager_v1_desc Description + * + * The primary selection device manager is a singleton global object that + * provides access to the primary selection. It allows to create + * wp_primary_selection_source objects, as well as retrieving the per-seat + * wp_primary_selection_device objects. + * @section page_iface_zwp_primary_selection_device_manager_v1_api API + * See @ref iface_zwp_primary_selection_device_manager_v1. + */ +/** + * @defgroup iface_zwp_primary_selection_device_manager_v1 The zwp_primary_selection_device_manager_v1 interface + * + * The primary selection device manager is a singleton global object that + * provides access to the primary selection. It allows to create + * wp_primary_selection_source objects, as well as retrieving the per-seat + * wp_primary_selection_device objects. + */ +extern const struct wl_interface zwp_primary_selection_device_manager_v1_interface; +/** + * @page page_iface_zwp_primary_selection_device_v1 zwp_primary_selection_device_v1 + * @section page_iface_zwp_primary_selection_device_v1_api API + * See @ref iface_zwp_primary_selection_device_v1. + */ +/** + * @defgroup iface_zwp_primary_selection_device_v1 The zwp_primary_selection_device_v1 interface + */ +extern const struct wl_interface zwp_primary_selection_device_v1_interface; +/** + * @page page_iface_zwp_primary_selection_offer_v1 zwp_primary_selection_offer_v1 + * @section page_iface_zwp_primary_selection_offer_v1_desc Description + * + * A wp_primary_selection_offer represents an offer to transfer the contents + * of the primary selection clipboard to the client. Similar to + * wl_data_offer, the offer also describes the mime types that the data can + * be converted to and provides the mechanisms for transferring the data + * directly to the client. + * @section page_iface_zwp_primary_selection_offer_v1_api API + * See @ref iface_zwp_primary_selection_offer_v1. + */ +/** + * @defgroup iface_zwp_primary_selection_offer_v1 The zwp_primary_selection_offer_v1 interface + * + * A wp_primary_selection_offer represents an offer to transfer the contents + * of the primary selection clipboard to the client. Similar to + * wl_data_offer, the offer also describes the mime types that the data can + * be converted to and provides the mechanisms for transferring the data + * directly to the client. + */ +extern const struct wl_interface zwp_primary_selection_offer_v1_interface; +/** + * @page page_iface_zwp_primary_selection_source_v1 zwp_primary_selection_source_v1 + * @section page_iface_zwp_primary_selection_source_v1_desc Description + * + * The source side of a wp_primary_selection_offer, it provides a way to + * describe the offered data and respond to requests to transfer the + * requested contents of the primary selection clipboard. + * @section page_iface_zwp_primary_selection_source_v1_api API + * See @ref iface_zwp_primary_selection_source_v1. + */ +/** + * @defgroup iface_zwp_primary_selection_source_v1 The zwp_primary_selection_source_v1 interface + * + * The source side of a wp_primary_selection_offer, it provides a way to + * describe the offered data and respond to requests to transfer the + * requested contents of the primary selection clipboard. + */ +extern const struct wl_interface zwp_primary_selection_source_v1_interface; + +#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_CREATE_SOURCE 0 +#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_GET_DEVICE 1 +#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_DESTROY 2 + + +/** + * @ingroup iface_zwp_primary_selection_device_manager_v1 + */ +#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_CREATE_SOURCE_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_primary_selection_device_manager_v1 + */ +#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_GET_DEVICE_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_primary_selection_device_manager_v1 + */ +#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_zwp_primary_selection_device_manager_v1 */ +static inline void +zwp_primary_selection_device_manager_v1_set_user_data(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_device_manager_v1, user_data); +} + +/** @ingroup iface_zwp_primary_selection_device_manager_v1 */ +static inline void * +zwp_primary_selection_device_manager_v1_get_user_data(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1) +{ + return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_device_manager_v1); +} + +static inline uint32_t +zwp_primary_selection_device_manager_v1_get_version(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1) +{ + return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_device_manager_v1); +} + +/** + * @ingroup iface_zwp_primary_selection_device_manager_v1 + * + * Create a new primary selection source. + */ +static inline struct zwp_primary_selection_source_v1 * +zwp_primary_selection_device_manager_v1_create_source(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_primary_selection_device_manager_v1, + ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_CREATE_SOURCE, &zwp_primary_selection_source_v1_interface, NULL); + + return (struct zwp_primary_selection_source_v1 *) id; +} + +/** + * @ingroup iface_zwp_primary_selection_device_manager_v1 + * + * Create a new data device for a given seat. + */ +static inline struct zwp_primary_selection_device_v1 * +zwp_primary_selection_device_manager_v1_get_device(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1, struct wl_seat *seat) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_primary_selection_device_manager_v1, + ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_GET_DEVICE, &zwp_primary_selection_device_v1_interface, NULL, seat); + + return (struct zwp_primary_selection_device_v1 *) id; +} + +/** + * @ingroup iface_zwp_primary_selection_device_manager_v1 + * + * Destroy the primary selection device manager. + */ +static inline void +zwp_primary_selection_device_manager_v1_destroy(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1) +{ + wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_device_manager_v1, + ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_device_manager_v1); +} + +/** + * @ingroup iface_zwp_primary_selection_device_v1 + * @struct zwp_primary_selection_device_v1_listener + */ +struct zwp_primary_selection_device_v1_listener { + /** + * introduce a new wp_primary_selection_offer + * + * Introduces a new wp_primary_selection_offer object that may be + * used to receive the current primary selection. Immediately + * following this event, the new wp_primary_selection_offer object + * will send wp_primary_selection_offer.offer events to describe + * the offered mime types. + */ + void (*data_offer)(void *data, + struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1, + struct zwp_primary_selection_offer_v1 *offer); + /** + * advertise a new primary selection + * + * The wp_primary_selection_device.selection event is sent to + * notify the client of a new primary selection. This event is sent + * after the wp_primary_selection.data_offer event introducing this + * object, and after the offer has announced its mimetypes through + * wp_primary_selection_offer.offer. + * + * The data_offer is valid until a new offer or NULL is received or + * until the client loses keyboard focus. The client must destroy + * the previous selection data_offer, if any, upon receiving this + * event. + */ + void (*selection)(void *data, + struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1, + struct zwp_primary_selection_offer_v1 *id); +}; + +/** + * @ingroup iface_zwp_primary_selection_device_v1 + */ +static inline int +zwp_primary_selection_device_v1_add_listener(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1, + const struct zwp_primary_selection_device_v1_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) zwp_primary_selection_device_v1, + (void (**)(void)) listener, data); +} + +#define ZWP_PRIMARY_SELECTION_DEVICE_V1_SET_SELECTION 0 +#define ZWP_PRIMARY_SELECTION_DEVICE_V1_DESTROY 1 + +/** + * @ingroup iface_zwp_primary_selection_device_v1 + */ +#define ZWP_PRIMARY_SELECTION_DEVICE_V1_DATA_OFFER_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_primary_selection_device_v1 + */ +#define ZWP_PRIMARY_SELECTION_DEVICE_V1_SELECTION_SINCE_VERSION 1 + +/** + * @ingroup iface_zwp_primary_selection_device_v1 + */ +#define ZWP_PRIMARY_SELECTION_DEVICE_V1_SET_SELECTION_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_primary_selection_device_v1 + */ +#define ZWP_PRIMARY_SELECTION_DEVICE_V1_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_zwp_primary_selection_device_v1 */ +static inline void +zwp_primary_selection_device_v1_set_user_data(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_device_v1, user_data); +} + +/** @ingroup iface_zwp_primary_selection_device_v1 */ +static inline void * +zwp_primary_selection_device_v1_get_user_data(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1) +{ + return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_device_v1); +} + +static inline uint32_t +zwp_primary_selection_device_v1_get_version(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1) +{ + return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_device_v1); +} + +/** + * @ingroup iface_zwp_primary_selection_device_v1 + * + * Replaces the current selection. The previous owner of the primary + * selection will receive a wp_primary_selection_source.cancelled event. + * + * To unset the selection, set the source to NULL. + */ +static inline void +zwp_primary_selection_device_v1_set_selection(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1, struct zwp_primary_selection_source_v1 *source, uint32_t serial) +{ + wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_device_v1, + ZWP_PRIMARY_SELECTION_DEVICE_V1_SET_SELECTION, source, serial); +} + +/** + * @ingroup iface_zwp_primary_selection_device_v1 + * + * Destroy the primary selection device. + */ +static inline void +zwp_primary_selection_device_v1_destroy(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1) +{ + wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_device_v1, + ZWP_PRIMARY_SELECTION_DEVICE_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_device_v1); +} + +/** + * @ingroup iface_zwp_primary_selection_offer_v1 + * @struct zwp_primary_selection_offer_v1_listener + */ +struct zwp_primary_selection_offer_v1_listener { + /** + * advertise offered mime type + * + * Sent immediately after creating announcing the + * wp_primary_selection_offer through + * wp_primary_selection_device.data_offer. One event is sent per + * offered mime type. + */ + void (*offer)(void *data, + struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1, + const char *mime_type); +}; + +/** + * @ingroup iface_zwp_primary_selection_offer_v1 + */ +static inline int +zwp_primary_selection_offer_v1_add_listener(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1, + const struct zwp_primary_selection_offer_v1_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) zwp_primary_selection_offer_v1, + (void (**)(void)) listener, data); +} + +#define ZWP_PRIMARY_SELECTION_OFFER_V1_RECEIVE 0 +#define ZWP_PRIMARY_SELECTION_OFFER_V1_DESTROY 1 + +/** + * @ingroup iface_zwp_primary_selection_offer_v1 + */ +#define ZWP_PRIMARY_SELECTION_OFFER_V1_OFFER_SINCE_VERSION 1 + +/** + * @ingroup iface_zwp_primary_selection_offer_v1 + */ +#define ZWP_PRIMARY_SELECTION_OFFER_V1_RECEIVE_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_primary_selection_offer_v1 + */ +#define ZWP_PRIMARY_SELECTION_OFFER_V1_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_zwp_primary_selection_offer_v1 */ +static inline void +zwp_primary_selection_offer_v1_set_user_data(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_offer_v1, user_data); +} + +/** @ingroup iface_zwp_primary_selection_offer_v1 */ +static inline void * +zwp_primary_selection_offer_v1_get_user_data(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1) +{ + return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_offer_v1); +} + +static inline uint32_t +zwp_primary_selection_offer_v1_get_version(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1) +{ + return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_offer_v1); +} + +/** + * @ingroup iface_zwp_primary_selection_offer_v1 + * + * To transfer the contents of the primary selection clipboard, the client + * issues this request and indicates the mime type that it wants to + * receive. The transfer happens through the passed file descriptor + * (typically created with the pipe system call). The source client writes + * the data in the mime type representation requested and then closes the + * file descriptor. + * + * The receiving client reads from the read end of the pipe until EOF and + * closes its end, at which point the transfer is complete. + */ +static inline void +zwp_primary_selection_offer_v1_receive(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1, const char *mime_type, int32_t fd) +{ + wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_offer_v1, + ZWP_PRIMARY_SELECTION_OFFER_V1_RECEIVE, mime_type, fd); +} + +/** + * @ingroup iface_zwp_primary_selection_offer_v1 + * + * Destroy the primary selection offer. + */ +static inline void +zwp_primary_selection_offer_v1_destroy(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1) +{ + wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_offer_v1, + ZWP_PRIMARY_SELECTION_OFFER_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_offer_v1); +} + +/** + * @ingroup iface_zwp_primary_selection_source_v1 + * @struct zwp_primary_selection_source_v1_listener + */ +struct zwp_primary_selection_source_v1_listener { + /** + * send the primary selection contents + * + * Request for the current primary selection contents from the + * client. Send the specified mime type over the passed file + * descriptor, then close it. + */ + void (*send)(void *data, + struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1, + const char *mime_type, + int32_t fd); + /** + * request for primary selection contents was canceled + * + * This primary selection source is no longer valid. The client + * should clean up and destroy this primary selection source. + */ + void (*cancelled)(void *data, + struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1); +}; + +/** + * @ingroup iface_zwp_primary_selection_source_v1 + */ +static inline int +zwp_primary_selection_source_v1_add_listener(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1, + const struct zwp_primary_selection_source_v1_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) zwp_primary_selection_source_v1, + (void (**)(void)) listener, data); +} + +#define ZWP_PRIMARY_SELECTION_SOURCE_V1_OFFER 0 +#define ZWP_PRIMARY_SELECTION_SOURCE_V1_DESTROY 1 + +/** + * @ingroup iface_zwp_primary_selection_source_v1 + */ +#define ZWP_PRIMARY_SELECTION_SOURCE_V1_SEND_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_primary_selection_source_v1 + */ +#define ZWP_PRIMARY_SELECTION_SOURCE_V1_CANCELLED_SINCE_VERSION 1 + +/** + * @ingroup iface_zwp_primary_selection_source_v1 + */ +#define ZWP_PRIMARY_SELECTION_SOURCE_V1_OFFER_SINCE_VERSION 1 +/** + * @ingroup iface_zwp_primary_selection_source_v1 + */ +#define ZWP_PRIMARY_SELECTION_SOURCE_V1_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_zwp_primary_selection_source_v1 */ +static inline void +zwp_primary_selection_source_v1_set_user_data(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_source_v1, user_data); +} + +/** @ingroup iface_zwp_primary_selection_source_v1 */ +static inline void * +zwp_primary_selection_source_v1_get_user_data(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1) +{ + return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_source_v1); +} + +static inline uint32_t +zwp_primary_selection_source_v1_get_version(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1) +{ + return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_source_v1); +} + +/** + * @ingroup iface_zwp_primary_selection_source_v1 + * + * This request adds a mime type to the set of mime types advertised to + * targets. Can be called several times to offer multiple types. + */ +static inline void +zwp_primary_selection_source_v1_offer(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1, const char *mime_type) +{ + wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_source_v1, + ZWP_PRIMARY_SELECTION_SOURCE_V1_OFFER, mime_type); +} + +/** + * @ingroup iface_zwp_primary_selection_source_v1 + * + * Destroy the primary selection source. + */ +static inline void +zwp_primary_selection_source_v1_destroy(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1) +{ + wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_source_v1, + ZWP_PRIMARY_SELECTION_SOURCE_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_source_v1); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/widget/gtk/wayland/primary-selection-unstable-v1-protocol.c b/widget/gtk/wayland/primary-selection-unstable-v1-protocol.c new file mode 100644 index 0000000000..9f43d4d65e --- /dev/null +++ b/widget/gtk/wayland/primary-selection-unstable-v1-protocol.c @@ -0,0 +1,115 @@ +/* Generated by wayland-scanner 1.18.0 */ + +/* + * Copyright © 2015, 2016 Red Hat + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdlib.h> +#include <stdint.h> +#include <gdk/gdkwayland.h> +#include "wayland-util.h" + +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif + +#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) +#define WL_PRIVATE __attribute__ ((visibility("hidden"))) +#else +#define WL_PRIVATE +#endif + +extern const struct wl_interface wl_seat_interface; +extern const struct wl_interface zwp_primary_selection_device_v1_interface; +extern const struct wl_interface zwp_primary_selection_offer_v1_interface; +extern const struct wl_interface zwp_primary_selection_source_v1_interface; + +static const struct wl_interface *wp_primary_selection_unstable_v1_types[] = { + NULL, + NULL, + &zwp_primary_selection_source_v1_interface, + &zwp_primary_selection_device_v1_interface, + &wl_seat_interface, + &zwp_primary_selection_source_v1_interface, + NULL, + &zwp_primary_selection_offer_v1_interface, + &zwp_primary_selection_offer_v1_interface, +}; + +static const struct wl_message zwp_primary_selection_device_manager_v1_requests[] = { + { "create_source", "n", wp_primary_selection_unstable_v1_types + 2 }, + { "get_device", "no", wp_primary_selection_unstable_v1_types + 3 }, + { "destroy", "", wp_primary_selection_unstable_v1_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface zwp_primary_selection_device_manager_v1_interface = { + "zwp_primary_selection_device_manager_v1", 1, + 3, zwp_primary_selection_device_manager_v1_requests, + 0, NULL, +}; + +static const struct wl_message zwp_primary_selection_device_v1_requests[] = { + { "set_selection", "?ou", wp_primary_selection_unstable_v1_types + 5 }, + { "destroy", "", wp_primary_selection_unstable_v1_types + 0 }, +}; + +static const struct wl_message zwp_primary_selection_device_v1_events[] = { + { "data_offer", "n", wp_primary_selection_unstable_v1_types + 7 }, + { "selection", "?o", wp_primary_selection_unstable_v1_types + 8 }, +}; + +WL_PRIVATE const struct wl_interface zwp_primary_selection_device_v1_interface = { + "zwp_primary_selection_device_v1", 1, + 2, zwp_primary_selection_device_v1_requests, + 2, zwp_primary_selection_device_v1_events, +}; + +static const struct wl_message zwp_primary_selection_offer_v1_requests[] = { + { "receive", "sh", wp_primary_selection_unstable_v1_types + 0 }, + { "destroy", "", wp_primary_selection_unstable_v1_types + 0 }, +}; + +static const struct wl_message zwp_primary_selection_offer_v1_events[] = { + { "offer", "s", wp_primary_selection_unstable_v1_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface zwp_primary_selection_offer_v1_interface = { + "zwp_primary_selection_offer_v1", 1, + 2, zwp_primary_selection_offer_v1_requests, + 1, zwp_primary_selection_offer_v1_events, +}; + +static const struct wl_message zwp_primary_selection_source_v1_requests[] = { + { "offer", "s", wp_primary_selection_unstable_v1_types + 0 }, + { "destroy", "", wp_primary_selection_unstable_v1_types + 0 }, +}; + +static const struct wl_message zwp_primary_selection_source_v1_events[] = { + { "send", "sh", wp_primary_selection_unstable_v1_types + 0 }, + { "cancelled", "", wp_primary_selection_unstable_v1_types + 0 }, +}; + +WL_PRIVATE const struct wl_interface zwp_primary_selection_source_v1_interface = { + "zwp_primary_selection_source_v1", 1, + 2, zwp_primary_selection_source_v1_requests, + 2, zwp_primary_selection_source_v1_events, +}; diff --git a/widget/gtk/wayland/va_drmcommon.h b/widget/gtk/wayland/va_drmcommon.h new file mode 100644 index 0000000000..e16f244a46 --- /dev/null +++ b/widget/gtk/wayland/va_drmcommon.h @@ -0,0 +1,156 @@ +/* + * va_drmcommon.h - Common utilities for DRM-based drivers + * + * Copyright (c) 2012 Intel Corporation. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef VA_DRM_COMMON_H +#define VA_DRM_COMMON_H + +#include <stdint.h> + +/** \brief DRM authentication type. */ +enum { + /** \brief Disconnected. */ + VA_DRM_AUTH_NONE = 0, + /** + * \brief Connected. Authenticated with DRI1 protocol. + * + * @deprecated + * This is a deprecated authentication type. All DRI-based drivers have + * been migrated to use the DRI2 protocol. Newly written drivers shall + * use DRI2 protocol only, or a custom authentication means. e.g. opt + * for authenticating on the VA driver side, instead of libva side. + */ + VA_DRM_AUTH_DRI1 = 1, + /** + * \brief Connected. Authenticated with DRI2 protocol. + * + * This is only useful to VA/X11 drivers. The libva-x11 library provides + * a helper function VA_DRI2Authenticate() for authenticating the + * connection. However, DRI2 conformant drivers don't need to call that + * function since authentication happens on the libva side, implicitly. + */ + VA_DRM_AUTH_DRI2 = 2, + /** + * \brief Connected. Authenticated with some alternate raw protocol. + * + * This authentication mode is mainly used in non-VA/X11 drivers. + * Authentication happens through some alternative method, at the + * discretion of the VA driver implementation. + */ + VA_DRM_AUTH_CUSTOM = 3 +}; + +/** \brief Base DRM state. */ +struct drm_state { + /** \brief DRM connection descriptor. */ + int fd; + /** \brief DRM authentication type. */ + int auth_type; + /** \brief Reserved bytes for future use, must be zero */ + int va_reserved[8]; +}; + +/** \brief Kernel DRM buffer memory type. */ +#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM 0x10000000 +/** \brief DRM PRIME memory type (old version) + * + * This supports only single objects with restricted memory layout. + * Used with VASurfaceAttribExternalBuffers. + */ +#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000 +/** \brief DRM PRIME memory type + * + * Used with VADRMPRIMESurfaceDescriptor. + */ +#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000 + +/** + * \brief External buffer descriptor for a DRM PRIME surface. + * + * For export, call vaExportSurfaceHandle() with mem_type set to + * VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an + * instance of this structure to fill. + * If VA_EXPORT_SURFACE_SEPARATE_LAYERS is specified on export, each + * layer will contain exactly one plane. For example, an NV12 + * surface will be exported as two layers, one of DRM_FORMAT_R8 and + * one of DRM_FORMAT_GR88. + * If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export, + * there will be exactly one layer. + * + * For import, call vaCreateSurfaces() with the MemoryType attribute + * set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the + * ExternalBufferDescriptor attribute set to point to an array of + * num_surfaces instances of this structure. + * The number of planes which need to be provided for a given layer + * is dependent on both the format and the format modifier used for + * the objects containing it. For example, the format DRM_FORMAT_RGBA + * normally requires one plane, but with the format modifier + * I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first + * being the main data plane and the second containing the color + * control surface. + * Note that a given driver may only support a subset of possible + * representations of a particular format. For example, it may only + * support NV12 surfaces when they are contained within a single DRM + * object, and therefore fail to create such surfaces if the two + * planes are in different DRM objects. + */ +typedef struct _VADRMPRIMESurfaceDescriptor { + /** Pixel format fourcc of the whole surface (VA_FOURCC_*). */ + uint32_t fourcc; + /** Width of the surface in pixels. */ + uint32_t width; + /** Height of the surface in pixels. */ + uint32_t height; + /** Number of distinct DRM objects making up the surface. */ + uint32_t num_objects; + /** Description of each object. */ + struct { + /** DRM PRIME file descriptor for this object. */ + int fd; + /** Total size of this object (may include regions which are + * not part of the surface). */ + uint32_t size; + /** Format modifier applied to this object. */ + uint64_t drm_format_modifier; + } objects[4]; + /** Number of layers making up the surface. */ + uint32_t num_layers; + /** Description of each layer in the surface. */ + struct { + /** DRM format fourcc of this layer (DRM_FOURCC_*). */ + uint32_t drm_format; + /** Number of planes in this layer. */ + uint32_t num_planes; + /** Index in the objects array of the object containing each + * plane. */ + uint32_t object_index[4]; + /** Offset within the object of each plane. */ + uint32_t offset[4]; + /** Pitch of each plane. */ + uint32_t pitch[4]; + } layers[4]; +} VADRMPRIMESurfaceDescriptor; + +#endif /* VA_DRM_COMMON_H */ diff --git a/widget/gtk/wayland/xdg-output-unstable-v1-client-protocol.h b/widget/gtk/wayland/xdg-output-unstable-v1-client-protocol.h new file mode 100644 index 0000000000..432057ccef --- /dev/null +++ b/widget/gtk/wayland/xdg-output-unstable-v1-client-protocol.h @@ -0,0 +1,392 @@ +/* Generated by wayland-scanner 1.18.0 */ + +#ifndef XDG_OUTPUT_UNSTABLE_V1_CLIENT_PROTOCOL_H +#define XDG_OUTPUT_UNSTABLE_V1_CLIENT_PROTOCOL_H + +#include <stdint.h> +#include <stddef.h> +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_xdg_output_unstable_v1 The xdg_output_unstable_v1 protocol + * Protocol to describe output regions + * + * @section page_desc_xdg_output_unstable_v1 Description + * + * This protocol aims at describing outputs in a way which is more in line + * with the concept of an output on desktop oriented systems. + * + * Some information are more specific to the concept of an output for + * a desktop oriented system and may not make sense in other applications, + * such as IVI systems for example. + * + * Typically, the global compositor space on a desktop system is made of + * a contiguous or overlapping set of rectangular regions. + * + * Some of the information provided in this protocol might be identical + * to their counterparts already available from wl_output, in which case + * the information provided by this protocol should be preferred to their + * equivalent in wl_output. The goal is to move the desktop specific + * concepts (such as output location within the global compositor space, + * the connector name and types, etc.) out of the core wl_output protocol. + * + * Warning! The protocol described in this file is experimental and + * backward incompatible changes may be made. Backward compatible + * changes may be added together with the corresponding interface + * version bump. + * Backward incompatible changes are done by bumping the version + * number in the protocol and interface names and resetting the + * interface version. Once the protocol is to be declared stable, + * the 'z' prefix and the version number in the protocol and + * interface names are removed and the interface version number is + * reset. + * + * @section page_ifaces_xdg_output_unstable_v1 Interfaces + * - @subpage page_iface_zxdg_output_manager_v1 - manage xdg_output objects + * - @subpage page_iface_zxdg_output_v1 - compositor logical output region + * @section page_copyright_xdg_output_unstable_v1 Copyright + * <pre> + * + * Copyright © 2017 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * </pre> + */ +struct wl_output; +struct zxdg_output_manager_v1; +struct zxdg_output_v1; + +/** + * @page page_iface_zxdg_output_manager_v1 zxdg_output_manager_v1 + * @section page_iface_zxdg_output_manager_v1_desc Description + * + * A global factory interface for xdg_output objects. + * @section page_iface_zxdg_output_manager_v1_api API + * See @ref iface_zxdg_output_manager_v1. + */ +/** + * @defgroup iface_zxdg_output_manager_v1 The zxdg_output_manager_v1 interface + * + * A global factory interface for xdg_output objects. + */ +extern const struct wl_interface zxdg_output_manager_v1_interface; +/** + * @page page_iface_zxdg_output_v1 zxdg_output_v1 + * @section page_iface_zxdg_output_v1_desc Description + * + * An xdg_output describes part of the compositor geometry. + * + * This typically corresponds to a monitor that displays part of the + * compositor space. + * + * For objects version 3 onwards, after all xdg_output properties have been + * sent (when the object is created and when properties are updated), a + * wl_output.done event is sent. This allows changes to the output + * properties to be seen as atomic, even if they happen via multiple events. + * @section page_iface_zxdg_output_v1_api API + * See @ref iface_zxdg_output_v1. + */ +/** + * @defgroup iface_zxdg_output_v1 The zxdg_output_v1 interface + * + * An xdg_output describes part of the compositor geometry. + * + * This typically corresponds to a monitor that displays part of the + * compositor space. + * + * For objects version 3 onwards, after all xdg_output properties have been + * sent (when the object is created and when properties are updated), a + * wl_output.done event is sent. This allows changes to the output + * properties to be seen as atomic, even if they happen via multiple events. + */ +extern const struct wl_interface zxdg_output_v1_interface; + +#define ZXDG_OUTPUT_MANAGER_V1_DESTROY 0 +#define ZXDG_OUTPUT_MANAGER_V1_GET_XDG_OUTPUT 1 + +/** + * @ingroup iface_zxdg_output_manager_v1 + */ +#define ZXDG_OUTPUT_MANAGER_V1_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_zxdg_output_manager_v1 + */ +#define ZXDG_OUTPUT_MANAGER_V1_GET_XDG_OUTPUT_SINCE_VERSION 1 + +/** @ingroup iface_zxdg_output_manager_v1 */ +static inline void zxdg_output_manager_v1_set_user_data( + struct zxdg_output_manager_v1* zxdg_output_manager_v1, void* user_data) { + wl_proxy_set_user_data((struct wl_proxy*)zxdg_output_manager_v1, user_data); +} + +/** @ingroup iface_zxdg_output_manager_v1 */ +static inline void* zxdg_output_manager_v1_get_user_data( + struct zxdg_output_manager_v1* zxdg_output_manager_v1) { + return wl_proxy_get_user_data((struct wl_proxy*)zxdg_output_manager_v1); +} + +static inline uint32_t zxdg_output_manager_v1_get_version( + struct zxdg_output_manager_v1* zxdg_output_manager_v1) { + return wl_proxy_get_version((struct wl_proxy*)zxdg_output_manager_v1); +} + +/** + * @ingroup iface_zxdg_output_manager_v1 + * + * Using this request a client can tell the server that it is not + * going to use the xdg_output_manager object anymore. + * + * Any objects already created through this instance are not affected. + */ +static inline void zxdg_output_manager_v1_destroy( + struct zxdg_output_manager_v1* zxdg_output_manager_v1) { + wl_proxy_marshal((struct wl_proxy*)zxdg_output_manager_v1, + ZXDG_OUTPUT_MANAGER_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy*)zxdg_output_manager_v1); +} + +/** + * @ingroup iface_zxdg_output_manager_v1 + * + * This creates a new xdg_output object for the given wl_output. + */ +static inline struct zxdg_output_v1* zxdg_output_manager_v1_get_xdg_output( + struct zxdg_output_manager_v1* zxdg_output_manager_v1, + struct wl_output* output) { + struct wl_proxy* id; + + id = wl_proxy_marshal_constructor((struct wl_proxy*)zxdg_output_manager_v1, + ZXDG_OUTPUT_MANAGER_V1_GET_XDG_OUTPUT, + &zxdg_output_v1_interface, NULL, output); + + return (struct zxdg_output_v1*)id; +} + +/** + * @ingroup iface_zxdg_output_v1 + * @struct zxdg_output_v1_listener + */ +struct zxdg_output_v1_listener { + /** + * position of the output within the global compositor space + * + * The position event describes the location of the wl_output + * within the global compositor space. + * + * The logical_position event is sent after creating an xdg_output + * (see xdg_output_manager.get_xdg_output) and whenever the + * location of the output changes within the global compositor + * space. + * @param x x position within the global compositor space + * @param y y position within the global compositor space + */ + void (*logical_position)(void* data, struct zxdg_output_v1* zxdg_output_v1, + int32_t x, int32_t y); + /** + * size of the output in the global compositor space + * + * The logical_size event describes the size of the output in the + * global compositor space. + * + * For example, a surface without any buffer scale, transformation + * nor rotation set, with the size matching the logical_size will + * have the same size as the corresponding output when displayed. + * + * Most regular Wayland clients should not pay attention to the + * logical size and would rather rely on xdg_shell interfaces. + * + * Some clients such as Xwayland, however, need this to configure + * their surfaces in the global compositor space as the compositor + * may apply a different scale from what is advertised by the + * output scaling property (to achieve fractional scaling, for + * example). + * + * For example, for a wl_output mode 3840×2160 and a scale factor + * 2: + * + * - A compositor not scaling the surface buffers will advertise a + * logical size of 3840×2160, + * + * - A compositor automatically scaling the surface buffers will + * advertise a logical size of 1920×1080, + * + * - A compositor using a fractional scale of 1.5 will advertise a + * logical size to 2560×1620. + * + * For example, for a wl_output mode 1920×1080 and a 90 degree + * rotation, the compositor will advertise a logical size of + * 1080x1920. + * + * The logical_size event is sent after creating an xdg_output (see + * xdg_output_manager.get_xdg_output) and whenever the logical size + * of the output changes, either as a result of a change in the + * applied scale or because of a change in the corresponding output + * mode(see wl_output.mode) or transform (see wl_output.transform). + * @param width width in global compositor space + * @param height height in global compositor space + */ + void (*logical_size)(void* data, struct zxdg_output_v1* zxdg_output_v1, + int32_t width, int32_t height); + /** + * all information about the output have been sent + * + * This event is sent after all other properties of an xdg_output + * have been sent. + * + * This allows changes to the xdg_output properties to be seen as + * atomic, even if they happen via multiple events. + * + * For objects version 3 onwards, this event is deprecated. + * Compositors are not required to send it anymore and must send + * wl_output.done instead. + */ + void (*done)(void* data, struct zxdg_output_v1* zxdg_output_v1); + /** + * name of this output + * + * Many compositors will assign names to their outputs, show them + * to the user, allow them to be configured by name, etc. The + * client may wish to know this name as well to offer the user + * similar behaviors. + * + * The naming convention is compositor defined, but limited to + * alphanumeric characters and dashes (-). Each name is unique + * among all wl_output globals, but if a wl_output global is + * destroyed the same name may be reused later. The names will also + * remain consistent across sessions with the same hardware and + * software configuration. + * + * Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. + * However, do not assume that the name is a reflection of an + * underlying DRM connector, X11 connection, etc. + * + * The name event is sent after creating an xdg_output (see + * xdg_output_manager.get_xdg_output). This event is only sent once + * per xdg_output, and the name does not change over the lifetime + * of the wl_output global. + * @param name output name + * @since 2 + */ + void (*name)(void* data, struct zxdg_output_v1* zxdg_output_v1, + const char* name); + /** + * human-readable description of this output + * + * Many compositors can produce human-readable descriptions of + * their outputs. The client may wish to know this description as + * well, to communicate the user for various purposes. + * + * The description is a UTF-8 string with no convention defined for + * its contents. Examples might include 'Foocorp 11" Display' or + * 'Virtual X11 output via :1'. + * + * The description event is sent after creating an xdg_output (see + * xdg_output_manager.get_xdg_output) and whenever the description + * changes. The description is optional, and may not be sent at + * all. + * + * For objects of version 2 and lower, this event is only sent once + * per xdg_output, and the description does not change over the + * lifetime of the wl_output global. + * @param description output description + * @since 2 + */ + void (*description)(void* data, struct zxdg_output_v1* zxdg_output_v1, + const char* description); +}; + +/** + * @ingroup iface_zxdg_output_v1 + */ +static inline int zxdg_output_v1_add_listener( + struct zxdg_output_v1* zxdg_output_v1, + const struct zxdg_output_v1_listener* listener, void* data) { + return wl_proxy_add_listener((struct wl_proxy*)zxdg_output_v1, + (void (**)(void))listener, data); +} + +#define ZXDG_OUTPUT_V1_DESTROY 0 + +/** + * @ingroup iface_zxdg_output_v1 + */ +#define ZXDG_OUTPUT_V1_LOGICAL_POSITION_SINCE_VERSION 1 +/** + * @ingroup iface_zxdg_output_v1 + */ +#define ZXDG_OUTPUT_V1_LOGICAL_SIZE_SINCE_VERSION 1 +/** + * @ingroup iface_zxdg_output_v1 + */ +#define ZXDG_OUTPUT_V1_DONE_SINCE_VERSION 1 +/** + * @ingroup iface_zxdg_output_v1 + */ +#define ZXDG_OUTPUT_V1_NAME_SINCE_VERSION 2 +/** + * @ingroup iface_zxdg_output_v1 + */ +#define ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION 2 + +/** + * @ingroup iface_zxdg_output_v1 + */ +#define ZXDG_OUTPUT_V1_DESTROY_SINCE_VERSION 1 + +/** @ingroup iface_zxdg_output_v1 */ +static inline void zxdg_output_v1_set_user_data( + struct zxdg_output_v1* zxdg_output_v1, void* user_data) { + wl_proxy_set_user_data((struct wl_proxy*)zxdg_output_v1, user_data); +} + +/** @ingroup iface_zxdg_output_v1 */ +static inline void* zxdg_output_v1_get_user_data( + struct zxdg_output_v1* zxdg_output_v1) { + return wl_proxy_get_user_data((struct wl_proxy*)zxdg_output_v1); +} + +static inline uint32_t zxdg_output_v1_get_version( + struct zxdg_output_v1* zxdg_output_v1) { + return wl_proxy_get_version((struct wl_proxy*)zxdg_output_v1); +} + +/** + * @ingroup iface_zxdg_output_v1 + * + * Using this request a client can tell the server that it is not + * going to use the xdg_output object anymore. + */ +static inline void zxdg_output_v1_destroy( + struct zxdg_output_v1* zxdg_output_v1) { + wl_proxy_marshal((struct wl_proxy*)zxdg_output_v1, ZXDG_OUTPUT_V1_DESTROY); + + wl_proxy_destroy((struct wl_proxy*)zxdg_output_v1); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/widget/gtk/wayland/xdg-output-unstable-v1-protocol.c b/widget/gtk/wayland/xdg-output-unstable-v1-protocol.c new file mode 100644 index 0000000000..f80133f357 --- /dev/null +++ b/widget/gtk/wayland/xdg-output-unstable-v1-protocol.c @@ -0,0 +1,74 @@ +/* Generated by wayland-scanner 1.18.0 */ + +/* + * Copyright © 2017 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdlib.h> +#include <stdint.h> +#include <gdk/gdkwayland.h> +#include "wayland-util.h" + +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif + +#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) +# define WL_PRIVATE __attribute__((visibility("hidden"))) +#else +# define WL_PRIVATE +#endif + +extern const struct wl_interface wl_output_interface; +extern const struct wl_interface zxdg_output_v1_interface; + +static const struct wl_interface* xdg_output_unstable_v1_types[] = { + NULL, + NULL, + &zxdg_output_v1_interface, + &wl_output_interface, +}; + +static const struct wl_message zxdg_output_manager_v1_requests[] = { + {"destroy", "", xdg_output_unstable_v1_types + 0}, + {"get_xdg_output", "no", xdg_output_unstable_v1_types + 2}, +}; + +WL_PRIVATE const struct wl_interface zxdg_output_manager_v1_interface = { + "zxdg_output_manager_v1", 3, 2, zxdg_output_manager_v1_requests, 0, NULL, +}; + +static const struct wl_message zxdg_output_v1_requests[] = { + {"destroy", "", xdg_output_unstable_v1_types + 0}, +}; + +static const struct wl_message zxdg_output_v1_events[] = { + {"logical_position", "ii", xdg_output_unstable_v1_types + 0}, + {"logical_size", "ii", xdg_output_unstable_v1_types + 0}, + {"done", "", xdg_output_unstable_v1_types + 0}, + {"name", "2s", xdg_output_unstable_v1_types + 0}, + {"description", "2s", xdg_output_unstable_v1_types + 0}, +}; + +WL_PRIVATE const struct wl_interface zxdg_output_v1_interface = { + "zxdg_output_v1", 3, 1, zxdg_output_v1_requests, 5, zxdg_output_v1_events, +}; |