wayland_ada_f8a9fe05/wayland_client_ada/src/wayland-api.ads

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
--  SPDX-License-Identifier: Apache-2.0
--
--  Copyright (c) 2018 - 2019 Joakim Strandberg <joakim@mequinox.se>
--
--  Licensed under the Apache License, Version 2.0 (the "License");
--  you may not use this file except in compliance with the License.
--  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--  Unless required by applicable law or agreed to in writing, software
--  distributed under the License is distributed on an "AS IS" BASIS,
--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--  See the License for the specific language governing permissions and
--  limitations under the License.

with Interfaces.C.Strings;

--  This package was generated with:
--
--    gcc -fdump-ada-spec /usr/include/wayland-client-core.h
--
--  and then manually modified to make it a bit higher-level.

private package Wayland.API is
   pragma Preelaborate;

   pragma Linker_Options ("-lwayland-client");

   type Proxy is limited private;

   type Proxy_Ptr is access all Proxy
     with Convention => C;

   type Display_Ptr is new Proxy_Ptr;

   type Interface_T;

   type Interface_Ptr is access constant Interface_T;

   type Interface_Ptr_Array is array (Positive range <>) of aliased Interface_Ptr;

   type Message is limited record
      Name      : Interfaces.C.Strings.char_array_access;
      Signature : Interfaces.C.Strings.char_array_access;
      Types     : access Interface_Ptr;
   end record
     with Convention => C_Pass_By_Copy;

   type Message_Array is array (Natural range <>) of aliased Message
     with Convention => C;

   type Message_Array_Ptr is access constant Message_Array
     with Size => Standard'Address_Size;

   type Interface_T is limited record
      Name         : Interfaces.C.Strings.char_array_access;
      Version      : Interfaces.C.int;
      Method_Count : Interfaces.C.int;
      Methods      : Message_Array_Ptr;
      Event_Count  : Interfaces.C.int;
      Events       : Message_Array_Ptr;
   end record
     with Convention => C_Pass_By_Copy;

   -----------------------------------------------------------------------------

   --  wl_proxy_create is not task-safe
   --  See https://gitlab.freedesktop.org/wayland/wayland/-/issues/182

--   function Proxy_Create
--     (Factory   : in out Proxy;
--      Interface : in out Interface) return access Proxy
--   with Import, Convention => C, External_Name => "wl_proxy_create";

--   function Proxy_Create_wrapper (Proxy : System.Address) return System.Address
--     with Import, Convention => C, External_Name => "wl_proxy_create_wrapper";

