diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-04-11 16:40:48 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-04-11 16:40:48 -0400 |
commit | 4378a80b083f6ad3c5a3eaadd6f55eb14740dbbf (patch) | |
tree | 2363fda07fe6f94275ee76e4c5b2deacd5b33ab7 | |
parent | 7cfcdc610db4c5ef57ea282bff8b2a5406ac3662 (diff) | |
parent | 94fcdde0e25ffb737734e9a696814308bcb23576 (diff) |
Merge remote-tracking branch 'bnf/surface-frame-event'
-rw-r--r-- | protocol/wayland.xml | 1 | ||||
-rw-r--r-- | wayland/wayland-client.c | 8 | ||||
-rw-r--r-- | wayland/wayland-client.h | 4 | ||||
-rw-r--r-- | wayland/wayland-server.c | 11 | ||||
-rw-r--r-- | wayland/wayland-server.h | 3 |
5 files changed, 21 insertions, 6 deletions
diff --git a/protocol/wayland.xml b/protocol/wayland.xml index 88c5a32..486cc0c 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -18,6 +18,7 @@ animations. The notification will only be posted for one frame unless requested again. --> <request name="frame"> + <arg name="surface" type="object" interface="surface"/> <arg name="key" type="uint"/> </request> diff --git a/wayland/wayland-client.c b/wayland/wayland-client.c index adfaf8f..da89b5b 100644 --- a/wayland/wayland-client.c +++ b/wayland/wayland-client.c @@ -62,6 +62,7 @@ struct wl_frame_handler { wl_display_frame_func_t func; uint32_t key; void *data; + struct wl_surface *surface; struct wl_list link; }; @@ -304,7 +305,8 @@ display_handle_key(void *data, if (!wl_list_empty(&display->frame_list) && frame_handler->key == key) { wl_list_remove(&frame_handler->link); - frame_handler->func(frame_handler->data, time); + frame_handler->func(frame_handler->surface, + frame_handler->data, time); free(frame_handler); return; } @@ -468,6 +470,7 @@ wl_display_sync_callback(struct wl_display *display, WL_EXPORT int wl_display_frame_callback(struct wl_display *display, + struct wl_surface *surface, wl_display_frame_func_t func, void *data) { struct wl_frame_handler *handler; @@ -479,9 +482,10 @@ wl_display_frame_callback(struct wl_display *display, handler->func = func; handler->key = display->key++; handler->data = data; + handler->surface = surface; wl_list_insert(display->frame_list.prev, &handler->link); - wl_display_frame(display, handler->key); + wl_display_frame(display, handler->surface, handler->key); return 0; } diff --git a/wayland/wayland-client.h b/wayland/wayland-client.h index d207b07..1064a3a 100644 --- a/wayland/wayland-client.h +++ b/wayland/wayland-client.h @@ -35,7 +35,8 @@ extern "C" { typedef int (*wl_display_update_func_t)(uint32_t mask, void *data); typedef void (*wl_display_sync_func_t)(void *data); -typedef void (*wl_display_frame_func_t)(void *data, uint32_t time); +typedef void (*wl_display_frame_func_t)(struct wl_surface *surface, + void *data, uint32_t time); struct wl_display *wl_display_connect(const char *name); void wl_display_destroy(struct wl_display *display); @@ -46,6 +47,7 @@ void wl_display_iterate(struct wl_display *display, uint32_t mask); int wl_display_sync_callback(struct wl_display *display, wl_display_sync_func_t func, void *data); int wl_display_frame_callback(struct wl_display *display, + struct wl_surface *surface, wl_display_frame_func_t func, void *data); struct wl_global_listener; diff --git a/wayland/wayland-server.c b/wayland/wayland-server.c index 222014a..549e069 100644 --- a/wayland/wayland-server.c +++ b/wayland/wayland-server.c @@ -74,6 +74,7 @@ struct wl_frame_listener { struct wl_resource resource; struct wl_client *client; uint32_t key; + struct wl_surface *surface; struct wl_list link; }; @@ -489,7 +490,9 @@ destroy_frame_listener(struct wl_resource *resource, struct wl_client *client) static void display_frame(struct wl_client *client, - struct wl_display *display, uint32_t key) + struct wl_display *display, + struct wl_surface *surface, + uint32_t key) { struct wl_frame_listener *listener; @@ -505,6 +508,7 @@ display_frame(struct wl_client *client, listener->resource.object.id = 0; listener->client = client; listener->key = key; + listener->surface = surface; wl_list_insert(client->resource_list.prev, &listener->resource.link); wl_list_insert(display->frame_list.prev, &listener->link); } @@ -604,11 +608,14 @@ wl_display_add_global(struct wl_display *display, } WL_EXPORT void -wl_display_post_frame(struct wl_display *display, uint32_t time) +wl_display_post_frame(struct wl_display *display, struct wl_surface *surface, + uint32_t time) { struct wl_frame_listener *listener, *next; wl_list_for_each_safe(listener, next, &display->frame_list, link) { + if (listener->surface != surface) + continue; wl_client_post_event(listener->client, &display->object, WL_DISPLAY_KEY, listener->key, time); wl_resource_destroy(&listener->resource, listener->client); diff --git a/wayland/wayland-server.h b/wayland/wayland-server.h index 23a6dff..8032866 100644 --- a/wayland/wayland-server.h +++ b/wayland/wayland-server.h @@ -215,7 +215,8 @@ wl_display_set_compositor(struct wl_display *display, const struct wl_compositor_interface *implementation); void -wl_display_post_frame(struct wl_display *display, uint32_t msecs); +wl_display_post_frame(struct wl_display *display, struct wl_surface *surface, + uint32_t msecs); void wl_client_add_resource(struct wl_client *client, |