1 // Copyright © 2017-2021 Rémi Thebault
2 module wayland.client;
3 
4 public import wayland.client.core;
5 public import wayland.client.protocol;
6 
7 version(WlDynamic)
8 {
9     import wayland.native.client;
10     import wayland.native.util;
11 
12     import derelict.util.loader : SharedLibLoader;
13 
14     private class WlClientLoader : SharedLibLoader
15     {
16         this()
17         {
18             super("libwayland-client.so");
19         }
20 
21         protected override void loadSymbols()
22         {
23             bindFunc( cast( void** )&wl_event_queue_destroy, "wl_event_queue_destroy" );
24             bindFunc( cast( void** )&wl_proxy_marshal, "wl_proxy_marshal" );
25             bindFunc( cast( void** )&wl_proxy_marshal_array, "wl_proxy_marshal_array" );
26             bindFunc( cast( void** )&wl_proxy_create, "wl_proxy_create" );
27             bindFunc( cast( void** )&wl_proxy_create_wrapper, "wl_proxy_create_wrapper" );
28             bindFunc( cast( void** )&wl_proxy_wrapper_destroy, "wl_proxy_wrapper_destroy" );
29             bindFunc( cast( void** )&wl_proxy_marshal_constructor, "wl_proxy_marshal_constructor" );
30             bindFunc( cast( void** )&wl_proxy_marshal_constructor_versioned, "wl_proxy_marshal_constructor_versioned" );
31             bindFunc( cast( void** )&wl_proxy_marshal_array_constructor, "wl_proxy_marshal_array_constructor" );
32             bindFunc( cast( void** )&wl_proxy_marshal_array_constructor_versioned, "wl_proxy_marshal_array_constructor_versioned" );
33             bindFunc( cast( void** )&wl_proxy_destroy, "wl_proxy_destroy" );
34             bindFunc( cast( void** )&wl_proxy_add_listener, "wl_proxy_add_listener" );
35             bindFunc( cast( void** )&wl_proxy_get_listener, "wl_proxy_get_listener" );
36             bindFunc( cast( void** )&wl_proxy_add_dispatcher, "wl_proxy_add_dispatcher" );
37             bindFunc( cast( void** )&wl_proxy_set_user_data, "wl_proxy_set_user_data" );
38             bindFunc( cast( void** )&wl_proxy_get_user_data, "wl_proxy_get_user_data" );
39             bindFunc( cast( void** )&wl_proxy_get_version, "wl_proxy_get_version" );
40             bindFunc( cast( void** )&wl_proxy_get_id, "wl_proxy_get_id" );
41             bindFunc( cast( void** )&wl_proxy_get_class, "wl_proxy_get_class" );
42             bindFunc( cast( void** )&wl_proxy_set_queue, "wl_proxy_set_queue" );
43             bindFunc( cast( void** )&wl_display_connect, "wl_display_connect" );
44             bindFunc( cast( void** )&wl_display_connect_to_fd, "wl_display_connect_to_fd" );
45             bindFunc( cast( void** )&wl_display_disconnect, "wl_display_disconnect" );
46             bindFunc( cast( void** )&wl_display_get_fd, "wl_display_get_fd" );
47             bindFunc( cast( void** )&wl_display_dispatch, "wl_display_dispatch" );
48             bindFunc( cast( void** )&wl_display_dispatch_queue, "wl_display_dispatch_queue" );
49             bindFunc( cast( void** )&wl_display_dispatch_queue_pending, "wl_display_dispatch_queue_pending" );
50             bindFunc( cast( void** )&wl_display_dispatch_pending, "wl_display_dispatch_pending" );
51             bindFunc( cast( void** )&wl_display_get_error, "wl_display_get_error" );
52             bindFunc( cast( void** )&wl_display_get_protocol_error, "wl_display_get_protocol_error" );
53             bindFunc( cast( void** )&wl_display_flush, "wl_display_flush" );
54             bindFunc( cast( void** )&wl_display_roundtrip_queue, "wl_display_roundtrip_queue" );
55             bindFunc( cast( void** )&wl_display_roundtrip, "wl_display_roundtrip" );
56             bindFunc( cast( void** )&wl_display_create_queue, "wl_display_create_queue" );
57             bindFunc( cast( void** )&wl_display_prepare_read_queue, "wl_display_prepare_read_queue" );
58             bindFunc( cast( void** )&wl_display_prepare_read, "wl_display_prepare_read" );
59             bindFunc( cast( void** )&wl_display_cancel_read, "wl_display_cancel_read" );
60             bindFunc( cast( void** )&wl_display_read_events, "wl_display_read_events" );
61             bindFunc( cast( void** )&wl_log_set_handler_client, "wl_log_set_handler_client" );
62 
63             bindFunc( cast( void** )&wl_list_init, "wl_list_init" );
64             bindFunc( cast( void** )&wl_list_insert, "wl_list_insert" );
65             bindFunc( cast( void** )&wl_list_remove, "wl_list_remove" );
66             bindFunc( cast( void** )&wl_list_length, "wl_list_length" );
67             bindFunc( cast( void** )&wl_list_empty, "wl_list_empty" );
68             bindFunc( cast( void** )&wl_list_insert_list, "wl_list_insert_list" );
69             bindFunc( cast( void** )&wl_array_init, "wl_array_init" );
70             bindFunc( cast( void** )&wl_array_release, "wl_array_release" );
71             bindFunc( cast( void** )&wl_array_add, "wl_array_add" );
72             bindFunc( cast( void** )&wl_array_copy, "wl_array_copy" );
73         }
74     }
75 
76     private __gshared WlClientLoader _loader;
77 
78     shared static this()
79     {
80         _loader = new WlClientLoader;
81     }
82 
83     public @property SharedLibLoader wlClientDynLib()
84     {
85         return _loader;
86     }
87 }
88