xref: /aosp_15_r20/external/wayland/src/wayland-server.h (revision 84e872a0dc482bffdb63672969dd03a827d67c73)
1*84e872a0SLloyd Pique /*
2*84e872a0SLloyd Pique  * Copyright © 2008 Kristian Høgsberg
3*84e872a0SLloyd Pique  *
4*84e872a0SLloyd Pique  * Permission is hereby granted, free of charge, to any person obtaining
5*84e872a0SLloyd Pique  * a copy of this software and associated documentation files (the
6*84e872a0SLloyd Pique  * "Software"), to deal in the Software without restriction, including
7*84e872a0SLloyd Pique  * without limitation the rights to use, copy, modify, merge, publish,
8*84e872a0SLloyd Pique  * distribute, sublicense, and/or sell copies of the Software, and to
9*84e872a0SLloyd Pique  * permit persons to whom the Software is furnished to do so, subject to
10*84e872a0SLloyd Pique  * the following conditions:
11*84e872a0SLloyd Pique  *
12*84e872a0SLloyd Pique  * The above copyright notice and this permission notice (including the
13*84e872a0SLloyd Pique  * next paragraph) shall be included in all copies or substantial
14*84e872a0SLloyd Pique  * portions of the Software.
15*84e872a0SLloyd Pique  *
16*84e872a0SLloyd Pique  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17*84e872a0SLloyd Pique  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18*84e872a0SLloyd Pique  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19*84e872a0SLloyd Pique  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20*84e872a0SLloyd Pique  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21*84e872a0SLloyd Pique  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22*84e872a0SLloyd Pique  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23*84e872a0SLloyd Pique  * SOFTWARE.
24*84e872a0SLloyd Pique  */
25*84e872a0SLloyd Pique 
26*84e872a0SLloyd Pique /** \file
27*84e872a0SLloyd Pique  *
28*84e872a0SLloyd Pique  *  \brief Include the server API, deprecations and protocol C API.
29*84e872a0SLloyd Pique  *
30*84e872a0SLloyd Pique  *  \warning Use of this header file is discouraged. Prefer including
31*84e872a0SLloyd Pique  *  wayland-server-core.h instead, which does not include the
32*84e872a0SLloyd Pique  *  server protocol header and as such only defines the library
33*84e872a0SLloyd Pique  *  API, excluding the deprecated API below.
34*84e872a0SLloyd Pique  */
35*84e872a0SLloyd Pique 
36*84e872a0SLloyd Pique #ifndef WAYLAND_SERVER_H
37*84e872a0SLloyd Pique #define WAYLAND_SERVER_H
38*84e872a0SLloyd Pique 
39*84e872a0SLloyd Pique #include <stdint.h>
40*84e872a0SLloyd Pique #include "wayland-server-core.h"
41*84e872a0SLloyd Pique 
42*84e872a0SLloyd Pique #ifdef  __cplusplus
43*84e872a0SLloyd Pique extern "C" {
44*84e872a0SLloyd Pique #endif
45*84e872a0SLloyd Pique 
46*84e872a0SLloyd Pique /*
47*84e872a0SLloyd Pique  * The user can set this macro to hide the wl_object, wl_resource and wl_buffer
48*84e872a0SLloyd Pique  * objects alongside the associated API.
49*84e872a0SLloyd Pique  *
50*84e872a0SLloyd Pique  * The structs were meant to be opaque, although we missed that in the early days.
51*84e872a0SLloyd Pique  *
52*84e872a0SLloyd Pique  * NOTE: the list of structs, functions, etc in this section MUST NEVER GROW.
53*84e872a0SLloyd Pique  * Otherwise we will break forward compatibility and applications that used to
54*84e872a0SLloyd Pique  * build fine will no longer be able to do so.
55*84e872a0SLloyd Pique  */
56*84e872a0SLloyd Pique #ifndef WL_HIDE_DEPRECATED
57*84e872a0SLloyd Pique 
58*84e872a0SLloyd Pique struct wl_object {
59*84e872a0SLloyd Pique 	const struct wl_interface *interface;
60*84e872a0SLloyd Pique 	const void *implementation;
61*84e872a0SLloyd Pique 	uint32_t id;
62*84e872a0SLloyd Pique };
63*84e872a0SLloyd Pique 
64*84e872a0SLloyd Pique struct wl_resource {
65*84e872a0SLloyd Pique 	struct wl_object object;
66*84e872a0SLloyd Pique 	wl_resource_destroy_func_t destroy;
67*84e872a0SLloyd Pique 	struct wl_list link;
68*84e872a0SLloyd Pique 	struct wl_signal destroy_signal;
69*84e872a0SLloyd Pique 	struct wl_client *client;
70*84e872a0SLloyd Pique 	void *data;
71*84e872a0SLloyd Pique };
72*84e872a0SLloyd Pique 
73*84e872a0SLloyd Pique uint32_t
74*84e872a0SLloyd Pique wl_client_add_resource(struct wl_client *client,
75*84e872a0SLloyd Pique 		       struct wl_resource *resource) WL_DEPRECATED;
76*84e872a0SLloyd Pique 
77*84e872a0SLloyd Pique struct wl_resource *
78*84e872a0SLloyd Pique wl_client_add_object(struct wl_client *client,
79*84e872a0SLloyd Pique 		     const struct wl_interface *interface,
80*84e872a0SLloyd Pique 		     const void *implementation,
81*84e872a0SLloyd Pique 		     uint32_t id, void *data) WL_DEPRECATED;
82*84e872a0SLloyd Pique 
83*84e872a0SLloyd Pique struct wl_resource *
84*84e872a0SLloyd Pique wl_client_new_object(struct wl_client *client,
85*84e872a0SLloyd Pique 		     const struct wl_interface *interface,
86*84e872a0SLloyd Pique 		     const void *implementation, void *data) WL_DEPRECATED;
87*84e872a0SLloyd Pique 
88*84e872a0SLloyd Pique struct wl_global *
89*84e872a0SLloyd Pique wl_display_add_global(struct wl_display *display,
90*84e872a0SLloyd Pique 		      const struct wl_interface *interface,
91*84e872a0SLloyd Pique 		      void *data,
92*84e872a0SLloyd Pique 		      wl_global_bind_func_t bind) WL_DEPRECATED;
93*84e872a0SLloyd Pique 
94*84e872a0SLloyd Pique void
95*84e872a0SLloyd Pique wl_display_remove_global(struct wl_display *display,
96*84e872a0SLloyd Pique 			 struct wl_global *global) WL_DEPRECATED;
97*84e872a0SLloyd Pique 
98*84e872a0SLloyd Pique #endif
99*84e872a0SLloyd Pique 
100*84e872a0SLloyd Pique #ifdef  __cplusplus
101*84e872a0SLloyd Pique }
102*84e872a0SLloyd Pique #endif
103*84e872a0SLloyd Pique 
104*84e872a0SLloyd Pique #include "wayland-server-protocol.h"
105*84e872a0SLloyd Pique 
106*84e872a0SLloyd Pique #endif
107