mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-25 06:59:46 -05:00
Extent frame event to be surface dependent
This commit is contained in:
parent
9061f91eb8
commit
94fcdde0e2
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>
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ struct wl_frame_handler {
|
|||
wl_display_frame_func_t func;
|
||||
uint32_t key;
|
||||
void *data;
|
||||
struct wl_surface *surface;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
|
|
@ -303,7 +304,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;
|
||||
}
|
||||
|
|
@ -435,6 +437,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;
|
||||
|
|
@ -446,9 +449,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;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ struct wl_frame_listener {
|
|||
struct wl_resource resource;
|
||||
struct wl_client *client;
|
||||
uint32_t key;
|
||||
struct wl_surface *surface;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
|
|
@ -480,7 +481,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;
|
||||
|
||||
|
|
@ -496,6 +499,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);
|
||||
}
|
||||
|
|
@ -593,11 +597,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);
|
||||
|
|
|
|||
|
|
@ -214,7 +214,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