Change weston_surface.resource to a wl_resource pointer.

This is the first in what will be a series of weston patches to convert
instances of wl_resource to pointers so we can make wl_resource opaque.
This patch handles weston_surface and should be the most invasive of the
entire series.  I am sending this one out ahead of the rest for review.

Specifically, my machine is not set up to build XWayland so I have no
ability to test it fully.  Could someone please test with XWayland and let
me know if this causes problems?

Because a surface may be created from XWayland, the resource may not always
exist.  Therefore, a destroy signal was added to weston_surface and
everything used to listen to surface->resource.destroy_signal now listens
to surface->destroy_signal.
This commit is contained in:
Jason Ekstrand
2013-06-06 22:34:41 -05:00
committed by Kristian Høgsberg
parent a2ce68fd03
commit 26ed73cee8
10 changed files with 73 additions and 69 deletions
+6 -6
View File
@@ -1621,7 +1621,7 @@ weston_wm_create(struct weston_xserver *wxs)
}
xserver_send_client(wxs->resource, sv[1]);
wl_client_flush(wxs->resource->client);
wl_client_flush(wl_resource_get_client(wxs->resource));
close(sv[1]);
/* xcb_connect_to_fd takes ownership of the fd. */
@@ -1715,10 +1715,9 @@ surface_destroy(struct wl_listener *listener, void *data)
static struct weston_wm_window *
get_wm_window(struct weston_surface *surface)
{
struct wl_resource *resource = &surface->resource;
struct wl_listener *listener;
listener = wl_signal_get(&resource->destroy_signal, surface_destroy);
listener = wl_signal_get(&surface->destroy_signal, surface_destroy);
if (listener)
return container_of(listener, struct weston_wm_window,
surface_destroy_listener);
@@ -1850,9 +1849,10 @@ static void
xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *surface_resource, uint32_t id)
{
struct weston_xserver *wxs = resource->data;
struct weston_xserver *wxs = wl_resource_get_user_data(resource);
struct weston_wm *wm = wxs->wm;
struct weston_surface *surface = surface_resource->data;
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
struct weston_wm_window *window;
if (client != wxs->client)
@@ -1870,7 +1870,7 @@ xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
window->surface = (struct weston_surface *) surface;
window->surface_destroy_listener.notify = surface_destroy;
wl_signal_add(&surface->resource.destroy_signal,
wl_signal_add(&surface->destroy_signal,
&window->surface_destroy_listener);
weston_wm_window_schedule_repaint(window);