mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-07 13:29:55 -05:00
Merge remote-tracking branch 'bnf/surface-frame-event'
This commit is contained in:
commit
4378a80b08
5 changed files with 21 additions and 6 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue