4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
23 #if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS)
29 #include "utils/log.h"
30 #include "DynamicDll.h"
40 struct wl_shell_surface;
48 extern const struct wl_interface wl_display_interface;
49 extern const struct wl_interface wl_registry_interface;
50 extern const struct wl_interface wl_callback_interface;
51 extern const struct wl_interface wl_compositor_interface;
52 extern const struct wl_interface wl_shell_interface;
53 extern const struct wl_interface wl_shell_surface_interface;
54 extern const struct wl_interface wl_surface_interface;
55 extern const struct wl_interface wl_seat_interface;
56 extern const struct wl_interface wl_pointer_interface;
57 extern const struct wl_interface wl_keyboard_interface;
58 extern const struct wl_interface wl_output_interface;
59 extern const struct wl_interface wl_region_interface;
61 class IDllWaylandClient
64 typedef void(*wl_proxy_marshal_func)(struct wl_proxy *,
67 typedef void(*wl_proxy_listener_func)(void);
69 virtual struct wl_interface ** Get_wl_display_interface() = 0;
70 virtual struct wl_interface ** Get_wl_registry_interface() = 0;
71 virtual struct wl_interface ** Get_wl_callback_interface() = 0;
72 virtual struct wl_interface ** Get_wl_compositor_interface() = 0;
73 virtual struct wl_interface ** Get_wl_shell_interface() = 0;
74 virtual struct wl_interface ** Get_wl_shell_surface_interface() = 0;
75 virtual struct wl_interface ** Get_wl_surface_interface() = 0;
76 virtual struct wl_interface ** Get_wl_seat_interface() = 0;
77 virtual struct wl_interface ** Get_wl_pointer_interface() = 0;
78 virtual struct wl_interface ** Get_wl_keyboard_interface() = 0;
79 virtual struct wl_interface ** Get_wl_output_interface() = 0;
80 virtual struct wl_interface ** Get_wl_region_interface() = 0;
82 virtual struct wl_display * wl_display_connect(const char *) = 0;
83 virtual void wl_display_disconnect(struct wl_display *) = 0;
84 virtual int wl_display_get_fd(struct wl_display *) = 0;
85 virtual int wl_display_dispatch(struct wl_display *) = 0;
86 virtual int wl_display_dispatch_pending(struct wl_display *) = 0;
87 virtual int wl_display_flush(struct wl_display *) = 0;
89 virtual wl_proxy_marshal_func wl_proxy_marshaller() = 0;
91 virtual struct wl_proxy * wl_proxy_create(struct wl_proxy *,
92 const struct wl_interface *) = 0;
93 virtual void wl_proxy_destroy(struct wl_proxy *) = 0;
94 virtual int wl_proxy_add_listener(struct wl_proxy *,
95 wl_proxy_listener_func *,
98 virtual ~IDllWaylandClient() {}
101 class DllWaylandClient : public DllDynamic, public IDllWaylandClient
103 DECLARE_DLL_WRAPPER(DllWaylandClient, DLL_PATH_WAYLAND_CLIENT)
105 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_display_interface);
106 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_registry_interface);
107 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_callback_interface);
108 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_compositor_interface);
109 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_shell_interface);
110 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_shell_surface_interface);
111 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_surface_interface);
112 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_seat_interface);
113 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_pointer_interface);
114 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_keyboard_interface);
115 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_output_interface);
116 DEFINE_GLOBAL_PTR(struct wl_interface *, wl_region_interface);
118 DEFINE_METHOD1(struct wl_display *, wl_display_connect, (const char *p1));
119 DEFINE_METHOD1(void, wl_display_disconnect, (struct wl_display *p1));
120 DEFINE_METHOD1(int, wl_display_get_fd, (struct wl_display *p1));
121 DEFINE_METHOD1(int, wl_display_dispatch, (struct wl_display *p1));
122 DEFINE_METHOD1(int, wl_display_dispatch_pending, (struct wl_display *p1));
123 DEFINE_METHOD1(int, wl_display_flush, (struct wl_display *p1));
125 /* We need to resolve wl_proxy_marshal as a function pointer as it
127 DEFINE_METHOD_FP(void,
129 (struct wl_proxy *p1, uint32_t p2, ...));
131 DEFINE_METHOD2(struct wl_proxy *,
133 (struct wl_proxy *p1, const struct wl_interface *p2));
134 DEFINE_METHOD1(void, wl_proxy_destroy, (struct wl_proxy *p1));
136 wl_proxy_add_listener,
137 (struct wl_proxy *p1,
138 wl_proxy_listener_func *p2,
141 BEGIN_METHOD_RESOLVE()
142 RESOLVE_METHOD(wl_display_interface)
143 RESOLVE_METHOD(wl_registry_interface)
144 RESOLVE_METHOD(wl_callback_interface)
145 RESOLVE_METHOD(wl_compositor_interface)
146 RESOLVE_METHOD(wl_shell_interface)
147 RESOLVE_METHOD(wl_shell_surface_interface)
148 RESOLVE_METHOD(wl_surface_interface)
149 RESOLVE_METHOD(wl_seat_interface)
150 RESOLVE_METHOD(wl_pointer_interface)
151 RESOLVE_METHOD(wl_keyboard_interface)
152 RESOLVE_METHOD(wl_output_interface)
153 RESOLVE_METHOD(wl_region_interface)
155 RESOLVE_METHOD(wl_display_connect)
156 RESOLVE_METHOD(wl_display_disconnect)
157 RESOLVE_METHOD(wl_display_get_fd)
158 RESOLVE_METHOD(wl_display_dispatch)
159 RESOLVE_METHOD(wl_display_dispatch_pending)
160 RESOLVE_METHOD(wl_display_flush)
161 RESOLVE_METHOD_FP(wl_proxy_marshal)
162 RESOLVE_METHOD(wl_proxy_create)
163 RESOLVE_METHOD(wl_proxy_destroy)
164 RESOLVE_METHOD(wl_proxy_add_listener)
169 /* This overload returns the function pointer to wl_proxy_marshal
170 * so that clients can call it directly */
171 wl_proxy_marshal_func wl_proxy_marshaller()
173 return DllWaylandClient::wl_proxy_marshal;