1 /+
2  +  Wayland copyright:
3  +  Copyright © 2008 Kristian Høgsberg
4  +
5  +  Permission is hereby granted, free of charge, to any person
6  +  obtaining a copy of this software and associated documentation files
7  +  (the "Software"), to deal in the Software without restriction,
8  +  including without limitation the rights to use, copy, modify, merge,
9  +  publish, distribute, sublicense, and/or sell copies of the Software,
10  +  and to permit persons to whom the Software is furnished to do so,
11  +  subject to the following conditions:
12  +
13  +  The above copyright notice and this permission notice (including the
14  +  next paragraph) shall be included in all copies or substantial
15  +  portions of the Software.
16  +
17  +  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  +  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  +  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20  +  NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21  +  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22  +  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23  +  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24  +  SOFTWARE.
25  +/
26 /+
27  +  D bindings copyright:
28  +  Copyright © 2015 Rémi Thebault
29  +/
30 module wayland.client.core;
31 
32 import wayland.client.util;
33 import wayland.client.opaque_types;
34 
35 version (Dynamic) {
36 
37     extern (C) {
38 
39         alias da_wl_event_queue_destroy = void function(wl_event_queue *queue);
40 
41         alias da_wl_proxy_marshal = void function(wl_proxy *p, uint opcode, ...);
42         alias da_wl_proxy_marshal_array = void function(wl_proxy *p, uint opcode,
43                                     wl_argument *args);
44         alias da_wl_proxy_create = wl_proxy *function(wl_proxy *factory,
45                                         const (wl_interface*) iface);
46         alias da_wl_proxy_marshal_constructor = wl_proxy *function(wl_proxy *proxy,
47                                                     uint opcode,
48                                                     const (wl_interface*) iface,
49                                                     ...);
50         alias da_wl_proxy_marshal_array_constructor = wl_proxy *function(wl_proxy *proxy,
51                                         uint opcode, wl_argument *args,
52                                         const (wl_interface*) iface);
53 
54         alias da_wl_proxy_destroy = void function(wl_proxy *proxy);
55         alias da_wl_proxy_add_listener = int function(wl_proxy *proxy,
56                                 void function()* implementation, void *data);
57         alias da_wl_proxy_get_listener = const (void*) function(wl_proxy *proxy);
58         alias da_wl_proxy_add_dispatcher = int function(wl_proxy *proxy,
59                                     wl_dispatcher_func_t dispatcher_func,
60                                     const (void*)  dispatcher_data, void *data);
61         alias da_wl_proxy_set_user_data = void function(wl_proxy *proxy, void *user_data);
62         alias da_wl_proxy_get_user_data = void *function(wl_proxy *proxy);
63         alias da_wl_proxy_get_id = uint function(wl_proxy *proxy);
64         alias da_wl_proxy_get_class = const (char*) function(wl_proxy *proxy);
65         alias da_wl_proxy_set_queue = void function(wl_proxy *proxy, wl_event_queue *queue);
66 
67         alias da_wl_display_connect = wl_display *function(const (char*) name);
68         alias da_wl_display_connect_to_fd = wl_display *function(int fd);
69         alias da_wl_display_disconnect = void function(wl_display *display);
70         alias da_wl_display_get_fd = int function(wl_display *display);
71         alias da_wl_display_dispatch = int function(wl_display *display);
72         alias da_wl_display_dispatch_queue = int function(wl_display *display,
73                                     wl_event_queue *queue);
74         alias da_wl_display_dispatch_queue_pending = int function(wl_display *display,
75                                             wl_event_queue *queue);
76         alias da_wl_display_dispatch_pending = int function(wl_display *display);
77         alias da_wl_display_get_error = int function(wl_display *display);
78         alias da_wl_display_get_protocol_error = uint function(wl_display *display,
79                                             const (wl_interface*)* iface,
80                                             uint *id);
81         alias da_wl_display_flush = int function(wl_display *display);
82         alias da_wl_display_roundtrip_queue = int function(wl_display *display,
83                                     wl_event_queue *queue);
84         alias da_wl_display_roundtrip = int function(wl_display *display);
85         alias da_wl_display_create_queue = wl_event_queue *function(wl_display *display);
86         alias da_wl_display_prepare_read_queue = int function(wl_display *display,
87                                         wl_event_queue *queue);
88         alias da_wl_display_prepare_read = int function(wl_display *display);
89         alias da_wl_display_cancel_read = void function(wl_display *display);
90         alias da_wl_display_read_events = int function(wl_display *display);
91 
92         alias da_wl_log_set_handler_client = void function(wl_log_func_t handler);
93     }
94 
95     __gshared {
96 
97         da_wl_event_queue_destroy wl_event_queue_destroy;
98 
99         da_wl_proxy_marshal wl_proxy_marshal;
100         da_wl_proxy_marshal_array wl_proxy_marshal_array;
101         da_wl_proxy_create wl_proxy_create;
102         da_wl_proxy_marshal_constructor wl_proxy_marshal_constructor;
103         da_wl_proxy_marshal_array_constructor wl_proxy_marshal_array_constructor;
104         da_wl_proxy_destroy wl_proxy_destroy;
105         da_wl_proxy_add_listener wl_proxy_add_listener;
106         da_wl_proxy_get_listener wl_proxy_get_listener;
107         da_wl_proxy_add_dispatcher wl_proxy_add_dispatcher;
108         da_wl_proxy_set_user_data wl_proxy_set_user_data;
109         da_wl_proxy_get_user_data wl_proxy_get_user_data;
110         da_wl_proxy_get_id wl_proxy_get_id;
111         da_wl_proxy_get_class wl_proxy_get_class;
112         da_wl_proxy_set_queue wl_proxy_set_queue;
113 
114         da_wl_display_connect wl_display_connect;
115         da_wl_display_connect_to_fd wl_display_connect_to_fd;
116         da_wl_display_disconnect wl_display_disconnect;
117         da_wl_display_get_fd wl_display_get_fd;
118         da_wl_display_dispatch wl_display_dispatch;
119         da_wl_display_dispatch_queue wl_display_dispatch_queue;
120         da_wl_display_dispatch_queue_pending wl_display_dispatch_queue_pending;
121         da_wl_display_dispatch_pending wl_display_dispatch_pending;
122         da_wl_display_get_error wl_display_get_error;
123         da_wl_display_get_protocol_error wl_display_get_protocol_error;
124         da_wl_display_flush wl_display_flush;
125         da_wl_display_roundtrip_queue wl_display_roundtrip_queue;
126         da_wl_display_roundtrip wl_display_roundtrip;
127         da_wl_display_create_queue wl_display_create_queue;
128         da_wl_display_prepare_read_queue wl_display_prepare_read_queue;
129         da_wl_display_prepare_read wl_display_prepare_read;
130         da_wl_display_cancel_read wl_display_cancel_read;
131         da_wl_display_read_events wl_display_read_events;
132 
133         da_wl_log_set_handler_client wl_log_set_handler_client;
134 
135     }
136 }
137 else {
138     extern (C) {
139         void wl_event_queue_destroy(wl_event_queue *queue);
140 
141         void wl_proxy_marshal(wl_proxy *p, uint opcode, ...);
142         void wl_proxy_marshal_array(wl_proxy *p, uint opcode,
143                                     wl_argument *args);
144         wl_proxy *wl_proxy_create(wl_proxy *factory,
145                                         const (wl_interface*) iface);
146         wl_proxy *wl_proxy_marshal_constructor(wl_proxy *proxy,
147                                                     uint opcode,
148                                                     const (wl_interface*) iface,
149                                                     ...);
150         wl_proxy *
151         wl_proxy_marshal_array_constructor(wl_proxy *proxy,
152                                         uint opcode, wl_argument *args,
153                                         const (wl_interface*) iface);
154 
155         void wl_proxy_destroy(wl_proxy *proxy);
156         int wl_proxy_add_listener(wl_proxy *proxy,
157                                 void function()* implementation, void *data);
158         const (void*) wl_proxy_get_listener(wl_proxy *proxy);
159         int wl_proxy_add_dispatcher(wl_proxy *proxy,
160                                     wl_dispatcher_func_t dispatcher_func,
161                                     const (void*)  dispatcher_data, void *data);
162         void wl_proxy_set_user_data(wl_proxy *proxy, void *user_data);
163         void *wl_proxy_get_user_data(wl_proxy *proxy);
164         uint wl_proxy_get_id(wl_proxy *proxy);
165         const (char*) wl_proxy_get_class(wl_proxy *proxy);
166         void wl_proxy_set_queue(wl_proxy *proxy, wl_event_queue *queue);
167 
168         wl_display *wl_display_connect(const (char*) name);
169         wl_display *wl_display_connect_to_fd(int fd);
170         void wl_display_disconnect(wl_display *display);
171         int wl_display_get_fd(wl_display *display);
172         int wl_display_dispatch(wl_display *display);
173         int wl_display_dispatch_queue(wl_display *display,
174                                     wl_event_queue *queue);
175         int wl_display_dispatch_queue_pending(wl_display *display,
176                                             wl_event_queue *queue);
177         int wl_display_dispatch_pending(wl_display *display);
178         int wl_display_get_error(wl_display *display);
179         uint wl_display_get_protocol_error(wl_display *display,
180                                             const (wl_interface*)* iface,
181                                             uint *id);
182 
183         int wl_display_flush(wl_display *display);
184         int wl_display_roundtrip_queue(wl_display *display,
185                                     wl_event_queue *queue);
186         int wl_display_roundtrip(wl_display *display);
187         wl_event_queue *wl_display_create_queue(wl_display *display);
188 
189         int wl_display_prepare_read_queue(wl_display *display,
190                                         wl_event_queue *queue);
191         int wl_display_prepare_read(wl_display *display);
192         void wl_display_cancel_read(wl_display *display);
193         int wl_display_read_events(wl_display *display);
194 
195         void wl_log_set_handler_client(wl_log_func_t handler);
196 
197 
198     }
199 
200 }
201