Add a new client that draws a pointer.

This commit is contained in:
Kristian Høgsberg 2008-11-02 10:55:25 -05:00
parent e120a4b1ee
commit 5a27f3e6a7
5 changed files with 195 additions and 8 deletions

View file

@ -25,6 +25,9 @@ struct wl_display {
struct wl_connection *connection;
int fd;
uint32_t id;
wl_display_event_func_t event_handler;
void *event_handler_data;
};
struct wl_surface {
@ -96,14 +99,15 @@ wl_display_get_fd(struct wl_display *display)
}
static void
handle_event(struct wl_connection *connection, uint32_t opcode, uint32_t size)
handle_event(struct wl_display *display, uint32_t opcode, uint32_t size)
{
uint32_t p[4];
wl_connection_copy(connection, p, size);
printf("signal from object %d, opcode %d, size %d, args: %d, %d\n",
p[0], opcode, size, p[2], p[3]);
wl_connection_consume(connection, size);
wl_connection_copy(display->connection, p, size);
if (display->event_handler != NULL)
display->event_handler(display, opcode, p[2], p[3],
display->event_handler_data);
wl_connection_consume(display->connection, size);
}
void
@ -123,7 +127,7 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
if (len < size)
break;
handle_event(display->connection, opcode, size);
handle_event(display, opcode, size);
len -= size;
}
@ -133,6 +137,16 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
}
}
void
wl_display_set_event_handler(struct wl_display *display,
wl_display_event_func_t handler,
void *data)
{
/* FIXME: This needs something more generic... */
display->event_handler = handler;
display->event_handler_data = data;
}
#define WL_DISPLAY_CREATE_SURFACE 0
struct wl_surface *