1 // Copyright © 2017 Rémi Thebault
2 /// bindings to wayland-server-core.h
3 module wayland.server;
4 
5 public import wayland.server.core;
6 public import wayland.server.protocol;
7 public import wayland.server.eventloop;
8 
9 version(WlDynamic)
10 {
11     import wayland.native.server;
12     import wayland.native.util;
13 
14     import derelict.util.loader : SharedLibLoader;
15 
16     private class WlServerLoader : SharedLibLoader
17     {
18         this()
19         {
20             super("libwayland-server.so");
21         }
22 
23         protected override void loadSymbols()
24         {
25             bindFunc( cast( void** )&wl_event_loop_create, "wl_event_loop_create" );
26             bindFunc( cast( void** )&wl_event_loop_destroy, "wl_event_loop_destroy" );
27             bindFunc( cast( void** )&wl_event_loop_add_fd, "wl_event_loop_add_fd" );
28             bindFunc( cast( void** )&wl_event_source_fd_update, "wl_event_source_fd_update" );
29             bindFunc( cast( void** )&wl_event_loop_add_timer, "wl_event_loop_add_timer" );
30             bindFunc( cast( void** )&wl_event_loop_add_signal, "wl_event_loop_add_signal" );
31             bindFunc( cast( void** )&wl_event_source_timer_update, "wl_event_source_timer_update" );
32             bindFunc( cast( void** )&wl_event_source_remove, "wl_event_source_remove" );
33             bindFunc( cast( void** )&wl_event_source_check, "wl_event_source_check" );
34             bindFunc( cast( void** )&wl_event_loop_dispatch, "wl_event_loop_dispatch" );
35             bindFunc( cast( void** )&wl_event_loop_dispatch_idle, "wl_event_loop_dispatch_idle" );
36             bindFunc( cast( void** )&wl_event_loop_add_idle, "wl_event_loop_add_idle" );
37             bindFunc( cast( void** )&wl_event_loop_get_fd, "wl_event_loop_get_fd" );
38             bindFunc( cast( void** )&wl_event_loop_add_destroy_listener, "wl_event_loop_add_destroy_listener" );
39             bindFunc( cast( void** )&wl_event_loop_get_destroy_listener, "wl_event_loop_get_destroy_listener" );
40             bindFunc( cast( void** )&wl_display_create, "wl_display_create" );
41             bindFunc( cast( void** )&wl_display_destroy, "wl_display_destroy" );
42             bindFunc( cast( void** )&wl_display_get_event_loop, "wl_display_get_event_loop" );
43             bindFunc( cast( void** )&wl_display_add_socket, "wl_display_add_socket" );
44             bindFunc( cast( void** )&wl_display_add_socket_auto, "wl_display_add_socket_auto" );
45             bindFunc( cast( void** )&wl_display_add_socket_fd, "wl_display_add_socket_fd" );
46             bindFunc( cast( void** )&wl_display_terminate, "wl_display_terminate" );
47             bindFunc( cast( void** )&wl_display_run, "wl_display_run" );
48             bindFunc( cast( void** )&wl_display_flush_clients, "wl_display_flush_clients" );
49             bindFunc( cast( void** )&wl_display_get_serial, "wl_display_get_serial" );
50             bindFunc( cast( void** )&wl_display_next_serial, "wl_display_next_serial" );
51             bindFunc( cast( void** )&wl_display_add_destroy_listener, "wl_display_add_destroy_listener" );
52             bindFunc( cast( void** )&wl_display_add_client_created_listener, "wl_display_add_client_created_listener" );
53             bindFunc( cast( void** )&wl_display_get_destroy_listener, "wl_display_get_destroy_listener" );
54             bindFunc( cast( void** )&wl_global_create, "wl_global_create" );
55             bindFunc( cast( void** )&wl_global_destroy, "wl_global_destroy" );
56             bindFunc( cast( void** )&wl_display_set_global_filter, "wl_display_set_global_filter" );
57             bindFunc( cast( void** )&wl_global_get_interface, "wl_global_get_interface" );
58             bindFunc( cast( void** )&wl_global_get_user_data, "wl_global_get_user_data" );
59             bindFunc( cast( void** )&wl_client_create, "wl_client_create" );
60             bindFunc( cast( void** )&wl_display_get_client_list, "wl_display_get_client_list" );
61             bindFunc( cast( void** )&wl_client_get_link, "wl_client_get_link" );
62             bindFunc( cast( void** )&wl_client_from_link, "wl_client_from_link" );
63             bindFunc( cast( void** )&wl_client_destroy, "wl_client_destroy" );
64             bindFunc( cast( void** )&wl_client_flush, "wl_client_flush" );
65             bindFunc( cast( void** )&wl_client_get_credentials, "wl_client_get_credentials" );
66             bindFunc( cast( void** )&wl_client_get_fd, "wl_client_get_fd" );
67             bindFunc( cast( void** )&wl_client_add_destroy_listener, "wl_client_add_destroy_listener" );
68             bindFunc( cast( void** )&wl_client_get_destroy_listener, "wl_client_get_destroy_listener" );
69             bindFunc( cast( void** )&wl_client_get_object, "wl_client_get_object" );
70             bindFunc( cast( void** )&wl_client_post_no_memory, "wl_client_post_no_memory" );
71             bindFunc( cast( void** )&wl_client_add_resource_created_listener, "wl_client_add_resource_created_listener" );
72             bindFunc( cast( void** )&wl_client_for_each_resource, "wl_client_for_each_resource" );
73             bindFunc( cast( void** )&wl_resource_post_event, "wl_resource_post_event" );
74             bindFunc( cast( void** )&wl_resource_post_event_array, "wl_resource_post_event_array" );
75             bindFunc( cast( void** )&wl_resource_queue_event, "wl_resource_queue_event" );
76             bindFunc( cast( void** )&wl_resource_queue_event_array, "wl_resource_queue_event_array" );
77             bindFunc( cast( void** )&wl_resource_post_error, "wl_resource_post_error" );
78             bindFunc( cast( void** )&wl_resource_post_no_memory, "wl_resource_post_no_memory" );
79             bindFunc( cast( void** )&wl_client_get_display, "wl_client_get_display" );
80             bindFunc( cast( void** )&wl_resource_create, "wl_resource_create" );
81             bindFunc( cast( void** )&wl_resource_set_implementation, "wl_resource_set_implementation" );
82             bindFunc( cast( void** )&wl_resource_set_dispatcher, "wl_resource_set_dispatcher" );
83             bindFunc( cast( void** )&wl_resource_destroy, "wl_resource_destroy" );
84             bindFunc( cast( void** )&wl_resource_get_id, "wl_resource_get_id" );
85             bindFunc( cast( void** )&wl_resource_get_link, "wl_resource_get_link" );
86             bindFunc( cast( void** )&wl_resource_from_link, "wl_resource_from_link" );
87             bindFunc( cast( void** )&wl_resource_find_for_client, "wl_resource_find_for_client" );
88             bindFunc( cast( void** )&wl_resource_get_client, "wl_resource_get_client" );
89             bindFunc( cast( void** )&wl_resource_set_user_data, "wl_resource_set_user_data" );
90             bindFunc( cast( void** )&wl_resource_get_user_data, "wl_resource_get_user_data" );
91             bindFunc( cast( void** )&wl_resource_get_version, "wl_resource_get_version" );
92             bindFunc( cast( void** )&wl_resource_set_destructor, "wl_resource_set_destructor" );
93             bindFunc( cast( void** )&wl_resource_instance_of, "wl_resource_instance_of" );
94             bindFunc( cast( void** )&wl_resource_get_class, "wl_resource_get_class" );
95             bindFunc( cast( void** )&wl_resource_add_destroy_listener, "wl_resource_add_destroy_listener" );
96             bindFunc( cast( void** )&wl_resource_get_destroy_listener, "wl_resource_get_destroy_listener" );
97             bindFunc( cast( void** )&wl_shm_buffer_get, "wl_shm_buffer_get" );
98             bindFunc( cast( void** )&wl_shm_buffer_begin_access, "wl_shm_buffer_begin_access" );
99             bindFunc( cast( void** )&wl_shm_buffer_end_access, "wl_shm_buffer_end_access" );
100             bindFunc( cast( void** )&wl_shm_buffer_get_data, "wl_shm_buffer_get_data" );
101             bindFunc( cast( void** )&wl_shm_buffer_get_stride, "wl_shm_buffer_get_stride" );
102             bindFunc( cast( void** )&wl_shm_buffer_get_format, "wl_shm_buffer_get_format" );
103             bindFunc( cast( void** )&wl_shm_buffer_get_width, "wl_shm_buffer_get_width" );
104             bindFunc( cast( void** )&wl_shm_buffer_get_height, "wl_shm_buffer_get_height" );
105             bindFunc( cast( void** )&wl_shm_buffer_ref_pool, "wl_shm_buffer_ref_pool" );
106             bindFunc( cast( void** )&wl_shm_pool_unref, "wl_shm_pool_unref" );
107             bindFunc( cast( void** )&wl_display_init_shm, "wl_display_init_shm" );
108             bindFunc( cast( void** )&wl_display_add_shm_format, "wl_display_add_shm_format" );
109             bindFunc( cast( void** )&wl_log_set_handler_server, "wl_log_set_handler_server" );
110             bindFunc( cast( void** )&wl_display_add_protocol_logger, "wl_display_add_protocol_logger" );
111             bindFunc( cast( void** )&wl_protocol_logger_destroy, "wl_protocol_logger_destroy" );
112 
113             bindFunc( cast( void** )&wl_list_init, "wl_list_init" );
114             bindFunc( cast( void** )&wl_list_insert, "wl_list_insert" );
115             bindFunc( cast( void** )&wl_list_remove, "wl_list_remove" );
116             bindFunc( cast( void** )&wl_list_length, "wl_list_length" );
117             bindFunc( cast( void** )&wl_list_empty, "wl_list_empty" );
118             bindFunc( cast( void** )&wl_list_insert_list, "wl_list_insert_list" );
119             bindFunc( cast( void** )&wl_array_init, "wl_array_init" );
120             bindFunc( cast( void** )&wl_array_release, "wl_array_release" );
121             bindFunc( cast( void** )&wl_array_add, "wl_array_add" );
122             bindFunc( cast( void** )&wl_array_copy, "wl_array_copy" );
123         }
124     }
125 
126     private __gshared WlServerLoader _loader;
127 
128     shared static this()
129     {
130         _loader = new WlServerLoader;
131     }
132 
133     public @property SharedLibLoader wlServerDynLib()
134     {
135         return _loader;
136     }
137 }
138