summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2011-08-19 13:40:28 -0400
committerKristian Høgsberg <krh@bitplanet.net>2011-08-27 12:06:11 -0400
commita7c682432893d2e5e534953ef64193f1dd4bcef4 (patch)
tree701ea02bb0b010a66c13f314c499f771d6efce24
parent3ac8757ec3f2166401afa9e059e934713382d211 (diff)
server: Hand code all wl_display client stubs
-rw-r--r--src/scanner.c33
-rw-r--r--src/wayland-client.c23
-rw-r--r--src/wayland-client.h4
3 files changed, 44 insertions, 16 deletions
diff --git a/src/scanner.c b/src/scanner.c
index 7e4bac6..b114fbf 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -343,20 +343,22 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
struct arg *a, *ret;
int has_destructor, has_destroy;
- /* We provide a hand written constructor for the display object */
- if (strcmp(interface->name, "wl_display") != 0)
- printf("static inline struct %s *\n"
- "%s_create(struct wl_display *display, uint32_t id, uint32_t version)\n"
- "{\n"
- "\twl_display_bind(display, id, \"%s\", version);\n\n"
- "\treturn (struct %s *)\n"
- "\t\twl_proxy_create_for_id(display, &%s_interface, id);\n"
- "}\n\n",
- interface->name,
- interface->name,
- interface->name,
- interface->name,
- interface->name);
+ /* We provide a hand written functions for the display object */
+ if (strcmp(interface->name, "wl_display") == 0)
+ return;
+
+ printf("static inline struct %s *\n"
+ "%s_create(struct wl_display *display, uint32_t id, uint32_t version)\n"
+ "{\n"
+ "\twl_display_bind(display, id, \"%s\", version);\n\n"
+ "\treturn (struct %s *)\n"
+ "\t\twl_proxy_create_for_id(display, &%s_interface, id);\n"
+ "}\n\n",
+ interface->name,
+ interface->name,
+ interface->name,
+ interface->name,
+ interface->name);
printf("static inline void\n"
"%s_set_user_data(struct %s *%s, void *user_data)\n"
@@ -390,8 +392,7 @@ emit_stubs(struct wl_list *message_list, struct interface *interface)
exit(EXIT_FAILURE);
}
- /* And we have a hand-written display destructor */
- if (!has_destructor && strcmp(interface->name, "wl_display") != 0)
+ if (!has_destructor)
printf("static inline void\n"
"%s_destroy(struct %s *%s)\n"
"{\n"
diff --git a/src/wayland-client.c b/src/wayland-client.c
index a7b118b..ec62885 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -525,6 +525,29 @@ wl_display_allocate_id(struct wl_display *display)
}
WL_EXPORT void
+wl_display_bind(struct wl_display *display,
+ uint32_t id, const char *interface, uint32_t version)
+{
+ wl_proxy_marshal(&display->proxy,
+ WL_DISPLAY_BIND, id, interface, version);
+}
+
+WL_EXPORT struct wl_callback *
+wl_display_sync(struct wl_display *display)
+{
+ struct wl_proxy *proxy;
+
+ proxy = wl_proxy_create(&display->proxy, &wl_callback_interface);
+
+ if (!proxy)
+ return NULL;
+
+ wl_proxy_marshal(&display->proxy, WL_DISPLAY_SYNC, proxy);
+
+ return (struct wl_callback *) proxy;
+}
+
+WL_EXPORT void
wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data)
{
proxy->user_data = user_data;
diff --git a/src/wayland-client.h b/src/wayland-client.h
index b00b0ae..dc5aa5f 100644
--- a/src/wayland-client.h
+++ b/src/wayland-client.h
@@ -44,6 +44,10 @@ int wl_proxy_add_listener(struct wl_proxy *proxy,
void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
void *wl_proxy_get_user_data(struct wl_proxy *proxy);
+void wl_display_bind(struct wl_display *display,
+ uint32_t id, const char *interface, uint32_t version);
+struct wl_callback *wl_display_sync(struct wl_display *display);
+
#include "wayland-client-protocol.h"
#define WL_DISPLAY_READABLE 0x01