wayland: Clean up surface creation

This commit is contained in:
Jasper St. Pierre 2014-04-22 18:22:13 -04:00
parent 0bf5c831d5
commit 59fc9d832b
3 changed files with 12 additions and 15 deletions

View File

@ -569,14 +569,15 @@ wl_surface_destructor (struct wl_resource *resource)
MetaWaylandSurface * MetaWaylandSurface *
meta_wayland_surface_create (MetaWaylandCompositor *compositor, meta_wayland_surface_create (MetaWaylandCompositor *compositor,
struct wl_client *client, struct wl_client *client,
guint32 id, struct wl_resource *compositor_resource,
guint32 version) guint32 id)
{ {
MetaWaylandSurface *surface = g_slice_new0 (MetaWaylandSurface); MetaWaylandSurface *surface = g_slice_new0 (MetaWaylandSurface);
surface->compositor = compositor; surface->compositor = compositor;
surface->resource = wl_resource_create (client, &wl_surface_interface, version, id); surface->resource = wl_resource_create (client, &wl_surface_interface,
MIN (META_WL_SURFACE_VERSION, wl_resource_get_version (compositor_resource)), id);
wl_resource_set_implementation (surface->resource, &meta_wayland_wl_surface_interface, surface, wl_surface_destructor); wl_resource_set_implementation (surface->resource, &meta_wayland_wl_surface_interface, surface, wl_surface_destructor);
surface->buffer_destroy_listener.notify = surface_handle_buffer_destroy; surface->buffer_destroy_listener.notify = surface_handle_buffer_destroy;

View File

@ -116,8 +116,8 @@ void meta_wayland_shell_init (MetaWaylandCompositor *composit
MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *compositor, MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *compositor,
struct wl_client *client, struct wl_client *client,
guint32 id, struct wl_resource *compositor_resource,
guint32 version); guint32 id);
void meta_wayland_surface_set_window (MetaWaylandSurface *surface, void meta_wayland_surface_set_window (MetaWaylandSurface *surface,
MetaWindow *window); MetaWindow *window);
@ -139,5 +139,4 @@ void meta_wayland_surface_delete (MetaWaylandSurface *surface);
void meta_wayland_surface_popup_done (MetaWaylandSurface *surface); void meta_wayland_surface_popup_done (MetaWaylandSurface *surface);
#endif #endif

View File

@ -199,16 +199,13 @@ meta_wayland_compositor_repick (MetaWaylandCompositor *compositor)
} }
static void static void
meta_wayland_compositor_create_surface (struct wl_client *wayland_client, meta_wayland_compositor_create_surface (struct wl_client *client,
struct wl_resource *wayland_compositor_resource, struct wl_resource *resource,
guint32 id) guint32 id)
{ {
MetaWaylandCompositor *compositor = MetaWaylandCompositor *compositor = wl_resource_get_user_data (resource);
wl_resource_get_user_data (wayland_compositor_resource);
meta_wayland_surface_create (compositor, wayland_client, id, meta_wayland_surface_create (compositor, client, resource, id);
MIN (META_WL_SURFACE_VERSION,
wl_resource_get_version (wayland_compositor_resource)));
} }
static void static void