mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-09 13:29:48 -05:00
Consolidate 'sync' and 'frame' events into just one 'key' event
This commit is contained in:
parent
ac93a3d3d7
commit
c1ad1f9c9b
3 changed files with 26 additions and 41 deletions
|
|
@ -58,19 +58,12 @@
|
||||||
<arg name="base" type="uint"/>
|
<arg name="base" type="uint"/>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
<!-- A reply to the sync request. All requests made before the
|
<!-- A reply to the frame or sync request. The key is the one
|
||||||
"sync" request that had the same key as the one present in
|
used in the request. time is in millisecond units, and
|
||||||
this event have been processed by the server. -->
|
denotes the time when the frame was posted on the
|
||||||
<event name="sync">
|
display. time can be used to estimaate frame rate, determine
|
||||||
<arg name="key" type="uint"/>
|
how much to advance animations and compensate for jitter. -->
|
||||||
</event>
|
<event name="key">
|
||||||
|
|
||||||
<!-- A reply to the frame request. The key is the one used in the
|
|
||||||
request. time is in millisecond units, and denotes the time
|
|
||||||
when the frame was posted on the display. time can be used to
|
|
||||||
estimaate frame rate, determine how much to advance
|
|
||||||
animatiosn and compoensate for jitter-->
|
|
||||||
<event name="frame">
|
|
||||||
<arg name="key" type="uint"/>
|
<arg name="key" type="uint"/>
|
||||||
<arg name="time" type="uint"/>
|
<arg name="time" type="uint"/>
|
||||||
</event>
|
</event>
|
||||||
|
|
|
||||||
|
|
@ -292,38 +292,31 @@ display_handle_range(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
display_handle_sync(void *data, struct wl_display *display, uint32_t key)
|
display_handle_key(void *data,
|
||||||
|
struct wl_display *display, uint32_t key, uint32_t time)
|
||||||
{
|
{
|
||||||
struct wl_sync_handler *handler;
|
struct wl_sync_handler *sync_handler;
|
||||||
|
struct wl_frame_handler *frame_handler;
|
||||||
|
|
||||||
handler = container_of(display->sync_list.next,
|
sync_handler = container_of(display->sync_list.next,
|
||||||
struct wl_sync_handler, link);
|
struct wl_sync_handler, link);
|
||||||
if (handler->key != key) {
|
if (sync_handler->key == key) {
|
||||||
fprintf(stderr, "unsolicited sync event, client gone?\n");
|
wl_list_remove(&sync_handler->link);
|
||||||
|
sync_handler->func(sync_handler->data);
|
||||||
|
free(sync_handler);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_remove(&handler->link);
|
frame_handler = container_of(display->frame_list. next,
|
||||||
handler->func(handler->data);
|
struct wl_frame_handler, link);
|
||||||
free(handler);
|
if (frame_handler->key == key) {
|
||||||
}
|
wl_list_remove(&frame_handler->link);
|
||||||
|
frame_handler->func(frame_handler->data, time);
|
||||||
static void
|
free(frame_handler);
|
||||||
display_handle_frame(void *data,
|
|
||||||
struct wl_display *display, uint32_t key, uint32_t time)
|
|
||||||
{
|
|
||||||
struct wl_frame_handler *handler;
|
|
||||||
|
|
||||||
handler = container_of(display->frame_list. next,
|
|
||||||
struct wl_frame_handler, link);
|
|
||||||
if (handler->key != key) {
|
|
||||||
fprintf(stderr, "unsolicited frame event, client gone?\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_remove(&handler->link);
|
fprintf(stderr, "unsolicited sync event, client gone?\n");
|
||||||
handler->func(handler->data, time);
|
|
||||||
free(handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_display_listener display_listener = {
|
static const struct wl_display_listener display_listener = {
|
||||||
|
|
@ -332,8 +325,7 @@ static const struct wl_display_listener display_listener = {
|
||||||
display_handle_no_memory,
|
display_handle_no_memory,
|
||||||
display_handle_global,
|
display_handle_global,
|
||||||
display_handle_range,
|
display_handle_range,
|
||||||
display_handle_sync,
|
display_handle_key
|
||||||
display_handle_frame
|
|
||||||
};
|
};
|
||||||
|
|
||||||
WL_EXPORT struct wl_display *
|
WL_EXPORT struct wl_display *
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ static void
|
||||||
display_sync(struct wl_client *client,
|
display_sync(struct wl_client *client,
|
||||||
struct wl_display *display, uint32_t key)
|
struct wl_display *display, uint32_t key)
|
||||||
{
|
{
|
||||||
wl_client_post_event(client, &display->base, WL_DISPLAY_SYNC, key);
|
wl_client_post_event(client, &display->base, WL_DISPLAY_KEY, key, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -421,7 +421,7 @@ wl_display_post_frame(struct wl_display *display, uint32_t time)
|
||||||
|
|
||||||
wl_list_for_each_safe(listener, next, &display->frame_list, link) {
|
wl_list_for_each_safe(listener, next, &display->frame_list, link) {
|
||||||
wl_client_post_event(listener->client, &display->base,
|
wl_client_post_event(listener->client, &display->base,
|
||||||
WL_DISPLAY_FRAME, listener->key, time);
|
WL_DISPLAY_KEY, listener->key, time);
|
||||||
wl_resource_destroy(&listener->resource, listener->client);
|
wl_resource_destroy(&listener->resource, listener->client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue