You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add Wayland support
Not everything is yet implemented, either for Godot or personal limitations (I don't have all hardware in the world). A brief list of the most important issues follows: - Single-window only: the `DisplayServer` API doesn't expose enough information for properly creating XDG shell windows. - Very dumb rendering loop: this is very complicated, just know that the low consumption mode is forced to 2000 Hz and some clever hacks are in place to overcome a specific Wayland limitation. This will be improved to the extent possible both downstream and upstream. - Features to implement yet: IME, touch input, native file dialog, drawing tablet (commented out due to a refactor), screen recording. - Mouse passthrough can't be implement through a poly API, we need a rect-based one. - The cursor doesn't yet support fractional scaling. - Auto scale is rounded up when using fractional scaling as we don't have a per-window scale query API (basically we need `DisplayServer::window_get_scale`). - Building with `x11=no wayland=yes opengl=yes openxr=yes` fails. This also adds a new project property and editor setting for selecting the default DisplayServer to start, to allow this backend to start first in exported projects (X11 is still the default for now). The editor setting always overrides the project setting. Special thanks to Drew Devault, toger5, Sebastian Krzyszkowiak, Leandro Benedet Garcia, Subhransu, Yury Zhuravlev and Mara Huldra.
This commit is contained in:
14
thirdparty/linuxbsd_headers/README.md
vendored
14
thirdparty/linuxbsd_headers/README.md
vendored
@@ -28,6 +28,13 @@ Patches in the `patches` directory should be re-applied after updates.
|
||||
- License: fontconfig
|
||||
|
||||
|
||||
## libdecor
|
||||
|
||||
- Upstream: https://gitlab.freedesktop.org/libdecor/libdecor/
|
||||
- Version: 0.1.1
|
||||
- License: MIT
|
||||
|
||||
|
||||
## pulse
|
||||
|
||||
- Upstream: http://pulseaudio.org/
|
||||
@@ -49,6 +56,13 @@ Patches in the `patches` directory should be re-applied after updates.
|
||||
- License: LGPL-2.1+
|
||||
|
||||
|
||||
## wayland
|
||||
|
||||
- Upstream: https://gitlab.freedesktop.org/wayland/wayland
|
||||
- Version: 1.21.0 (8135e856ebd79872f886466e9cee39affb7d9ee8, 2022)
|
||||
- License: MIT
|
||||
|
||||
|
||||
## X11
|
||||
|
||||
- Upstream: https://x.org/wiki/
|
||||
|
||||
521
thirdparty/linuxbsd_headers/libdecor-0/libdecor.h
vendored
Normal file
521
thirdparty/linuxbsd_headers/libdecor-0/libdecor.h
vendored
Normal file
@@ -0,0 +1,521 @@
|
||||
/*
|
||||
* Copyright © 2017-2018 Red Hat Inc.
|
||||
* Copyright © 2018 Jonas Ådahl
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBDECOR_H
|
||||
#define LIBDECOR_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define LIBDECOR_EXPORT __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define LIBDECOR_EXPORT
|
||||
#endif
|
||||
|
||||
struct xdg_toplevel;
|
||||
|
||||
/** \class libdecor
|
||||
*
|
||||
* \brief A libdecor context instance.
|
||||
*/
|
||||
struct libdecor;
|
||||
|
||||
/** \class libdecor_frame
|
||||
*
|
||||
* \brief A frame used for decorating a Wayland surface.
|
||||
*/
|
||||
struct libdecor_frame;
|
||||
|
||||
/** \class libdecor_configuration
|
||||
*
|
||||
* \brief An object representing a toplevel window configuration.
|
||||
*/
|
||||
struct libdecor_configuration;
|
||||
|
||||
/** \class libdecor_state
|
||||
*
|
||||
* \brief An object corresponding to a configured content state.
|
||||
*/
|
||||
struct libdecor_state;
|
||||
|
||||
enum libdecor_error {
|
||||
LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE,
|
||||
LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION,
|
||||
};
|
||||
|
||||
enum libdecor_window_state {
|
||||
LIBDECOR_WINDOW_STATE_NONE = 0,
|
||||
LIBDECOR_WINDOW_STATE_ACTIVE = 1 << 0,
|
||||
LIBDECOR_WINDOW_STATE_MAXIMIZED = 1 << 1,
|
||||
LIBDECOR_WINDOW_STATE_FULLSCREEN = 1 << 2,
|
||||
LIBDECOR_WINDOW_STATE_TILED_LEFT = 1 << 3,
|
||||
LIBDECOR_WINDOW_STATE_TILED_RIGHT = 1 << 4,
|
||||
LIBDECOR_WINDOW_STATE_TILED_TOP = 1 << 5,
|
||||
LIBDECOR_WINDOW_STATE_TILED_BOTTOM = 1 << 6,
|
||||
};
|
||||
|
||||
enum libdecor_resize_edge {
|
||||
LIBDECOR_RESIZE_EDGE_NONE,
|
||||
LIBDECOR_RESIZE_EDGE_TOP,
|
||||
LIBDECOR_RESIZE_EDGE_BOTTOM,
|
||||
LIBDECOR_RESIZE_EDGE_LEFT,
|
||||
LIBDECOR_RESIZE_EDGE_TOP_LEFT,
|
||||
LIBDECOR_RESIZE_EDGE_BOTTOM_LEFT,
|
||||
LIBDECOR_RESIZE_EDGE_RIGHT,
|
||||
LIBDECOR_RESIZE_EDGE_TOP_RIGHT,
|
||||
LIBDECOR_RESIZE_EDGE_BOTTOM_RIGHT,
|
||||
};
|
||||
|
||||
enum libdecor_capabilities {
|
||||
LIBDECOR_ACTION_MOVE = 1 << 0,
|
||||
LIBDECOR_ACTION_RESIZE = 1 << 1,
|
||||
LIBDECOR_ACTION_MINIMIZE = 1 << 2,
|
||||
LIBDECOR_ACTION_FULLSCREEN = 1 << 3,
|
||||
LIBDECOR_ACTION_CLOSE = 1 << 4,
|
||||
};
|
||||
|
||||
struct libdecor_interface {
|
||||
/**
|
||||
* An error event
|
||||
*/
|
||||
void (* error)(struct libdecor *context,
|
||||
enum libdecor_error error,
|
||||
const char *message);
|
||||
|
||||
/* Reserved */
|
||||
void (* reserved0)(void);
|
||||
void (* reserved1)(void);
|
||||
void (* reserved2)(void);
|
||||
void (* reserved3)(void);
|
||||
void (* reserved4)(void);
|
||||
void (* reserved5)(void);
|
||||
void (* reserved6)(void);
|
||||
void (* reserved7)(void);
|
||||
void (* reserved8)(void);
|
||||
void (* reserved9)(void);
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for integrating a Wayland surface with libdecor.
|
||||
*/
|
||||
struct libdecor_frame_interface {
|
||||
/**
|
||||
* A new configuration was received. An application should respond to
|
||||
* this by creating a suitable libdecor_state, and apply it using
|
||||
* libdecor_frame_commit.
|
||||
*/
|
||||
void (* configure)(struct libdecor_frame *frame,
|
||||
struct libdecor_configuration *configuration,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* The window was requested to be closed by the compositor.
|
||||
*/
|
||||
void (* close)(struct libdecor_frame *frame,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* The window decoration asked to have the main surface to be
|
||||
* committed. This is required when the decoration is implemented using
|
||||
* synchronous subsurfaces.
|
||||
*/
|
||||
void (* commit)(struct libdecor_frame *frame,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Any mapped popup that has a grab on the given seat should be
|
||||
* dismissed.
|
||||
*/
|
||||
void (* dismiss_popup)(struct libdecor_frame *frame,
|
||||
const char *seat_name,
|
||||
void *user_data);
|
||||
|
||||
/* Reserved */
|
||||
void (* reserved0)(void);
|
||||
void (* reserved1)(void);
|
||||
void (* reserved2)(void);
|
||||
void (* reserved3)(void);
|
||||
void (* reserved4)(void);
|
||||
void (* reserved5)(void);
|
||||
void (* reserved6)(void);
|
||||
void (* reserved7)(void);
|
||||
void (* reserved8)(void);
|
||||
void (* reserved9)(void);
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove a reference to the libdecor instance. When the reference count
|
||||
* reaches zero, it is freed.
|
||||
*/
|
||||
void
|
||||
libdecor_unref(struct libdecor *context);
|
||||
|
||||
/**
|
||||
* Create a new libdecor context for the given wl_display.
|
||||
*/
|
||||
struct libdecor *
|
||||
libdecor_new(struct wl_display *display,
|
||||
struct libdecor_interface *iface);
|
||||
|
||||
/**
|
||||
* Get the file descriptor used by libdecor. This is similar to
|
||||
* wl_display_get_fd(), thus should be polled, and when data is available,
|
||||
* libdecor_dispatch() should be called.
|
||||
*/
|
||||
int
|
||||
libdecor_get_fd(struct libdecor *context);
|
||||
|
||||
/**
|
||||
* Dispatch events. This function should be called when data is available on
|
||||
* the file descriptor returned by libdecor_get_fd(). If timeout is zero, this
|
||||
* function will never block.
|
||||
*/
|
||||
int
|
||||
libdecor_dispatch(struct libdecor *context,
|
||||
int timeout);
|
||||
|
||||
/**
|
||||
* Decorate the given content wl_surface.
|
||||
*
|
||||
* This will create an xdg_surface and an xdg_toplevel, and integrate it
|
||||
* properly with the windowing system, including creating appropriate
|
||||
* decorations when needed, as well as handle windowing integration events such
|
||||
* as resizing, moving, maximizing, etc.
|
||||
*
|
||||
* The passed wl_surface should only contain actual application content,
|
||||
* without any window decoration.
|
||||
*/
|
||||
struct libdecor_frame *
|
||||
libdecor_decorate(struct libdecor *context,
|
||||
struct wl_surface *surface,
|
||||
struct libdecor_frame_interface *iface,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Add a reference to the frame object.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_ref(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Remove a reference to the frame object. When the reference count reaches
|
||||
* zero, the frame object is destroyed.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_unref(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Set the visibility of the frame.
|
||||
*
|
||||
* If an application wants to be borderless, it can set the frame visibility to
|
||||
* false.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_visibility(struct libdecor_frame *frame,
|
||||
bool visible);
|
||||
|
||||
/**
|
||||
* Get the visibility of the frame.
|
||||
*/
|
||||
bool
|
||||
libdecor_frame_is_visible(struct libdecor_frame *frame);
|
||||
|
||||
|
||||
/**
|
||||
* Set the parent of the window.
|
||||
*
|
||||
* This can be used to stack multiple toplevel windows above or under each
|
||||
* other.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_parent(struct libdecor_frame *frame,
|
||||
struct libdecor_frame *parent);
|
||||
|
||||
/**
|
||||
* Set the title of the window.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_title(struct libdecor_frame *frame,
|
||||
const char *title);
|
||||
|
||||
/**
|
||||
* Get the title of the window.
|
||||
*/
|
||||
const char *
|
||||
libdecor_frame_get_title(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Set the application ID of the window.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_app_id(struct libdecor_frame *frame,
|
||||
const char *app_id);
|
||||
|
||||
/**
|
||||
* Set new capabilities of the window.
|
||||
*
|
||||
* This determines whether e.g. a window decoration should show a maximize
|
||||
* button, etc.
|
||||
*
|
||||
* Setting a capability does not implicitly unset any other.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_capabilities(struct libdecor_frame *frame,
|
||||
enum libdecor_capabilities capabilities);
|
||||
|
||||
/**
|
||||
* Unset capabilities of the window.
|
||||
*
|
||||
* The opposite of libdecor_frame_set_capabilities.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_unset_capabilities(struct libdecor_frame *frame,
|
||||
enum libdecor_capabilities capabilities);
|
||||
|
||||
/**
|
||||
* Check whether the window has any of the given capabilities.
|
||||
*/
|
||||
bool
|
||||
libdecor_frame_has_capability(struct libdecor_frame *frame,
|
||||
enum libdecor_capabilities capability);
|
||||
|
||||
/**
|
||||
* Show the window menu.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_show_window_menu(struct libdecor_frame *frame,
|
||||
struct wl_seat *wl_seat,
|
||||
uint32_t serial,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
/**
|
||||
* Issue a popup grab on the window. Call this when a xdg_popup is mapped, so
|
||||
* that it can be properly dismissed by the decorations.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_popup_grab(struct libdecor_frame *frame,
|
||||
const char *seat_name);
|
||||
|
||||
/**
|
||||
* Release the popup grab. Call this when you unmap a popup.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_popup_ungrab(struct libdecor_frame *frame,
|
||||
const char *seat_name);
|
||||
|
||||
/**
|
||||
* Translate content surface local coordinates to toplevel window local
|
||||
* coordinates.
|
||||
*
|
||||
* This can be used to translate surface coordinates to coordinates useful for
|
||||
* e.g. showing the window menu, or positioning a popup.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_translate_coordinate(struct libdecor_frame *frame,
|
||||
int surface_x,
|
||||
int surface_y,
|
||||
int *frame_x,
|
||||
int *frame_y);
|
||||
|
||||
/**
|
||||
* Set the min content size.
|
||||
*
|
||||
* This translates roughly to xdg_toplevel_set_min_size().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_min_content_size(struct libdecor_frame *frame,
|
||||
int content_width,
|
||||
int content_height);
|
||||
|
||||
/**
|
||||
* Set the max content size.
|
||||
*
|
||||
* This translates roughly to xdg_toplevel_set_max_size().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_max_content_size(struct libdecor_frame *frame,
|
||||
int content_width,
|
||||
int content_height);
|
||||
|
||||
/**
|
||||
* Initiate an interactive resize.
|
||||
*
|
||||
* This roughly translates to xdg_toplevel_resize().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_resize(struct libdecor_frame *frame,
|
||||
struct wl_seat *wl_seat,
|
||||
uint32_t serial,
|
||||
enum libdecor_resize_edge edge);
|
||||
|
||||
/**
|
||||
* Initiate an interactive move.
|
||||
*
|
||||
* This roughly translates to xdg_toplevel_move().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_move(struct libdecor_frame *frame,
|
||||
struct wl_seat *wl_seat,
|
||||
uint32_t serial);
|
||||
|
||||
/**
|
||||
* Commit a new window state. This can be called on application driven resizes
|
||||
* when the window is floating, or in response to received configurations, i.e.
|
||||
* from e.g. interactive resizes or state changes.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_commit(struct libdecor_frame *frame,
|
||||
struct libdecor_state *state,
|
||||
struct libdecor_configuration *configuration);
|
||||
|
||||
/**
|
||||
* Minimize the window.
|
||||
*
|
||||
* Roughly translates to xdg_toplevel_set_minimized().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_minimized(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Maximize the window.
|
||||
*
|
||||
* Roughly translates to xdg_toplevel_set_maximized().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_maximized(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Unmaximize the window.
|
||||
*
|
||||
* Roughly translates to xdg_toplevel_unset_maximized().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_unset_maximized(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Fullscreen the window.
|
||||
*
|
||||
* Roughly translates to xdg_toplevel_set_fullscreen().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_set_fullscreen(struct libdecor_frame *frame,
|
||||
struct wl_output *output);
|
||||
|
||||
/**
|
||||
* Unfullscreen the window.
|
||||
*
|
||||
* Roughly translates to xdg_toplevel_unset_unfullscreen().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_unset_fullscreen(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Return true if the window is floating.
|
||||
*
|
||||
* A window is floating when it's not maximized, tiled, fullscreen, or in any
|
||||
* similar way with a fixed size and state.
|
||||
* Note that this function uses the "applied" configuration. If this function
|
||||
* is used in the 'configure' callback, the provided configuration has to be
|
||||
* applied via 'libdecor_frame_commit' first, before it will reflect the current
|
||||
* window state from the provided configuration.
|
||||
*/
|
||||
bool
|
||||
libdecor_frame_is_floating(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Close the window.
|
||||
*
|
||||
* Roughly translates to xdg_toplevel_close().
|
||||
*/
|
||||
void
|
||||
libdecor_frame_close(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Map the window.
|
||||
*
|
||||
* This will eventually result in the initial configure event.
|
||||
*/
|
||||
void
|
||||
libdecor_frame_map(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Get the associated xdg_surface for content wl_surface.
|
||||
*/
|
||||
struct xdg_surface *
|
||||
libdecor_frame_get_xdg_surface(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Get the associated xdg_toplevel for the content wl_surface.
|
||||
*/
|
||||
struct xdg_toplevel *
|
||||
libdecor_frame_get_xdg_toplevel(struct libdecor_frame *frame);
|
||||
|
||||
/**
|
||||
* Create a new content surface state.
|
||||
*/
|
||||
struct libdecor_state *
|
||||
libdecor_state_new(int width,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* Free a content surface state.
|
||||
*/
|
||||
void
|
||||
libdecor_state_free(struct libdecor_state *state);
|
||||
|
||||
/**
|
||||
* Get the expected size of the content for this configuration.
|
||||
*
|
||||
* If the configuration doesn't contain a size, false is returned.
|
||||
*/
|
||||
bool
|
||||
libdecor_configuration_get_content_size(struct libdecor_configuration *configuration,
|
||||
struct libdecor_frame *frame,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
/**
|
||||
* Get the window state for this configuration.
|
||||
*
|
||||
* If the configuration doesn't contain any associated window state, false is
|
||||
* returned, and the application should assume the window state remains
|
||||
* unchanged.
|
||||
*/
|
||||
bool
|
||||
libdecor_configuration_get_window_state(struct libdecor_configuration *configuration,
|
||||
enum libdecor_window_state *window_state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBDECOR_H */
|
||||
292
thirdparty/linuxbsd_headers/wayland/wayland-client-core.h
vendored
Normal file
292
thirdparty/linuxbsd_headers/wayland/wayland-client-core.h
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Copyright © 2008 Kristian Høgsberg
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WAYLAND_CLIENT_CORE_H
|
||||
#define WAYLAND_CLIENT_CORE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
#include "wayland-version.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \class wl_proxy
|
||||
*
|
||||
* \brief Represents a protocol object on the client side.
|
||||
*
|
||||
* A wl_proxy acts as a client side proxy to an object existing in the
|
||||
* compositor. The proxy is responsible for converting requests made by the
|
||||
* clients with \ref wl_proxy_marshal() into Wayland's wire format. Events
|
||||
* coming from the compositor are also handled by the proxy, which will in
|
||||
* turn call the handler set with \ref wl_proxy_add_listener().
|
||||
*
|
||||
* \note With the exception of function \ref wl_proxy_set_queue(), functions
|
||||
* accessing a wl_proxy are not normally used by client code. Clients
|
||||
* should normally use the higher level interface generated by the scanner to
|
||||
* interact with compositor objects.
|
||||
*
|
||||
*/
|
||||
struct wl_proxy;
|
||||
|
||||
/** \class wl_display
|
||||
*
|
||||
* \brief Represents a connection to the compositor and acts as a proxy to
|
||||
* the wl_display singleton object.
|
||||
*
|
||||
* A wl_display object represents a client connection to a Wayland
|
||||
* compositor. It is created with either \ref wl_display_connect() or
|
||||
* \ref wl_display_connect_to_fd(). A connection is terminated using
|
||||
* \ref wl_display_disconnect().
|
||||
*
|
||||
* A wl_display is also used as the \ref wl_proxy for the wl_display
|
||||
* singleton object on the compositor side.
|
||||
*
|
||||
* A wl_display object handles all the data sent from and to the
|
||||
* compositor. When a \ref wl_proxy marshals a request, it will write its wire
|
||||
* representation to the display's write buffer. The data is sent to the
|
||||
* compositor when the client calls \ref wl_display_flush().
|
||||
*
|
||||
* Incoming data is handled in two steps: queueing and dispatching. In the
|
||||
* queue step, the data coming from the display fd is interpreted and
|
||||
* added to a queue. On the dispatch step, the handler for the incoming
|
||||
* event set by the client on the corresponding \ref wl_proxy is called.
|
||||
*
|
||||
* A wl_display has at least one event queue, called the <em>default
|
||||
* queue</em>. Clients can create additional event queues with \ref
|
||||
* wl_display_create_queue() and assign \ref wl_proxy's to it. Events
|
||||
* occurring in a particular proxy are always queued in its assigned queue.
|
||||
* A client can ensure that a certain assumption, such as holding a lock
|
||||
* or running from a given thread, is true when a proxy event handler is
|
||||
* called by assigning that proxy to an event queue and making sure that
|
||||
* this queue is only dispatched when the assumption holds.
|
||||
*
|
||||
* The default queue is dispatched by calling \ref wl_display_dispatch().
|
||||
* This will dispatch any events queued on the default queue and attempt
|
||||
* to read from the display fd if it's empty. Events read are then queued
|
||||
* on the appropriate queues according to the proxy assignment.
|
||||
*
|
||||
* A user created queue is dispatched with \ref wl_display_dispatch_queue().
|
||||
* This function behaves exactly the same as wl_display_dispatch()
|
||||
* but it dispatches given queue instead of the default queue.
|
||||
*
|
||||
* A real world example of event queue usage is Mesa's implementation of
|
||||
* eglSwapBuffers() for the Wayland platform. This function might need
|
||||
* to block until a frame callback is received, but dispatching the default
|
||||
* queue could cause an event handler on the client to start drawing
|
||||
* again. This problem is solved using another event queue, so that only
|
||||
* the events handled by the EGL code are dispatched during the block.
|
||||
*
|
||||
* This creates a problem where a thread dispatches a non-default
|
||||
* queue, reading all the data from the display fd. If the application
|
||||
* would call \em poll(2) after that it would block, even though there
|
||||
* might be events queued on the default queue. Those events should be
|
||||
* dispatched with \ref wl_display_dispatch_pending() or \ref
|
||||
* wl_display_dispatch_queue_pending() before flushing and blocking.
|
||||
*/
|
||||
struct wl_display;
|
||||
|
||||
/** \class wl_event_queue
|
||||
*
|
||||
* \brief A queue for \ref wl_proxy object events.
|
||||
*
|
||||
* Event queues allows the events on a display to be handled in a thread-safe
|
||||
* manner. See \ref wl_display for details.
|
||||
*
|
||||
*/
|
||||
struct wl_event_queue;
|
||||
|
||||
/** Destroy proxy after marshalling
|
||||
* @ingroup wl_proxy
|
||||
*/
|
||||
#define WL_MARSHAL_FLAG_DESTROY (1 << 0)
|
||||
|
||||
void
|
||||
wl_event_queue_destroy(struct wl_event_queue *queue);
|
||||
|
||||
struct wl_proxy *
|
||||
wl_proxy_marshal_flags(struct wl_proxy *proxy, uint32_t opcode,
|
||||
const struct wl_interface *interface,
|
||||
uint32_t version,
|
||||
uint32_t flags, ...);
|
||||
|
||||
struct wl_proxy *
|
||||
wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
|
||||
const struct wl_interface *interface,
|
||||
uint32_t version,
|
||||
uint32_t flags,
|
||||
union wl_argument *args);
|
||||
|
||||
void
|
||||
wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
|
||||
|
||||
void
|
||||
wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode,
|
||||
union wl_argument *args);
|
||||
|
||||
struct wl_proxy *
|
||||
wl_proxy_create(struct wl_proxy *factory,
|
||||
const struct wl_interface *interface);
|
||||
|
||||
void *
|
||||
wl_proxy_create_wrapper(void *proxy);
|
||||
|
||||
void
|
||||
wl_proxy_wrapper_destroy(void *proxy_wrapper);
|
||||
|
||||
struct wl_proxy *
|
||||
wl_proxy_marshal_constructor(struct wl_proxy *proxy,
|
||||
uint32_t opcode,
|
||||
const struct wl_interface *interface,
|
||||
...);
|
||||
|
||||
struct wl_proxy *
|
||||
wl_proxy_marshal_constructor_versioned(struct wl_proxy *proxy,
|
||||
uint32_t opcode,
|
||||
const struct wl_interface *interface,
|
||||
uint32_t version,
|
||||
...);
|
||||
|
||||
struct wl_proxy *
|
||||
wl_proxy_marshal_array_constructor(struct wl_proxy *proxy,
|
||||
uint32_t opcode, union wl_argument *args,
|
||||
const struct wl_interface *interface);
|
||||
|
||||
struct wl_proxy *
|
||||
wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *proxy,
|
||||
uint32_t opcode,
|
||||
union wl_argument *args,
|
||||
const struct wl_interface *interface,
|
||||
uint32_t version);
|
||||
|
||||
void
|
||||
wl_proxy_destroy(struct wl_proxy *proxy);
|
||||
|
||||
int
|
||||
wl_proxy_add_listener(struct wl_proxy *proxy,
|
||||
void (**implementation)(void), void *data);
|
||||
|
||||
const void *
|
||||
wl_proxy_get_listener(struct wl_proxy *proxy);
|
||||
|
||||
int
|
||||
wl_proxy_add_dispatcher(struct wl_proxy *proxy,
|
||||
wl_dispatcher_func_t dispatcher_func,
|
||||
const void * dispatcher_data, void *data);
|
||||
|
||||
void
|
||||
wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
|
||||
|
||||
void *
|
||||
wl_proxy_get_user_data(struct wl_proxy *proxy);
|
||||
|
||||
uint32_t
|
||||
wl_proxy_get_version(struct wl_proxy *proxy);
|
||||
|
||||
uint32_t
|
||||
wl_proxy_get_id(struct wl_proxy *proxy);
|
||||
|
||||
void
|
||||
wl_proxy_set_tag(struct wl_proxy *proxy,
|
||||
const char * const *tag);
|
||||
|
||||
const char * const *
|
||||
wl_proxy_get_tag(struct wl_proxy *proxy);
|
||||
|
||||
const char *
|
||||
wl_proxy_get_class(struct wl_proxy *proxy);
|
||||
|
||||
void
|
||||
wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue);
|
||||
|
||||
struct wl_display *
|
||||
wl_display_connect(const char *name);
|
||||
|
||||
struct wl_display *
|
||||
wl_display_connect_to_fd(int fd);
|
||||
|
||||
void
|
||||
wl_display_disconnect(struct wl_display *display);
|
||||
|
||||
int
|
||||
wl_display_get_fd(struct wl_display *display);
|
||||
|
||||
int
|
||||
wl_display_dispatch(struct wl_display *display);
|
||||
|
||||
int
|
||||
wl_display_dispatch_queue(struct wl_display *display,
|
||||
struct wl_event_queue *queue);
|
||||
|
||||
int
|
||||
wl_display_dispatch_queue_pending(struct wl_display *display,
|
||||
struct wl_event_queue *queue);
|
||||
|
||||
int
|
||||
wl_display_dispatch_pending(struct wl_display *display);
|
||||
|
||||
int
|
||||
wl_display_get_error(struct wl_display *display);
|
||||
|
||||
uint32_t
|
||||
wl_display_get_protocol_error(struct wl_display *display,
|
||||
const struct wl_interface **interface,
|
||||
uint32_t *id);
|
||||
|
||||
int
|
||||
wl_display_flush(struct wl_display *display);
|
||||
|
||||
int
|
||||
wl_display_roundtrip_queue(struct wl_display *display,
|
||||
struct wl_event_queue *queue);
|
||||
|
||||
int
|
||||
wl_display_roundtrip(struct wl_display *display);
|
||||
|
||||
struct wl_event_queue *
|
||||
wl_display_create_queue(struct wl_display *display);
|
||||
|
||||
int
|
||||
wl_display_prepare_read_queue(struct wl_display *display,
|
||||
struct wl_event_queue *queue);
|
||||
|
||||
int
|
||||
wl_display_prepare_read(struct wl_display *display);
|
||||
|
||||
void
|
||||
wl_display_cancel_read(struct wl_display *display);
|
||||
|
||||
int
|
||||
wl_display_read_events(struct wl_display *display);
|
||||
|
||||
void
|
||||
wl_log_set_handler_client(wl_log_func_t handler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
6106
thirdparty/linuxbsd_headers/wayland/wayland-client-protocol.h
vendored
Normal file
6106
thirdparty/linuxbsd_headers/wayland/wayland-client-protocol.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
42
thirdparty/linuxbsd_headers/wayland/wayland-client.h
vendored
Normal file
42
thirdparty/linuxbsd_headers/wayland/wayland-client.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright © 2008 Kristian Høgsberg
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* \brief Include the client API and protocol C API.
|
||||
*
|
||||
* \warning Use of this header file is discouraged. Prefer including
|
||||
* wayland-client-core.h instead, which does not include the
|
||||
* client protocol header and as such only defines the library
|
||||
* API.
|
||||
*/
|
||||
|
||||
#ifndef WAYLAND_CLIENT_H
|
||||
#define WAYLAND_CLIENT_H
|
||||
|
||||
#include "wayland-client-core.h"
|
||||
#include "wayland-client-protocol.h"
|
||||
|
||||
#endif
|
||||
96
thirdparty/linuxbsd_headers/wayland/wayland-cursor.h
vendored
Normal file
96
thirdparty/linuxbsd_headers/wayland/wayland-cursor.h
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright © 2012 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.
|
||||
*/
|
||||
|
||||
#ifndef WAYLAND_CURSOR_H
|
||||
#define WAYLAND_CURSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct wl_cursor_theme;
|
||||
struct wl_buffer;
|
||||
struct wl_shm;
|
||||
|
||||
/** A still image part of a cursor
|
||||
*
|
||||
* Use `wl_cursor_image_get_buffer()` to get the corresponding `struct
|
||||
* wl_buffer` to attach to your `struct wl_surface`. */
|
||||
struct wl_cursor_image {
|
||||
/** Actual width */
|
||||
uint32_t width;
|
||||
|
||||
/** Actual height */
|
||||
uint32_t height;
|
||||
|
||||
/** Hot spot x (must be inside image) */
|
||||
uint32_t hotspot_x;
|
||||
|
||||
/** Hot spot y (must be inside image) */
|
||||
uint32_t hotspot_y;
|
||||
|
||||
/** Animation delay to next frame (ms) */
|
||||
uint32_t delay;
|
||||
};
|
||||
|
||||
/** A cursor, as returned by `wl_cursor_theme_get_cursor()` */
|
||||
struct wl_cursor {
|
||||
/** How many images there are in this cursor’s animation */
|
||||
unsigned int image_count;
|
||||
|
||||
/** The array of still images composing this animation */
|
||||
struct wl_cursor_image **images;
|
||||
|
||||
/** The name of this cursor */
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct wl_cursor_theme *
|
||||
wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm);
|
||||
|
||||
void
|
||||
wl_cursor_theme_destroy(struct wl_cursor_theme *theme);
|
||||
|
||||
struct wl_cursor *
|
||||
wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
|
||||
const char *name);
|
||||
|
||||
struct wl_buffer *
|
||||
wl_cursor_image_get_buffer(struct wl_cursor_image *image);
|
||||
|
||||
int
|
||||
wl_cursor_frame(struct wl_cursor *cursor, uint32_t time);
|
||||
|
||||
int
|
||||
wl_cursor_frame_and_duration(struct wl_cursor *cursor, uint32_t time,
|
||||
uint32_t *duration);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
59
thirdparty/linuxbsd_headers/wayland/wayland-egl-core.h
vendored
Normal file
59
thirdparty/linuxbsd_headers/wayland/wayland-egl-core.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright © 2011 Kristian Høgsberg
|
||||
* Copyright © 2011 Benjamin Franzke
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WAYLAND_EGL_CORE_H
|
||||
#define WAYLAND_EGL_CORE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WL_EGL_PLATFORM 1
|
||||
|
||||
struct wl_egl_window;
|
||||
struct wl_surface;
|
||||
|
||||
struct wl_egl_window *
|
||||
wl_egl_window_create(struct wl_surface *surface,
|
||||
int width, int height);
|
||||
|
||||
void
|
||||
wl_egl_window_destroy(struct wl_egl_window *egl_window);
|
||||
|
||||
void
|
||||
wl_egl_window_resize(struct wl_egl_window *egl_window,
|
||||
int width, int height,
|
||||
int dx, int dy);
|
||||
|
||||
void
|
||||
wl_egl_window_get_attached_size(struct wl_egl_window *egl_window,
|
||||
int *width, int *height);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
765
thirdparty/linuxbsd_headers/wayland/wayland-util.h
vendored
Normal file
765
thirdparty/linuxbsd_headers/wayland/wayland-util.h
vendored
Normal file
@@ -0,0 +1,765 @@
|
||||
/*
|
||||
* Copyright © 2008 Kristian Høgsberg
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** \file wayland-util.h
|
||||
*
|
||||
* \brief Utility classes, functions, and macros.
|
||||
*/
|
||||
|
||||
#ifndef WAYLAND_UTIL_H
|
||||
#define WAYLAND_UTIL_H
|
||||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Visibility attribute */
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define WL_EXPORT __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define WL_EXPORT
|
||||
#endif
|
||||
|
||||
/** Deprecated attribute */
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define WL_DEPRECATED __attribute__ ((deprecated))
|
||||
#else
|
||||
#define WL_DEPRECATED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Printf-style argument attribute
|
||||
*
|
||||
* \param x Ordinality of the format string argument
|
||||
* \param y Ordinality of the argument to check against the format string
|
||||
*
|
||||
* \sa https://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/Function-Attributes.html
|
||||
*/
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define WL_PRINTF(x, y) __attribute__((__format__(__printf__, x, y)))
|
||||
#else
|
||||
#define WL_PRINTF(x, y)
|
||||
#endif
|
||||
|
||||
/** \class wl_object
|
||||
*
|
||||
* \brief A protocol object.
|
||||
*
|
||||
* A `wl_object` is an opaque struct identifying the protocol object
|
||||
* underlying a `wl_proxy` or `wl_resource`.
|
||||
*
|
||||
* \note Functions accessing a `wl_object` are not normally used by client code.
|
||||
* Clients should normally use the higher level interface generated by the
|
||||
* scanner to interact with compositor objects.
|
||||
*
|
||||
*/
|
||||
struct wl_object;
|
||||
|
||||
/**
|
||||
* Protocol message signature
|
||||
*
|
||||
* A wl_message describes the signature of an actual protocol message, such as a
|
||||
* request or event, that adheres to the Wayland protocol wire format. The
|
||||
* protocol implementation uses a wl_message within its demarshal machinery for
|
||||
* decoding messages between a compositor and its clients. In a sense, a
|
||||
* wl_message is to a protocol message like a class is to an object.
|
||||
*
|
||||
* The `name` of a wl_message is the name of the corresponding protocol message.
|
||||
*
|
||||
* The `signature` is an ordered list of symbols representing the data types
|
||||
* of message arguments and, optionally, a protocol version and indicators for
|
||||
* nullability. A leading integer in the `signature` indicates the _since_
|
||||
* version of the protocol message. A `?` preceding a data type symbol indicates
|
||||
* that the following argument type is nullable. While it is a protocol violation
|
||||
* to send messages with non-nullable arguments set to `NULL`, event handlers in
|
||||
* clients might still get called with non-nullable object arguments set to
|
||||
* `NULL`. This can happen when the client destroyed the object being used as
|
||||
* argument on its side and an event referencing that object was sent before the
|
||||
* server knew about its destruction. As this race cannot be prevented, clients
|
||||
* should - as a general rule - program their event handlers such that they can
|
||||
* handle object arguments declared non-nullable being `NULL` gracefully.
|
||||
*
|
||||
* When no arguments accompany a message, `signature` is an empty string.
|
||||
*
|
||||
* Symbols:
|
||||
*
|
||||
* * `i`: int
|
||||
* * `u`: uint
|
||||
* * `f`: fixed
|
||||
* * `s`: string
|
||||
* * `o`: object
|
||||
* * `n`: new_id
|
||||
* * `a`: array
|
||||
* * `h`: fd
|
||||
* * `?`: following argument is nullable
|
||||
*
|
||||
* While demarshaling primitive arguments is straightforward, when demarshaling
|
||||
* messages containing `object` or `new_id` arguments, the protocol
|
||||
* implementation often must determine the type of the object. The `types` of a
|
||||
* wl_message is an array of wl_interface references that correspond to `o` and
|
||||
* `n` arguments in `signature`, with `NULL` placeholders for arguments with
|
||||
* non-object types.
|
||||
*
|
||||
* Consider the protocol event wl_display `delete_id` that has a single `uint`
|
||||
* argument. The wl_message is:
|
||||
*
|
||||
* \code
|
||||
* { "delete_id", "u", [NULL] }
|
||||
* \endcode
|
||||
*
|
||||
* Here, the message `name` is `"delete_id"`, the `signature` is `"u"`, and the
|
||||
* argument `types` is `[NULL]`, indicating that the `uint` argument has no
|
||||
* corresponding wl_interface since it is a primitive argument.
|
||||
*
|
||||
* In contrast, consider a `wl_foo` interface supporting protocol request `bar`
|
||||
* that has existed since version 2, and has two arguments: a `uint` and an
|
||||
* object of type `wl_baz_interface` that may be `NULL`. Such a `wl_message`
|
||||
* might be:
|
||||
*
|
||||
* \code
|
||||
* { "bar", "2u?o", [NULL, &wl_baz_interface] }
|
||||
* \endcode
|
||||
*
|
||||
* Here, the message `name` is `"bar"`, and the `signature` is `"2u?o"`. Notice
|
||||
* how the `2` indicates the protocol version, the `u` indicates the first
|
||||
* argument type is `uint`, and the `?o` indicates that the second argument
|
||||
* is an object that may be `NULL`. Lastly, the argument `types` array indicates
|
||||
* that no wl_interface corresponds to the first argument, while the type
|
||||
* `wl_baz_interface` corresponds to the second argument.
|
||||
*
|
||||
* \sa wl_argument
|
||||
* \sa wl_interface
|
||||
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Wire-Format">Wire Format</a>
|
||||
*/
|
||||
struct wl_message {
|
||||
/** Message name */
|
||||
const char *name;
|
||||
/** Message signature */
|
||||
const char *signature;
|
||||
/** Object argument interfaces */
|
||||
const struct wl_interface **types;
|
||||
};
|
||||
|
||||
/**
|
||||
* Protocol object interface
|
||||
*
|
||||
* A wl_interface describes the API of a protocol object defined in the Wayland
|
||||
* protocol specification. The protocol implementation uses a wl_interface
|
||||
* within its marshalling machinery for encoding client requests.
|
||||
*
|
||||
* The `name` of a wl_interface is the name of the corresponding protocol
|
||||
* interface, and `version` represents the version of the interface. The members
|
||||
* `method_count` and `event_count` represent the number of `methods` (requests)
|
||||
* and `events` in the respective wl_message members.
|
||||
*
|
||||
* For example, consider a protocol interface `foo`, marked as version `1`, with
|
||||
* two requests and one event.
|
||||
*
|
||||
* \code{.xml}
|
||||
* <interface name="foo" version="1">
|
||||
* <request name="a"></request>
|
||||
* <request name="b"></request>
|
||||
* <event name="c"></event>
|
||||
* </interface>
|
||||
* \endcode
|
||||
*
|
||||
* Given two wl_message arrays `foo_requests` and `foo_events`, a wl_interface
|
||||
* for `foo` might be:
|
||||
*
|
||||
* \code
|
||||
* struct wl_interface foo_interface = {
|
||||
* "foo", 1,
|
||||
* 2, foo_requests,
|
||||
* 1, foo_events
|
||||
* };
|
||||
* \endcode
|
||||
*
|
||||
* \note The server side of the protocol may define interface <em>implementation
|
||||
* types</em> that incorporate the term `interface` in their name. Take
|
||||
* care to not confuse these server-side `struct`s with a wl_interface
|
||||
* variable whose name also ends in `interface`. For example, while the
|
||||
* server may define a type `struct wl_foo_interface`, the client may
|
||||
* define a `struct wl_interface wl_foo_interface`.
|
||||
*
|
||||
* \sa wl_message
|
||||
* \sa wl_proxy
|
||||
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Interfaces">Interfaces</a>
|
||||
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Versioning">Versioning</a>
|
||||
*/
|
||||
struct wl_interface {
|
||||
/** Interface name */
|
||||
const char *name;
|
||||
/** Interface version */
|
||||
int version;
|
||||
/** Number of methods (requests) */
|
||||
int method_count;
|
||||
/** Method (request) signatures */
|
||||
const struct wl_message *methods;
|
||||
/** Number of events */
|
||||
int event_count;
|
||||
/** Event signatures */
|
||||
const struct wl_message *events;
|
||||
};
|
||||
|
||||
/** \class wl_list
|
||||
*
|
||||
* \brief Doubly-linked list
|
||||
*
|
||||
* On its own, an instance of `struct wl_list` represents the sentinel head of
|
||||
* a doubly-linked list, and must be initialized using wl_list_init().
|
||||
* When empty, the list head's `next` and `prev` members point to the list head
|
||||
* itself, otherwise `next` references the first element in the list, and `prev`
|
||||
* refers to the last element in the list.
|
||||
*
|
||||
* Use the `struct wl_list` type to represent both the list head and the links
|
||||
* between elements within the list. Use wl_list_empty() to determine if the
|
||||
* list is empty in O(1).
|
||||
*
|
||||
* All elements in the list must be of the same type. The element type must have
|
||||
* a `struct wl_list` member, often named `link` by convention. Prior to
|
||||
* insertion, there is no need to initialize an element's `link` - invoking
|
||||
* wl_list_init() on an individual list element's `struct wl_list` member is
|
||||
* unnecessary if the very next operation is wl_list_insert(). However, a
|
||||
* common idiom is to initialize an element's `link` prior to removal - ensure
|
||||
* safety by invoking wl_list_init() before wl_list_remove().
|
||||
*
|
||||
* Consider a list reference `struct wl_list foo_list`, an element type as
|
||||
* `struct element`, and an element's link member as `struct wl_list link`.
|
||||
*
|
||||
* The following code initializes a list and adds three elements to it.
|
||||
*
|
||||
* \code
|
||||
* struct wl_list foo_list;
|
||||
*
|
||||
* struct element {
|
||||
* int foo;
|
||||
* struct wl_list link;
|
||||
* };
|
||||
* struct element e1, e2, e3;
|
||||
*
|
||||
* wl_list_init(&foo_list);
|
||||
* wl_list_insert(&foo_list, &e1.link); // e1 is the first element
|
||||
* wl_list_insert(&foo_list, &e2.link); // e2 is now the first element
|
||||
* wl_list_insert(&e2.link, &e3.link); // insert e3 after e2
|
||||
* \endcode
|
||||
*
|
||||
* The list now looks like <em>[e2, e3, e1]</em>.
|
||||
*
|
||||
* The `wl_list` API provides some iterator macros. For example, to iterate
|
||||
* a list in ascending order:
|
||||
*
|
||||
* \code
|
||||
* struct element *e;
|
||||
* wl_list_for_each(e, foo_list, link) {
|
||||
* do_something_with_element(e);
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* See the documentation of each iterator for details.
|
||||
* \sa http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/list.h
|
||||
*/
|
||||
struct wl_list {
|
||||
/** Previous list element */
|
||||
struct wl_list *prev;
|
||||
/** Next list element */
|
||||
struct wl_list *next;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the list.
|
||||
*
|
||||
* \param list List to initialize
|
||||
*
|
||||
* \memberof wl_list
|
||||
*/
|
||||
void
|
||||
wl_list_init(struct wl_list *list);
|
||||
|
||||
/**
|
||||
* Inserts an element into the list, after the element represented by \p list.
|
||||
* When \p list is a reference to the list itself (the head), set the containing
|
||||
* struct of \p elm as the first element in the list.
|
||||
*
|
||||
* \note If \p elm is already part of a list, inserting it again will lead to
|
||||
* list corruption.
|
||||
*
|
||||
* \param list List element after which the new element is inserted
|
||||
* \param elm Link of the containing struct to insert into the list
|
||||
*
|
||||
* \memberof wl_list
|
||||
*/
|
||||
void
|
||||
wl_list_insert(struct wl_list *list, struct wl_list *elm);
|
||||
|
||||
/**
|
||||
* Removes an element from the list.
|
||||
*
|
||||
* \note This operation leaves \p elm in an invalid state.
|
||||
*
|
||||
* \param elm Link of the containing struct to remove from the list
|
||||
*
|
||||
* \memberof wl_list
|
||||
*/
|
||||
void
|
||||
wl_list_remove(struct wl_list *elm);
|
||||
|
||||
/**
|
||||
* Determines the length of the list.
|
||||
*
|
||||
* \note This is an O(n) operation.
|
||||
*
|
||||
* \param list List whose length is to be determined
|
||||
*
|
||||
* \return Number of elements in the list
|
||||
*
|
||||
* \memberof wl_list
|
||||
*/
|
||||
int
|
||||
wl_list_length(const struct wl_list *list);
|
||||
|
||||
/**
|
||||
* Determines if the list is empty.
|
||||
*
|
||||
* \param list List whose emptiness is to be determined
|
||||
*
|
||||
* \return 1 if empty, or 0 if not empty
|
||||
*
|
||||
* \memberof wl_list
|
||||
*/
|
||||
int
|
||||
wl_list_empty(const struct wl_list *list);
|
||||
|
||||
/**
|
||||
* Inserts all of the elements of one list into another, after the element
|
||||
* represented by \p list.
|
||||
*
|
||||
* \note This leaves \p other in an invalid state.
|
||||
*
|
||||
* \param list List element after which the other list elements will be inserted
|
||||
* \param other List of elements to insert
|
||||
*
|
||||
* \memberof wl_list
|
||||
*/
|
||||
void
|
||||
wl_list_insert_list(struct wl_list *list, struct wl_list *other);
|
||||
|
||||
/**
|
||||
* Retrieves a pointer to a containing struct, given a member name.
|
||||
*
|
||||
* This macro allows "conversion" from a pointer to a member to its containing
|
||||
* struct. This is useful if you have a contained item like a wl_list,
|
||||
* wl_listener, or wl_signal, provided via a callback or other means, and would
|
||||
* like to retrieve the struct that contains it.
|
||||
*
|
||||
* To demonstrate, the following example retrieves a pointer to
|
||||
* `example_container` given only its `destroy_listener` member:
|
||||
*
|
||||
* \code
|
||||
* struct example_container {
|
||||
* struct wl_listener destroy_listener;
|
||||
* // other members...
|
||||
* };
|
||||
*
|
||||
* void example_container_destroy(struct wl_listener *listener, void *data)
|
||||
* {
|
||||
* struct example_container *ctr;
|
||||
*
|
||||
* ctr = wl_container_of(listener, ctr, destroy_listener);
|
||||
* // destroy ctr...
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* \note `sample` need not be a valid pointer. A null or uninitialised pointer
|
||||
* is sufficient.
|
||||
*
|
||||
* \param ptr Valid pointer to the contained member
|
||||
* \param sample Pointer to a struct whose type contains \p ptr
|
||||
* \param member Named location of \p ptr within the \p sample type
|
||||
*
|
||||
* \return The container for the specified pointer
|
||||
*/
|
||||
#define wl_container_of(ptr, sample, member) \
|
||||
(__typeof__(sample))((char *)(ptr) - \
|
||||
offsetof(__typeof__(*sample), member))
|
||||
|
||||
/**
|
||||
* Iterates over a list.
|
||||
*
|
||||
* This macro expresses a for-each iterator for wl_list. Given a list and
|
||||
* wl_list link member name (often named `link` by convention), this macro
|
||||
* assigns each element in the list to \p pos, which can then be referenced in
|
||||
* a trailing code block. For example, given a wl_list of `struct message`
|
||||
* elements:
|
||||
*
|
||||
* \code
|
||||
* struct message {
|
||||
* char *contents;
|
||||
* wl_list link;
|
||||
* };
|
||||
*
|
||||
* struct wl_list *message_list;
|
||||
* // Assume message_list now "contains" many messages
|
||||
*
|
||||
* struct message *m;
|
||||
* wl_list_for_each(m, message_list, link) {
|
||||
* do_something_with_message(m);
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* \param pos Cursor that each list element will be assigned to
|
||||
* \param head Head of the list to iterate over
|
||||
* \param member Name of the link member within the element struct
|
||||
*
|
||||
* \relates wl_list
|
||||
*/
|
||||
#define wl_list_for_each(pos, head, member) \
|
||||
for (pos = wl_container_of((head)->next, pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = wl_container_of(pos->member.next, pos, member))
|
||||
|
||||
/**
|
||||
* Iterates over a list, safe against removal of the list element.
|
||||
*
|
||||
* \note Only removal of the current element, \p pos, is safe. Removing
|
||||
* any other element during traversal may lead to a loop malfunction.
|
||||
*
|
||||
* \sa wl_list_for_each()
|
||||
*
|
||||
* \param pos Cursor that each list element will be assigned to
|
||||
* \param tmp Temporary pointer of the same type as \p pos
|
||||
* \param head Head of the list to iterate over
|
||||
* \param member Name of the link member within the element struct
|
||||
*
|
||||
* \relates wl_list
|
||||
*/
|
||||
#define wl_list_for_each_safe(pos, tmp, head, member) \
|
||||
for (pos = wl_container_of((head)->next, pos, member), \
|
||||
tmp = wl_container_of((pos)->member.next, tmp, member); \
|
||||
&pos->member != (head); \
|
||||
pos = tmp, \
|
||||
tmp = wl_container_of(pos->member.next, tmp, member))
|
||||
|
||||
/**
|
||||
* Iterates backwards over a list.
|
||||
*
|
||||
* \sa wl_list_for_each()
|
||||
*
|
||||
* \param pos Cursor that each list element will be assigned to
|
||||
* \param head Head of the list to iterate over
|
||||
* \param member Name of the link member within the element struct
|
||||
*
|
||||
* \relates wl_list
|
||||
*/
|
||||
#define wl_list_for_each_reverse(pos, head, member) \
|
||||
for (pos = wl_container_of((head)->prev, pos, member); \
|
||||
&pos->member != (head); \
|
||||
pos = wl_container_of(pos->member.prev, pos, member))
|
||||
|
||||
/**
|
||||
* Iterates backwards over a list, safe against removal of the list element.
|
||||
*
|
||||
* \note Only removal of the current element, \p pos, is safe. Removing
|
||||
* any other element during traversal may lead to a loop malfunction.
|
||||
*
|
||||
* \sa wl_list_for_each()
|
||||
*
|
||||
* \param pos Cursor that each list element will be assigned to
|
||||
* \param tmp Temporary pointer of the same type as \p pos
|
||||
* \param head Head of the list to iterate over
|
||||
* \param member Name of the link member within the element struct
|
||||
*
|
||||
* \relates wl_list
|
||||
*/
|
||||
#define wl_list_for_each_reverse_safe(pos, tmp, head, member) \
|
||||
for (pos = wl_container_of((head)->prev, pos, member), \
|
||||
tmp = wl_container_of((pos)->member.prev, tmp, member); \
|
||||
&pos->member != (head); \
|
||||
pos = tmp, \
|
||||
tmp = wl_container_of(pos->member.prev, tmp, member))
|
||||
|
||||
/**
|
||||
* \class wl_array
|
||||
*
|
||||
* Dynamic array
|
||||
*
|
||||
* A wl_array is a dynamic array that can only grow until released. It is
|
||||
* intended for relatively small allocations whose size is variable or not known
|
||||
* in advance. While construction of a wl_array does not require all elements to
|
||||
* be of the same size, wl_array_for_each() does require all elements to have
|
||||
* the same type and size.
|
||||
*
|
||||
*/
|
||||
struct wl_array {
|
||||
/** Array size */
|
||||
size_t size;
|
||||
/** Allocated space */
|
||||
size_t alloc;
|
||||
/** Array data */
|
||||
void *data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the array.
|
||||
*
|
||||
* \param array Array to initialize
|
||||
*
|
||||
* \memberof wl_array
|
||||
*/
|
||||
void
|
||||
wl_array_init(struct wl_array *array);
|
||||
|
||||
/**
|
||||
* Releases the array data.
|
||||
*
|
||||
* \note Leaves the array in an invalid state.
|
||||
*
|
||||
* \param array Array whose data is to be released
|
||||
*
|
||||
* \memberof wl_array
|
||||
*/
|
||||
void
|
||||
wl_array_release(struct wl_array *array);
|
||||
|
||||
/**
|
||||
* Increases the size of the array by \p size bytes.
|
||||
*
|
||||
* \param array Array whose size is to be increased
|
||||
* \param size Number of bytes to increase the size of the array by
|
||||
*
|
||||
* \return A pointer to the beginning of the newly appended space, or NULL when
|
||||
* resizing fails.
|
||||
*
|
||||
* \memberof wl_array
|
||||
*/
|
||||
void *
|
||||
wl_array_add(struct wl_array *array, size_t size);
|
||||
|
||||
/**
|
||||
* Copies the contents of \p source to \p array.
|
||||
*
|
||||
* \param array Destination array to copy to
|
||||
* \param source Source array to copy from
|
||||
*
|
||||
* \return 0 on success, or -1 on failure
|
||||
*
|
||||
* \memberof wl_array
|
||||
*/
|
||||
int
|
||||
wl_array_copy(struct wl_array *array, struct wl_array *source);
|
||||
|
||||
/**
|
||||
* Iterates over an array.
|
||||
*
|
||||
* This macro expresses a for-each iterator for wl_array. It assigns each
|
||||
* element in the array to \p pos, which can then be referenced in a trailing
|
||||
* code block. \p pos must be a pointer to the array element type, and all
|
||||
* array elements must be of the same type and size.
|
||||
*
|
||||
* \param pos Cursor that each array element will be assigned to
|
||||
* \param array Array to iterate over
|
||||
*
|
||||
* \relates wl_array
|
||||
* \sa wl_list_for_each()
|
||||
*/
|
||||
#define wl_array_for_each(pos, array) \
|
||||
for (pos = (array)->data; \
|
||||
(const char *) pos < ((const char *) (array)->data + (array)->size); \
|
||||
(pos)++)
|
||||
|
||||
/**
|
||||
* Fixed-point number
|
||||
*
|
||||
* A `wl_fixed_t` is a 24.8 signed fixed-point number with a sign bit, 23 bits
|
||||
* of integer precision and 8 bits of decimal precision. Consider `wl_fixed_t`
|
||||
* as an opaque struct with methods that facilitate conversion to and from
|
||||
* `double` and `int` types.
|
||||
*/
|
||||
typedef int32_t wl_fixed_t;
|
||||
|
||||
/**
|
||||
* Converts a fixed-point number to a floating-point number.
|
||||
*
|
||||
* \param f Fixed-point number to convert
|
||||
*
|
||||
* \return Floating-point representation of the fixed-point argument
|
||||
*/
|
||||
static inline double
|
||||
wl_fixed_to_double(wl_fixed_t f)
|
||||
{
|
||||
union {
|
||||
double d;
|
||||
int64_t i;
|
||||
} u;
|
||||
|
||||
u.i = ((1023LL + 44LL) << 52) + (1LL << 51) + f;
|
||||
|
||||
return u.d - (3LL << 43);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a floating-point number to a fixed-point number.
|
||||
*
|
||||
* \param d Floating-point number to convert
|
||||
*
|
||||
* \return Fixed-point representation of the floating-point argument
|
||||
*/
|
||||
static inline wl_fixed_t
|
||||
wl_fixed_from_double(double d)
|
||||
{
|
||||
union {
|
||||
double d;
|
||||
int64_t i;
|
||||
} u;
|
||||
|
||||
u.d = d + (3LL << (51 - 8));
|
||||
|
||||
return (wl_fixed_t)u.i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a fixed-point number to an integer.
|
||||
*
|
||||
* \param f Fixed-point number to convert
|
||||
*
|
||||
* \return Integer component of the fixed-point argument
|
||||
*/
|
||||
static inline int
|
||||
wl_fixed_to_int(wl_fixed_t f)
|
||||
{
|
||||
return f / 256;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an integer to a fixed-point number.
|
||||
*
|
||||
* \param i Integer to convert
|
||||
*
|
||||
* \return Fixed-point representation of the integer argument
|
||||
*/
|
||||
static inline wl_fixed_t
|
||||
wl_fixed_from_int(int i)
|
||||
{
|
||||
return i * 256;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protocol message argument data types
|
||||
*
|
||||
* This union represents all of the argument types in the Wayland protocol wire
|
||||
* format. The protocol implementation uses wl_argument within its marshalling
|
||||
* machinery for dispatching messages between a client and a compositor.
|
||||
*
|
||||
* \sa wl_message
|
||||
* \sa wl_interface
|
||||
* \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-wire-Format">Wire Format</a>
|
||||
*/
|
||||
union wl_argument {
|
||||
int32_t i; /**< `int` */
|
||||
uint32_t u; /**< `uint` */
|
||||
wl_fixed_t f; /**< `fixed` */
|
||||
const char *s; /**< `string` */
|
||||
struct wl_object *o; /**< `object` */
|
||||
uint32_t n; /**< `new_id` */
|
||||
struct wl_array *a; /**< `array` */
|
||||
int32_t h; /**< `fd` */
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatcher function type alias
|
||||
*
|
||||
* A dispatcher is a function that handles the emitting of callbacks in client
|
||||
* code. For programs directly using the C library, this is done by using
|
||||
* libffi to call function pointers. When binding to languages other than C,
|
||||
* dispatchers provide a way to abstract the function calling process to be
|
||||
* friendlier to other function calling systems.
|
||||
*
|
||||
* A dispatcher takes five arguments: The first is the dispatcher-specific
|
||||
* implementation associated with the target object. The second is the object
|
||||
* upon which the callback is being invoked (either wl_proxy or wl_resource).
|
||||
* The third and fourth arguments are the opcode and the wl_message
|
||||
* corresponding to the callback. The final argument is an array of arguments
|
||||
* received from the other process via the wire protocol.
|
||||
*
|
||||
* \param "const void *" Dispatcher-specific implementation data
|
||||
* \param "void *" Callback invocation target (wl_proxy or `wl_resource`)
|
||||
* \param uint32_t Callback opcode
|
||||
* \param "const struct wl_message *" Callback message signature
|
||||
* \param "union wl_argument *" Array of received arguments
|
||||
*
|
||||
* \return 0 on success, or -1 on failure
|
||||
*/
|
||||
typedef int (*wl_dispatcher_func_t)(const void *, void *, uint32_t,
|
||||
const struct wl_message *,
|
||||
union wl_argument *);
|
||||
|
||||
/**
|
||||
* Log function type alias
|
||||
*
|
||||
* The C implementation of the Wayland protocol abstracts the details of
|
||||
* logging. Users may customize the logging behavior, with a function conforming
|
||||
* to the `wl_log_func_t` type, via `wl_log_set_handler_client` and
|
||||
* `wl_log_set_handler_server`.
|
||||
*
|
||||
* A `wl_log_func_t` must conform to the expectations of `vprintf`, and
|
||||
* expects two arguments: a string to write and a corresponding variable
|
||||
* argument list. While the string to write may contain format specifiers and
|
||||
* use values in the variable argument list, the behavior of any `wl_log_func_t`
|
||||
* depends on the implementation.
|
||||
*
|
||||
* \note Take care to not confuse this with `wl_protocol_logger_func_t`, which
|
||||
* is a specific server-side logger for requests and events.
|
||||
*
|
||||
* \param "const char *" String to write to the log, containing optional format
|
||||
* specifiers
|
||||
* \param "va_list" Variable argument list
|
||||
*
|
||||
* \sa wl_log_set_handler_client
|
||||
* \sa wl_log_set_handler_server
|
||||
*/
|
||||
typedef void (*wl_log_func_t)(const char *, va_list) WL_PRINTF(1, 0);
|
||||
|
||||
/**
|
||||
* Return value of an iterator function
|
||||
*
|
||||
* \sa wl_client_for_each_resource_iterator_func_t
|
||||
* \sa wl_client_for_each_resource
|
||||
*/
|
||||
enum wl_iterator_result {
|
||||
/** Stop the iteration */
|
||||
WL_ITERATOR_STOP,
|
||||
/** Continue the iteration */
|
||||
WL_ITERATOR_CONTINUE
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
34
thirdparty/linuxbsd_headers/wayland/wayland-version.h
vendored
Normal file
34
thirdparty/linuxbsd_headers/wayland/wayland-version.h
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright © 2012 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.
|
||||
*/
|
||||
|
||||
#ifndef WAYLAND_VERSION_H
|
||||
#define WAYLAND_VERSION_H
|
||||
|
||||
#define WAYLAND_VERSION_MAJOR 1
|
||||
#define WAYLAND_VERSION_MINOR 21
|
||||
#define WAYLAND_VERSION_MICRO 0
|
||||
#define WAYLAND_VERSION "1.21.0"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user