--   procedure Proxy_Wrapper_destroy (Proxy_Wrapper : System.Address)
--     with Import, Convention => C, External_Name => "wl_proxy_wrapper_destroy";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Integer)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Unsigned_32)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Unsigned_32;
      Arg_2  : Interfaces.C.Strings.chars_ptr)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Unsigned_32;
      Arg_2  : Unsigned_32)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Interfaces.C.Strings.chars_ptr)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Interfaces.C.Strings.chars_ptr;
      Arg_2  : File_Descriptor)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Integer;
      Arg_2  : Integer)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Fixed;
      Arg_2  : Fixed)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Proxy_Ptr)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Proxy_Ptr;
      Arg_2  : Unsigned_32)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Proxy_Ptr;
      Arg_2  : Unsigned_32;
      Arg_3  : Unsigned_32)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Proxy_Ptr;
      Arg_2  : Integer;
      Arg_3  : Integer)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Proxy_Ptr;
      Arg_2  : Unsigned_32;
      Arg_3  : Integer;
      Arg_4  : Integer)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Integer;
      Arg_2  : Integer;
      Arg_3  : Integer;
      Arg_4  : Integer)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Fixed;
      Arg_2  : Fixed;
      Arg_3  : Fixed;
      Arg_4  : Fixed)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Proxy_Ptr;
      Arg_2  : Integer;
      Arg_3  : Integer;
      Arg_4  : Unsigned_32)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Proxy_Ptr;
      Arg_2  : Proxy_Ptr;
      Arg_3  : Proxy_Ptr;
      Arg_4  : Unsigned_32)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   procedure Proxy_Marshal
     (Object : in out Proxy;
      Opcode : Unsigned_32;
      Arg_1  : Unsigned_32;
      Arg_2  : Proxy_Ptr;
      Arg_3  : Integer;
      Arg_4  : Integer)
   with Import, Convention => C, External_Name => "wl_proxy_marshal";

   function Proxy_Marshal_Constructor
     (Object  : in out Proxy;
      Opcode  : Unsigned_32;
      Subject : Interface_Ptr;
      New_ID  : Unsigned_32) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";

   function Proxy_Marshal_Constructor
     (Object  : in out Proxy;
      Opcode  : Unsigned_32;
      Subject : Interface_Ptr;
      New_ID  : Unsigned_32;
      Offset  : Integer;
      Width   : Integer;
      Height  : Integer;
      Stride  : Integer;
      Format  : Unsigned_32) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";

   function Proxy_Marshal_Constructor
     (Object  : in out Proxy;
      Opcode  : Unsigned_32;
      Subject : Interface_Ptr;
      Offset  : Proxy_Ptr;
      New_ID  : Unsigned_32) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";

   function Proxy_Marshal_Constructor
     (Object  : in out Proxy;
      Opcode  : Unsigned_32;
      Subject : Interface_Ptr;
      New_ID  : Unsigned_32;
      Offset  : Proxy_Ptr) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";

   function Proxy_Marshal_Constructor
     (Object  : in out Proxy;
      Opcode  : Unsigned_32;
      Subject : Interface_Ptr;
      New_ID  : Unsigned_32;
      Arg_1   : File_Descriptor;
      Arg_2   : Integer) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";

   function Proxy_Marshal_Constructor
     (Object  : in out Proxy;
      Opcode  : Unsigned_32;
      Subject : Interface_Ptr;
      New_ID  : Unsigned_32;
      Arg_1   : Proxy_Ptr;
      Arg_2   : Proxy_Ptr) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";

   function Proxy_Marshal_Constructor
     (Object  : in out Proxy;
      Opcode  : Unsigned_32;
      Subject : Interface_Ptr;
      New_ID  : Unsigned_32;
      Arg_1   : Proxy_Ptr;
      Arg_2   : Proxy_Ptr;
      Arg_3   : Proxy_Ptr;
      Arg_4   : Unsigned_32) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";

   function Proxy_Marshal_Constructor_Versioned
     (Object     : in out Proxy;
      Opcode     : Unsigned_32;
      Subject    : Interface_Ptr;
      New_ID_1   : Unsigned_32;
      Name       : Unsigned_32;
      Iface_Name : Interfaces.C.Strings.char_array_access;
      New_ID_2   : Unsigned_32;
      Version    : Unsigned_32) return Proxy_Ptr
   with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor_versioned";

--   procedure Proxy_Marshal_Array
--     (Object : in out Proxy;
--      Opcode : Unsigned_32;
--      Args   : access wayland_util_h.wl_argument)  -- TODO Array
--   with Import, Convention => C, External_Name => "wl_proxy_marshal_array";

--   function Proxy_Marshal_Array_Constructor
--     (Object : in out Proxy;
--      Opcode : Unsigned_32;
--      Args : access wayland_util_h.wl_argument;
--      Interface : in out Interface) return access Proxy
--   with Import, Convention => C, External_Name => "wl_proxy_marshal_array_constructor";

--   function Proxy_Marshal_Array_Constructor_Versioned
--     (Object : in out Proxy;
--      Opcode : Unsigned_32;
--      Args : access wayland_util_h.wl_argument;
--      Interface : in out Interface;
--      Version : Unsigned_32) return access Proxy
--   with Import, Convention => C, External_Name => "wl_proxy_marshal_array_constructor_versioned";

   procedure Proxy_Destroy (Object : in out Proxy)
     with Import, Convention => C, External_Name => "wl_proxy_destroy";

   function Proxy_Add_Listener
     (Object  : in out Proxy;
      Subject : Void_Ptr;
      Data    : Void_Ptr) return Interfaces.C.int
   with Import, Convention => C, External_Name => "wl_proxy_add_listener";
   --  Returns 0 on success, otherwise -1 on failure

--   function Proxy_Get_Listener (Object : in out Proxy) return Listener
--     with Import, Convention => C, External_Name => "wl_proxy_get_listener";

--   function Proxy_Add_Dispatcher
--     (Object : in out Proxy;
--      Dispatcher_Func : wayland_util_h.wl_dispatcher_func_t;
--      Dispatcher_Data : System.Address;
--      Data : System.Address) return int
--     with Import, Convention => C, External_Name => "wl_proxy_add_dispatcher";

   procedure Proxy_Set_User_Data (Object : in out Proxy; User_Data : Void_Ptr)
     with Import, Convention => C, External_Name => "wl_proxy_set_user_data";

   function Proxy_Get_User_Data (Object : in out Proxy) return Void_Ptr
     with Import, Convention => C, External_Name => "wl_proxy_get_user_data";

   function Proxy_Get_Version (Object : in out Proxy) return Unsigned_32
     with Import, Convention => C, External_Name => "wl_proxy_get_version";

   function Proxy_Get_Id (Object : in out Proxy) return Unsigned_32
     with Import, Convention => C, External_Name => "wl_proxy_get_id";

