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.
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 366f2e0..5d003a9 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -1621,7 +1621,7 @@
}
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 @@
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 @@
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 @@
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);