diff --git a/protocol/wayland.xml b/protocol/wayland.xml index 6cdfe8f1..24c53c29 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -58,19 +58,12 @@ - - - - - - - + + diff --git a/wayland/wayland-client.c b/wayland/wayland-client.c index 9715307b..9c40d345 100644 --- a/wayland/wayland-client.c +++ b/wayland/wayland-client.c @@ -292,38 +292,31 @@ display_handle_range(void *data, } 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; - - handler = container_of(display->sync_list.next, - struct wl_sync_handler, link); - if (handler->key != key) { - fprintf(stderr, "unsolicited sync event, client gone?\n"); + struct wl_sync_handler *sync_handler; + struct wl_frame_handler *frame_handler; + + sync_handler = container_of(display->sync_list.next, + struct wl_sync_handler, link); + if (sync_handler->key == key) { + wl_list_remove(&sync_handler->link); + sync_handler->func(sync_handler->data); + free(sync_handler); return; } - wl_list_remove(&handler->link); - handler->func(handler->data); - free(handler); -} - -static void -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"); + frame_handler = container_of(display->frame_list. next, + struct wl_frame_handler, link); + if (frame_handler->key == key) { + wl_list_remove(&frame_handler->link); + frame_handler->func(frame_handler->data, time); + free(frame_handler); return; } - wl_list_remove(&handler->link); - handler->func(handler->data, time); - free(handler); + fprintf(stderr, "unsolicited sync event, client gone?\n"); } 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_global, display_handle_range, - display_handle_sync, - display_handle_frame + display_handle_key }; WL_EXPORT struct wl_display * diff --git a/wayland/wayland-server.c b/wayland/wayland-server.c index 3ddfc335..0b4480bf 100644 --- a/wayland/wayland-server.c +++ b/wayland/wayland-server.c @@ -305,7 +305,7 @@ static void display_sync(struct wl_client *client, 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 @@ -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_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); } }