--   function Proxy_Get_Class (Object : in out Proxy) return Interfaces.C.Strings.chars_ptr
--     with Import, Convention => C, External_Name => "wl_proxy_get_class";

   -----------------------------------------------------------------------------
   --                           Connection Handling                           --
   -----------------------------------------------------------------------------

   function Display_Connect (Name : Interfaces.C.Strings.chars_ptr) return Display_Ptr
     with Import, Convention => C, External_Name => "wl_display_connect";

--   function Display_Connect_To_FD (FD : int) return Display_Ptr
--     with Import, Convention => C, External_Name => "wl_display_connect_to_fd";

   procedure Display_Disconnect (Object : Display_Ptr)
     with Import, Convention => C, External_Name => "wl_display_disconnect";

   function Display_Get_File_Descriptor (Object : Display_Ptr) return File_Descriptor
     with Import, Convention => C, External_Name => "wl_display_get_fd";

--   function Display_Get_Error (Object : Display_Ptr) return Integer
--     with Import, Convention => C, External_Name => "wl_display_get_error";

--   function Display_Get_Protocol_Error
--     (Object      : Display_Ptr;
--      Interface_V : out Interface_Ptr;
--      ID          : out Unsigned_32) return Unsigned_32
--   with Import, Convention => C, External_Name => "wl_display_get_protocol_error";

--   procedure Log_Set_Handler_Client (Arg1 : Wayland_Util_H.WL_Log_Func_T)
--     with Import, Convention => C, External_Name => "wl_log_set_handler_client";

   function Display_Flush (Object : Display_Ptr) return Integer
     with Import, Convention => C, External_Name => "wl_display_flush";

   -----------------------------------------------------------------------------
   --                           Default Event Queue                           --
   -----------------------------------------------------------------------------

   function Display_Dispatch (Object : Display_Ptr) return Integer
     with Import, Convention => C, External_Name => "wl_display_dispatch";

   function Display_Dispatch_Pending (Object : Display_Ptr) return Integer
     with Import, Convention => C, External_Name => "wl_display_dispatch_pending";

   function Display_Roundtrip (Object : Display_Ptr) return Integer
     with Import, Convention => C, External_Name => "wl_display_roundtrip";

   function Display_Prepare_Read (Object : Display_Ptr) return Integer
     with Import, Convention => C, External_Name => "wl_display_prepare_read";
   --  Returns 0 on success or -1 if event queue was not empty

   procedure Display_Cancel_Read (Object : Display_Ptr)
     with Import, Convention => C, External_Name => "wl_display_cancel_read";

   function Display_Read_Events (Object : Display_Ptr) return Integer
     with Import, Convention => C, External_Name => "wl_display_read_events";

   -----------------------------------------------------------------------------
   --                               Event Queue                               --
   -----------------------------------------------------------------------------

--   function Display_Create_Queue (Object : Display_Ptr) return System.Address
--     with Import, Convention => C, External_Name => "wl_display_create_queue";

--   function Display_Dispatch_Queue
--     (Object : Display_Ptr;
--      Queue  : System.Address) return int
--   with Import, Convention => C, External_Name => "wl_display_dispatch_queue";

--   function Display_Dispatch_Queue_Pending
--     (Object : Display_Ptr;
--      Queue  : System.Address) return int
--   with Import, Convention => C, External_Name => "wl_display_dispatch_queue_pending";

--   function Display_Roundtrip_Queue (Object : Display_Ptr; Queue : System.Address) return int
--     with Import, Convention => C, External_Name => "wl_display_roundtrip_queue";

--   function Display_Prepare_Read_Queue (Object : Display_Ptr; Queue : System.Address) return int
--     with Import, Convention => C, External_Name => "wl_display_prepare_read_queue";

--   procedure Proxy_Set_Queue (Object : in out Proxy; Queue : access Event_Queue)
--     with Import, Convention => C, External_Name => "wl_proxy_set_queue";

--   procedure Event_Queue_Destroy (Object : in out Event_Queue)
--     with Import, Convention => C, External_Name => "wl_event_queue_destroy";

private

   type Proxy is limited null record;

end Wayland.API;