mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 01:36:10 -05:00
wayland: Clean up the parallels between creating callbacks and surface extensions
This commit is contained in:
parent
9edff6f250
commit
a09fa3b0e4
@ -172,11 +172,8 @@ meta_wayland_surface_frame (struct wl_client *client,
|
|||||||
|
|
||||||
callback = g_slice_new0 (MetaWaylandFrameCallback);
|
callback = g_slice_new0 (MetaWaylandFrameCallback);
|
||||||
callback->compositor = surface->compositor;
|
callback->compositor = surface->compositor;
|
||||||
callback->resource = wl_resource_create (client,
|
callback->resource = wl_resource_create (client, &wl_callback_interface, META_WL_CALLBACK_VERSION, callback_id);
|
||||||
&wl_callback_interface, 1,
|
wl_resource_set_implementation (callback->resource, NULL, callback, destroy_frame_callback);
|
||||||
callback_id);
|
|
||||||
wl_resource_set_user_data (callback->resource, callback);
|
|
||||||
wl_resource_set_destructor (callback->resource, destroy_frame_callback);
|
|
||||||
|
|
||||||
wl_list_insert (surface->pending.frame_callback_list.prev, &callback->link);
|
wl_list_insert (surface->pending.frame_callback_list.prev, &callback->link);
|
||||||
}
|
}
|
||||||
@ -610,7 +607,6 @@ static void
|
|||||||
destroy_surface_extension (MetaWaylandSurfaceExtension *extension)
|
destroy_surface_extension (MetaWaylandSurfaceExtension *extension)
|
||||||
{
|
{
|
||||||
wl_list_remove (&extension->surface_destroy_listener.link);
|
wl_list_remove (&extension->surface_destroy_listener.link);
|
||||||
extension->surface_destroy_listener.notify = NULL;
|
|
||||||
extension->resource = NULL;
|
extension->resource = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,17 +636,15 @@ create_surface_extension (MetaWaylandSurfaceExtension *extension,
|
|||||||
const void *implementation,
|
const void *implementation,
|
||||||
wl_resource_destroy_func_t destructor)
|
wl_resource_destroy_func_t destructor)
|
||||||
{
|
{
|
||||||
struct wl_resource *resource;
|
|
||||||
|
|
||||||
if (extension->resource != NULL)
|
if (extension->resource != NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
resource = wl_resource_create (client, interface, get_resource_version (master_resource, max_version), id);
|
extension->resource = wl_resource_create (client, interface, get_resource_version (master_resource, max_version), id);
|
||||||
wl_resource_set_implementation (resource, implementation, extension, destructor);
|
wl_resource_set_implementation (extension->resource, implementation, extension, destructor);
|
||||||
|
|
||||||
extension->resource = resource;
|
|
||||||
extension->surface_destroy_listener.notify = extension_handle_surface_destroy;
|
extension->surface_destroy_listener.notify = extension_handle_surface_destroy;
|
||||||
wl_resource_add_destroy_listener (surface_resource, &extension->surface_destroy_listener);
|
wl_resource_add_destroy_listener (surface_resource, &extension->surface_destroy_listener);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user