2008-12-02 23:15:01 +03:00
|
|
|
/*
|
|
|
|
* Copyright © 2008 Kristian Høgsberg
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that copyright
|
|
|
|
* notice and this permission notice appear in supporting documentation, and
|
|
|
|
* that the name of the copyright holders not be used in advertising or
|
|
|
|
* publicity pertaining to distribution of the software without specific,
|
|
|
|
* written prior permission. The copyright holders make no representations
|
|
|
|
* about the suitability of this software for any purpose. It is provided "as
|
|
|
|
* is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
|
|
* OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2008-10-07 18:10:36 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <ctype.h>
|
2008-12-22 05:50:23 +03:00
|
|
|
#include <assert.h>
|
2008-10-07 18:10:36 +04:00
|
|
|
#include <sys/poll.h>
|
|
|
|
|
2010-08-03 17:26:44 +04:00
|
|
|
#include "wayland-client-protocol.h"
|
2008-10-08 21:32:07 +04:00
|
|
|
#include "connection.h"
|
2008-11-24 07:41:08 +03:00
|
|
|
#include "wayland-util.h"
|
2008-10-08 21:32:07 +04:00
|
|
|
#include "wayland-client.h"
|
|
|
|
|
2008-10-07 18:10:36 +04:00
|
|
|
static const char socket_name[] = "\0wayland";
|
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
struct wl_global_listener {
|
|
|
|
wl_display_global_func_t handler;
|
|
|
|
void *data;
|
|
|
|
struct wl_list link;
|
2008-10-07 18:10:36 +04:00
|
|
|
};
|
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
struct wl_listener {
|
|
|
|
void (**implementation)(void);
|
|
|
|
void *data;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
2008-12-22 07:37:12 +03:00
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
struct wl_proxy {
|
|
|
|
struct wl_object base;
|
|
|
|
struct wl_display *display;
|
|
|
|
struct wl_list listener_list;
|
2009-09-18 17:49:21 +04:00
|
|
|
void *user_data;
|
2008-10-07 18:10:36 +04:00
|
|
|
};
|
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
struct wl_display {
|
|
|
|
struct wl_proxy proxy;
|
|
|
|
struct wl_connection *connection;
|
|
|
|
int fd;
|
|
|
|
uint32_t id, id_count, next_range;
|
|
|
|
uint32_t mask;
|
2010-02-26 19:42:59 +03:00
|
|
|
struct wl_hash_table *objects;
|
2008-12-30 19:03:33 +03:00
|
|
|
struct wl_listener listener;
|
|
|
|
struct wl_list global_listener_list;
|
|
|
|
|
|
|
|
struct wl_visual *argb_visual;
|
|
|
|
struct wl_visual *premultiplied_argb_visual;
|
|
|
|
struct wl_visual *rgb_visual;
|
|
|
|
|
|
|
|
wl_display_update_func_t update;
|
|
|
|
void *update_data;
|
|
|
|
|
|
|
|
wl_display_global_func_t global_handler;
|
|
|
|
void *global_handler_data;
|
|
|
|
};
|
|
|
|
|
2008-11-07 22:27:23 +03:00
|
|
|
static int
|
|
|
|
connection_update(struct wl_connection *connection,
|
|
|
|
uint32_t mask, void *data)
|
|
|
|
{
|
|
|
|
struct wl_display *display = data;
|
|
|
|
|
|
|
|
display->mask = mask;
|
|
|
|
if (display->update)
|
|
|
|
return display->update(display->mask,
|
|
|
|
display->update_data);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
WL_EXPORT struct wl_global_listener *
|
|
|
|
wl_display_add_global_listener(struct wl_display *display,
|
|
|
|
wl_display_global_func_t handler, void *data)
|
|
|
|
{
|
|
|
|
struct wl_global_listener *listener;
|
2008-12-25 03:30:25 +03:00
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
listener = malloc(sizeof *listener);
|
|
|
|
if (listener == NULL)
|
|
|
|
return NULL;
|
2008-12-25 03:30:25 +03:00
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
listener->handler = handler;
|
|
|
|
listener->data = data;
|
|
|
|
wl_list_insert(display->global_listener_list.prev, &listener->link);
|
2008-12-25 03:30:25 +03:00
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
return listener;
|
2008-12-25 03:30:25 +03:00
|
|
|
}
|
|
|
|
|
2008-12-22 07:37:12 +03:00
|
|
|
WL_EXPORT void
|
2008-12-30 19:03:33 +03:00
|
|
|
wl_display_remove_global_listener(struct wl_display *display,
|
|
|
|
struct wl_global_listener *listener)
|
|
|
|
{
|
|
|
|
wl_list_remove(&listener->link);
|
|
|
|
free(listener);
|
|
|
|
}
|
|
|
|
|
2010-08-10 22:02:48 +04:00
|
|
|
WL_EXPORT struct wl_proxy *
|
|
|
|
wl_proxy_create_for_id(struct wl_display *display,
|
|
|
|
const struct wl_interface *interface, uint32_t id)
|
2008-12-30 19:03:33 +03:00
|
|
|
{
|
|
|
|
struct wl_proxy *proxy;
|
|
|
|
|
|
|
|
proxy = malloc(sizeof *proxy);
|
|
|
|
if (proxy == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
proxy->base.interface = interface;
|
2010-08-10 22:02:48 +04:00
|
|
|
proxy->base.id = id;
|
2008-12-30 19:03:33 +03:00
|
|
|
proxy->display = display;
|
|
|
|
wl_list_init(&proxy->listener_list);
|
2010-02-26 19:42:59 +03:00
|
|
|
wl_hash_table_insert(display->objects, proxy->base.id, proxy);
|
2008-12-30 19:03:33 +03:00
|
|
|
|
|
|
|
return proxy;
|
|
|
|
}
|
|
|
|
|
2010-08-10 05:25:50 +04:00
|
|
|
WL_EXPORT struct wl_proxy *
|
2010-08-10 22:02:48 +04:00
|
|
|
wl_proxy_create(struct wl_proxy *factory,
|
|
|
|
const struct wl_interface *interface)
|
2010-08-10 05:25:50 +04:00
|
|
|
{
|
2010-08-10 22:02:48 +04:00
|
|
|
return wl_proxy_create_for_id(factory->display, interface,
|
|
|
|
wl_display_allocate_id(factory->display));
|
2010-08-10 05:25:50 +04:00
|
|
|
}
|
|
|
|
|
2010-08-10 18:53:44 +04:00
|
|
|
WL_EXPORT int
|
2010-08-10 22:02:48 +04:00
|
|
|
wl_proxy_add_listener(struct wl_proxy *proxy,
|
|
|
|
void (**implementation)(void), void *data)
|
2008-12-22 07:37:12 +03:00
|
|
|
{
|
2008-12-30 19:03:33 +03:00
|
|
|
struct wl_listener *listener;
|
|
|
|
|
|
|
|
listener = malloc(sizeof *listener);
|
|
|
|
if (listener == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
listener->implementation = (void (**)(void)) implementation;
|
|
|
|
listener->data = data;
|
|
|
|
wl_list_insert(proxy->listener_list.prev, &listener->link);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-10 05:25:50 +04:00
|
|
|
WL_EXPORT void
|
2008-12-30 19:03:33 +03:00
|
|
|
wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, opcode);
|
|
|
|
wl_connection_vmarshal(proxy->display->connection,
|
|
|
|
&proxy->base, opcode, ap,
|
|
|
|
&proxy->base.interface->methods[opcode]);
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
2008-12-19 01:55:33 +03:00
|
|
|
static void
|
2010-08-10 22:02:48 +04:00
|
|
|
add_visual(struct wl_display *display, uint32_t id)
|
2008-12-19 01:55:33 +03:00
|
|
|
{
|
|
|
|
struct wl_visual *visual;
|
|
|
|
|
2008-12-30 19:03:33 +03:00
|
|
|
visual = (struct wl_visual *)
|
2010-08-10 22:02:48 +04:00
|
|
|
wl_proxy_create_for_id(display, &wl_visual_interface, id);
|
2008-12-30 19:03:33 +03:00
|
|
|
if (display->argb_visual == NULL)
|
|
|
|
display->argb_visual = visual;
|
|
|
|
else if (display->premultiplied_argb_visual == NULL)
|
|
|
|
display->premultiplied_argb_visual = visual;
|
|
|
|
else
|
|
|
|
display->rgb_visual = visual;
|
2008-12-19 01:55:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT struct wl_visual *
|
|
|
|
wl_display_get_argb_visual(struct wl_display *display)
|
|
|
|
{
|
2008-12-30 19:03:33 +03:00
|
|
|
return display->argb_visual;
|
2008-12-19 01:55:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT struct wl_visual *
|
|
|
|
wl_display_get_premultiplied_argb_visual(struct wl_display *display)
|
|
|
|
{
|
2008-12-30 19:03:33 +03:00
|
|
|
return display->premultiplied_argb_visual;
|
2008-12-19 01:55:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT struct wl_visual *
|
|
|
|
wl_display_get_rgb_visual(struct wl_display *display)
|
|
|
|
{
|
2008-12-30 19:03:33 +03:00
|
|
|
return display->rgb_visual;
|
|
|
|
}
|
2008-12-19 01:55:33 +03:00
|
|
|
|
2008-12-25 03:30:25 +03:00
|
|
|
static void
|
2008-12-30 19:03:33 +03:00
|
|
|
display_handle_invalid_object(void *data,
|
|
|
|
struct wl_display *display, uint32_t id)
|
2008-12-25 03:30:25 +03:00
|
|
|
{
|
|
|
|
fprintf(stderr, "sent request to invalid object\n");
|
2010-08-06 01:44:31 +04:00
|
|
|
abort();
|
2008-12-25 03:30:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-12-30 19:03:33 +03:00
|
|
|
display_handle_invalid_method(void *data,
|
|
|
|
struct wl_display *display,
|
2008-12-25 03:30:25 +03:00
|
|
|
uint32_t id, uint32_t opcode)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "sent invalid request opcode\n");
|
2010-08-06 01:44:31 +04:00
|
|
|
abort();
|
2008-12-25 03:30:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-12-30 19:03:33 +03:00
|
|
|
display_handle_no_memory(void *data,
|
|
|
|
struct wl_display *display)
|
2008-12-25 03:30:25 +03:00
|
|
|
{
|
|
|
|
fprintf(stderr, "server out of memory\n");
|
2010-08-06 01:44:31 +04:00
|
|
|
abort();
|
2008-12-25 03:30:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-12-30 19:03:33 +03:00
|
|
|
display_handle_global(void *data,
|
|
|
|
struct wl_display *display,
|
2008-12-25 03:30:25 +03:00
|
|
|
uint32_t id, const char *interface, uint32_t version)
|
|
|
|
{
|
2010-08-10 22:02:48 +04:00
|
|
|
struct wl_global_listener *listener;
|
2008-12-30 19:03:33 +03:00
|
|
|
|
2010-08-10 22:02:48 +04:00
|
|
|
if (strcmp(interface, "display") == 0)
|
2010-02-26 19:42:59 +03:00
|
|
|
wl_hash_table_insert(display->objects,
|
|
|
|
id, &display->proxy.base);
|
2010-08-10 22:02:48 +04:00
|
|
|
else if (strcmp(interface, "visual") == 0)
|
|
|
|
add_visual(display, id);
|
|
|
|
|
|
|
|
wl_list_for_each(listener, &display->global_listener_list, link)
|
|
|
|
(*listener->handler)(display,
|
|
|
|
id, interface, version, listener->data);
|
2008-12-25 03:30:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-12-30 19:03:33 +03:00
|
|
|
display_handle_range(void *data,
|
|
|
|
struct wl_display *display, uint32_t range)
|
2008-12-25 03:30:25 +03:00
|
|
|
{
|
|
|
|
display->next_range = range;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wl_display_listener display_listener = {
|
|
|
|
display_handle_invalid_object,
|
|
|
|
display_handle_invalid_method,
|
|
|
|
display_handle_no_memory,
|
|
|
|
display_handle_global,
|
|
|
|
display_handle_range
|
|
|
|
};
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT struct wl_display *
|
2008-12-07 23:22:22 +03:00
|
|
|
wl_display_create(const char *name, size_t name_size)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
|
|
|
struct wl_display *display;
|
2008-12-07 23:22:22 +03:00
|
|
|
struct sockaddr_un addr;
|
2008-10-07 18:10:36 +04:00
|
|
|
socklen_t size;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
display = malloc(sizeof *display);
|
|
|
|
if (display == NULL)
|
2008-10-07 18:10:36 +04:00
|
|
|
return NULL;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
memset(display, 0, sizeof *display);
|
|
|
|
display->fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
|
|
|
if (display->fd < 0) {
|
|
|
|
free(display);
|
2008-10-07 18:10:36 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-12-07 23:22:22 +03:00
|
|
|
addr.sun_family = AF_LOCAL;
|
|
|
|
memcpy(addr.sun_path, name, name_size);
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-12-07 23:22:22 +03:00
|
|
|
size = offsetof (struct sockaddr_un, sun_path) + name_size;
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-12-07 23:22:22 +03:00
|
|
|
if (connect(display->fd, (struct sockaddr *) &addr, size) < 0) {
|
2008-10-08 21:32:07 +04:00
|
|
|
close(display->fd);
|
|
|
|
free(display);
|
2008-10-07 18:10:36 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-02-26 19:42:59 +03:00
|
|
|
display->objects = wl_hash_table_create();
|
2008-12-30 19:03:33 +03:00
|
|
|
wl_list_init(&display->global_listener_list);
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-12-23 02:06:49 +03:00
|
|
|
display->proxy.base.interface = &wl_display_interface;
|
|
|
|
display->proxy.base.id = 1;
|
2008-12-22 05:50:23 +03:00
|
|
|
display->proxy.display = display;
|
2008-12-30 19:03:33 +03:00
|
|
|
wl_list_init(&display->proxy.listener_list);
|
|
|
|
|
|
|
|
display->listener.implementation = (void(**)(void)) &display_listener;
|
|
|
|
wl_list_insert(display->proxy.listener_list.prev, &display->listener.link);
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
display->connection = wl_connection_create(display->fd,
|
2008-11-07 22:27:23 +03:00
|
|
|
connection_update,
|
|
|
|
display);
|
2008-10-08 21:32:07 +04:00
|
|
|
|
|
|
|
return display;
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_display_destroy(struct wl_display *display)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_connection_destroy(display->connection);
|
|
|
|
close(display->fd);
|
|
|
|
free(display);
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT int
|
2008-11-07 22:27:23 +03:00
|
|
|
wl_display_get_fd(struct wl_display *display,
|
|
|
|
wl_display_update_func_t update, void *data)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-11-07 22:27:23 +03:00
|
|
|
display->update = update;
|
|
|
|
display->update_data = data;
|
|
|
|
|
|
|
|
display->update(display->mask, display->update_data);
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
return display->fd;
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-11-26 06:40:39 +03:00
|
|
|
handle_event(struct wl_display *display,
|
2008-12-23 02:06:49 +03:00
|
|
|
uint32_t id, uint32_t opcode, uint32_t size)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-12-22 04:25:16 +03:00
|
|
|
uint32_t p[32];
|
2008-12-30 19:03:33 +03:00
|
|
|
struct wl_listener *listener;
|
|
|
|
struct wl_proxy *proxy;
|
2008-10-07 18:10:36 +04:00
|
|
|
|
2008-11-02 18:55:25 +03:00
|
|
|
wl_connection_copy(display->connection, p, size);
|
2008-12-25 03:30:25 +03:00
|
|
|
if (id == 1)
|
2008-12-30 19:03:33 +03:00
|
|
|
proxy = &display->proxy;
|
2008-12-25 03:30:25 +03:00
|
|
|
else
|
2010-08-13 18:39:57 +04:00
|
|
|
proxy = wl_hash_table_lookup(display->objects, id);
|
2008-12-30 19:03:33 +03:00
|
|
|
|
2010-08-17 21:50:06 +04:00
|
|
|
if (proxy != NULL)
|
|
|
|
wl_list_for_each(listener, &proxy->listener_list, link)
|
|
|
|
wl_connection_demarshal(display->connection,
|
|
|
|
size,
|
|
|
|
display->objects,
|
|
|
|
listener->implementation[opcode],
|
|
|
|
listener->data,
|
|
|
|
&proxy->base,
|
|
|
|
&proxy->base.interface->events[opcode]);
|
2008-12-25 03:30:25 +03:00
|
|
|
|
2008-11-02 18:55:25 +03:00
|
|
|
wl_connection_consume(display->connection, size);
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
2008-11-08 23:39:41 +03:00
|
|
|
WL_EXPORT void
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_display_iterate(struct wl_display *display, uint32_t mask)
|
2008-10-07 18:10:36 +04:00
|
|
|
{
|
2008-11-26 06:40:39 +03:00
|
|
|
uint32_t p[2], object, opcode, size;
|
2008-10-07 18:10:36 +04:00
|
|
|
int len;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
len = wl_connection_data(display->connection, mask);
|
2008-10-07 18:10:36 +04:00
|
|
|
while (len > 0) {
|
2008-10-08 21:32:07 +04:00
|
|
|
if (len < sizeof p)
|
2008-10-07 18:10:36 +04:00
|
|
|
break;
|
|
|
|
|
2008-10-08 21:32:07 +04:00
|
|
|
wl_connection_copy(display->connection, p, sizeof p);
|
2008-11-26 06:40:39 +03:00
|
|
|
object = p[0];
|
2008-10-07 18:10:36 +04:00
|
|
|
opcode = p[1] & 0xffff;
|
|
|
|
size = p[1] >> 16;
|
2008-10-08 21:32:07 +04:00
|
|
|
if (len < size)
|
2008-10-07 18:10:36 +04:00
|
|
|
break;
|
|
|
|
|
2008-11-26 06:40:39 +03:00
|
|
|
handle_event(display, object, opcode, size);
|
2008-11-02 18:12:29 +03:00
|
|
|
len -= size;
|
2008-10-07 18:10:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (len < 0) {
|
|
|
|
fprintf(stderr, "read error: %m\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-24 07:41:08 +03:00
|
|
|
WL_EXPORT uint32_t
|
|
|
|
wl_display_allocate_id(struct wl_display *display)
|
|
|
|
{
|
2008-12-22 06:45:33 +03:00
|
|
|
if (display->id_count == 0) {
|
|
|
|
display->id_count = 256;
|
|
|
|
display->id = display->next_range;
|
|
|
|
}
|
|
|
|
|
|
|
|
display->id_count--;
|
|
|
|
|
2008-11-24 07:41:08 +03:00
|
|
|
return display->id++;
|
|
|
|
}
|
|
|
|
|
2009-09-18 17:49:21 +04:00
|
|
|
WL_EXPORT void
|
|
|
|
wl_surface_set_user_data(struct wl_surface *surface, void *user_data)
|
|
|
|
{
|
2010-08-10 22:02:48 +04:00
|
|
|
struct wl_proxy *proxy = (struct wl_proxy *) surface;
|
|
|
|
|
|
|
|
proxy->user_data = user_data;
|
2009-09-18 17:49:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
WL_EXPORT void *
|
|
|
|
wl_surface_get_user_data(struct wl_surface *surface)
|
|
|
|
{
|
2010-08-10 22:02:48 +04:00
|
|
|
struct wl_proxy *proxy = (struct wl_proxy *) surface;
|
|
|
|
|
|
|
|
return proxy->user_data;
|
2009-09-18 17:49:21 +04:00
|
|
|
}
|