-CFLAGS = -Wall -g
+CFLAGS = -Wall -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden
PKG_CONFIG_PATH ?= $(HOME)/install/lib/pkgconfig
static const char gem_device[] = "/dev/dri/card0";
-struct wl_compositor *
+WL_EXPORT struct wl_compositor *
wl_compositor_create(struct wl_display *display)
{
EGLConfig configs[64];
void *data;
};
-struct wl_event_source *
+WL_EXPORT struct wl_event_source *
wl_event_loop_add_fd(struct wl_event_loop *loop,
int fd, uint32_t mask,
wl_event_loop_fd_func_t func,
struct wl_event_source idle_source;
-int
+WL_EXPORT int
wl_event_loop_remove_source(struct wl_event_loop *loop,
struct wl_event_source *source)
{
};
}
-int
+WL_EXPORT int
wl_event_loop_update_source(struct wl_event_loop *loop,
struct wl_event_source *source,
uint32_t mask)
EPOLL_CTL_MOD, source->fd, &ep);
}
-struct wl_event_loop *
+WL_EXPORT struct wl_event_loop *
wl_event_loop_create(void)
{
struct wl_event_loop *loop;
return loop;
}
-void
+WL_EXPORT void
wl_event_loop_destroy(struct wl_event_loop *loop)
{
close(loop->epoll_fd);
free(loop);
}
-struct wl_event_source *
+WL_EXPORT struct wl_event_source *
wl_event_loop_add_idle(struct wl_event_loop *loop,
wl_event_loop_idle_func_t func,
void *data)
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
-int
+WL_EXPORT int
wl_event_loop_wait(struct wl_event_loop *loop)
{
struct epoll_event ep[32];
}
}
-struct wl_compositor *
+WL_EXPORT struct wl_compositor *
wl_compositor_create(struct wl_display *display)
{
static int attribs[] = {
return 0;
}
-struct wl_display *
+WL_EXPORT struct wl_display *
wl_display_create(const char *address)
{
struct wl_display *display;
return display;
}
-void
+WL_EXPORT void
wl_display_destroy(struct wl_display *display)
{
wl_connection_destroy(display->connection);
free(display);
}
-int
+WL_EXPORT int
wl_display_get_fd(struct wl_display *display,
wl_display_update_func_t update, void *data)
{
wl_connection_consume(display->connection, size);
}
-void
+WL_EXPORT void
wl_display_iterate(struct wl_display *display, uint32_t mask)
{
uint32_t p[2], opcode, size;
}
}
-void
+WL_EXPORT void
wl_display_set_event_handler(struct wl_display *display,
wl_display_event_func_t handler,
void *data)
#define WL_DISPLAY_CREATE_SURFACE 0
-struct wl_surface *
+WL_EXPORT struct wl_surface *
wl_display_create_surface(struct wl_display *display)
{
struct wl_surface *surface;
#define WL_SURFACE_COPY 3
#define WL_SURFACE_DAMAGE 4
-void wl_surface_destroy(struct wl_surface *surface)
+WL_EXPORT void
+wl_surface_destroy(struct wl_surface *surface)
{
uint32_t request[2];
request, sizeof request);
}
-void wl_surface_attach(struct wl_surface *surface, uint32_t name,
- int32_t width, int32_t height, uint32_t stride)
+WL_EXPORT void
+wl_surface_attach(struct wl_surface *surface, uint32_t name,
+ int32_t width, int32_t height, uint32_t stride)
{
uint32_t request[6];
request, sizeof request);
}
-void wl_surface_map(struct wl_surface *surface,
- int32_t x, int32_t y, int32_t width, int32_t height)
+WL_EXPORT void
+wl_surface_map(struct wl_surface *surface,
+ int32_t x, int32_t y, int32_t width, int32_t height)
{
uint32_t request[6];
request, sizeof request);
}
-void wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y,
- uint32_t name, uint32_t stride,
- int32_t x, int32_t y, int32_t width, int32_t height)
+WL_EXPORT void
+wl_surface_copy(struct wl_surface *surface, int32_t dst_x, int32_t dst_y,
+ uint32_t name, uint32_t stride,
+ int32_t x, int32_t y, int32_t width, int32_t height)
{
uint32_t request[10];
request, sizeof request);
}
-void wl_surface_damage(struct wl_surface *surface,
- int32_t x, int32_t y, int32_t width, int32_t height)
+WL_EXPORT void
+wl_surface_damage(struct wl_surface *surface,
+ int32_t x, int32_t y, int32_t width, int32_t height)
{
uint32_t request[6];
#ifndef _WAYLAND_CLIENT_H
#define _WAYLAND_CLIENT_H
+/* GCC visibility */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define WL_EXPORT __attribute__ ((visibility("default")))
+#else
+#define WL_EXPORT
+#endif
+
struct wl_display;
struct wl_surface;
#include "wayland.h"
#include "connection.h"
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-
-
-struct wl_list {
- struct wl_list *prev;
- struct wl_list *next;
-};
-
void wl_list_init(struct wl_list *list)
{
list->prev = list;
{ WL_ARGUMENT_UINT32 },
};
-void
+static void
wl_surface_map(struct wl_client *client, struct wl_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height)
{
{ WL_ARGUMENT_UINT32 },
};
-void
+static void
wl_surface_copy(struct wl_client *client, struct wl_surface *surface,
int32_t dst_x, int32_t dst_y, uint32_t name, uint32_t stride,
int32_t x, int32_t y, int32_t width, int32_t height)
{ WL_ARGUMENT_UINT32 },
};
-void
+static void
wl_surface_damage(struct wl_client *client, struct wl_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height)
{
surface_methods,
};
-struct wl_surface *
+static struct wl_surface *
wl_surface_create(struct wl_display *display, uint32_t id)
{
struct wl_surface *surface;
return surface;
}
-void
+WL_EXPORT void
wl_surface_set_data(struct wl_surface *surface, void *data)
{
surface->compositor_data = data;
}
-void *
+WL_EXPORT void *
wl_surface_get_data(struct wl_surface *surface)
{
return surface->compositor_data;
wl_connection_write(client->connection, pad, -length & 3);
}
-struct wl_client *
+static struct wl_client *
wl_client_create(struct wl_display *display, int fd)
{
struct wl_client *client;
display->pointer_y = 100;
}
-struct wl_display *
+static struct wl_display *
wl_display_create(void)
{
struct wl_display *display;
return display;
}
-void
+static void
wl_display_send_event(struct wl_display *display, uint32_t *data, size_t size)
{
struct wl_client *client;
display->compositor = compositor;
}
-struct wl_event_loop *
+WL_EXPORT struct wl_event_loop *
wl_display_get_event_loop(struct wl_display *display)
{
return display->loop;
}
-void
+static void
wl_display_run(struct wl_display *display)
{
while (1)
wl_client_create(display, client_fd);
}
-int
+static int
wl_display_add_socket(struct wl_display *display)
{
struct sockaddr_un name;
uint32_t mask;
};
-struct wl_surface_iterator *
+WL_EXPORT struct wl_surface_iterator *
wl_surface_iterator_create(struct wl_display *display, uint32_t mask)
{
struct wl_surface_iterator *iterator;
return iterator;
}
-int
+WL_EXPORT int
wl_surface_iterator_next(struct wl_surface_iterator *iterator,
struct wl_surface **surface)
{
return 1;
}
-void
+WL_EXPORT void
wl_surface_iterator_destroy(struct wl_surface_iterator *iterator)
{
free(iterator);
#include <stdint.h>
+/* GCC visibility */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define WL_EXPORT __attribute__ ((visibility("default")))
+#else
+#define WL_EXPORT
+#endif
+
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
+struct wl_list {
+ struct wl_list *prev;
+ struct wl_list *next;
+};
+
+void wl_list_init(struct wl_list *list);
+void wl_list_insert(struct wl_list *list, struct wl_list *elm);
+void wl_list_remove(struct wl_list *elm);
+
enum {
WL_EVENT_READABLE = 0x01,
WL_EVENT_WRITEABLE = 0x02
void wl_display_set_compositor(struct wl_display *display,
struct wl_compositor *compositor);
+struct wl_compositor *
+wl_compositor_create(struct wl_display *display);
#endif
wl_surface_attach(window->surface, buffer->name,
buffer->width, buffer->height, buffer->stride);
+ wl_surface_map(window->surface,
+ window->x, window->y,
+ buffer->width, buffer->height);
+
/* FIXME: Free window->buffer when we receive the ack event. */
buffer = window->egl_buffer;
buffer->name, buffer->stride,
0, 0, buffer->width, buffer->height);
- wl_surface_map(window->surface,
- window->x, window->y,
- buffer->width, buffer->height);
-
window->redraw_scheduled = 0;
return FALSE;