compositor: Adapt to wl_surface going away

struct weston_surface is now the only surface type we have (in core, shell.c
has shell_surface, of course).  A lot of code gets simpler and we never
have to try to guess whether an API takes a wl_surface or a weston_surface.
diff --git a/src/animation.c b/src/animation.c
index 229946f..e947d72 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -186,8 +186,7 @@
 	weston_surface_animation_frame(&animation->animation, NULL, 0);
 
 	animation->listener.notify = handle_animation_surface_destroy;
-	wl_signal_add(&surface->surface.resource.destroy_signal,
-		      &animation->listener);
+	wl_signal_add(&surface->resource.destroy_signal, &animation->listener);
 
 	wl_list_insert(&surface->output->animation_list,
 		       &animation->animation.link);
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 1e02aa1..8f3f2e9 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -381,7 +381,7 @@
 	element->surface = surface;
 	element->surface_destroy_listener.notify =
 		rpi_element_handle_surface_destroy;
-	wl_signal_add(&surface->surface.resource.destroy_signal,
+	wl_signal_add(&surface->resource.destroy_signal,
 		      &element->surface_destroy_listener);
 
 	wl_list_insert(output->element_list.prev, &element->link);
@@ -722,7 +722,7 @@
 	struct wl_listener *listener;
 	struct rpi_element *element;
 
-	listener = wl_signal_get(&surface->surface.resource.destroy_signal,
+	listener = wl_signal_get(&surface->resource.destroy_signal,
 				 rpi_element_handle_surface_destroy);
 	if (!listener)
 		return NULL;
diff --git a/src/compositor.c b/src/compositor.c
index a810fd2..f988a36 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -271,12 +271,12 @@
 	if (surface == NULL)
 		return NULL;
 
-	wl_signal_init(&surface->surface.resource.destroy_signal);
+	wl_signal_init(&surface->resource.destroy_signal);
 
 	wl_list_init(&surface->link);
 	wl_list_init(&surface->layer_link);
 
-	surface->surface.resource.client = NULL;
+	surface->resource.client = NULL;
 
 	surface->compositor = compositor;
 	surface->alpha = 1.0;
@@ -490,10 +490,10 @@
 	uint32_t left = es->output_mask & different;
 	struct weston_output *output;
 	struct wl_resource *resource = NULL;
-	struct wl_client *client = es->surface.resource.client;
+	struct wl_client *client = es->resource.client;
 
 	es->output_mask = mask;
-	if (es->surface.resource.client == NULL)
+	if (es->resource.client == NULL)
 		return;
 	if (different == 0)
 		return;
@@ -506,9 +506,9 @@
 		if (resource == NULL)
 			continue;
 		if (1 << output->id & entered)
-			wl_surface_send_enter(&es->surface.resource, resource);
+			wl_surface_send_enter(&es->resource, resource);
 		if (1 << output->id & left)
-			wl_surface_send_leave(&es->surface.resource, resource);
+			wl_surface_send_leave(&es->resource, resource);
 	}
 }
 
@@ -849,7 +849,7 @@
 	surface->geometry.parent_destroy_listener.notify =
 		transform_parent_handle_parent_destroy;
 	if (parent) {
-		wl_signal_add(&parent->surface.resource.destroy_signal,
+		wl_signal_add(&parent->resource.destroy_signal,
 			      &surface->geometry.parent_destroy_listener);
 		wl_list_insert(&parent->geometry.child_list,
 			       &surface->geometry.parent_link);
@@ -946,11 +946,9 @@
 	wl_list_remove(&surface->layer_link);
 
 	wl_list_for_each(seat, &surface->compositor->seat_list, link) {
-		if (seat->keyboard &&
-		    seat->keyboard->focus == &surface->surface)
+		if (seat->keyboard && seat->keyboard->focus == surface)
 			weston_keyboard_set_focus(seat->keyboard, NULL);
-		if (seat->pointer &&
-		    seat->pointer->focus == &surface->surface)
+		if (seat->pointer && seat->pointer->focus == surface)
 			weston_pointer_set_focus(seat->pointer,
 						 NULL,
 						 wl_fixed_from_int(0),
@@ -969,8 +967,7 @@
 destroy_surface(struct wl_resource *resource)
 {
 	struct weston_surface *surface =
-		container_of(resource,
-			     struct weston_surface, surface.resource);
+		container_of(resource, struct weston_surface, resource);
 	struct weston_compositor *compositor = surface->compositor;
 	struct weston_frame_callback *cb, *next;
 
@@ -1012,11 +1009,10 @@
 weston_surface_destroy(struct weston_surface *surface)
 {
 	/* Not a valid way to destroy a client surface */
-	assert(surface->surface.resource.client == NULL);
+	assert(surface->resource.client == NULL);
 
-	wl_signal_emit(&surface->surface.resource.destroy_signal,
-		       &surface->surface.resource);
-	destroy_surface(&surface->surface.resource);
+	wl_signal_emit(&surface->resource.destroy_signal, &surface->resource);
+	destroy_surface(&surface->resource);
 }
 
 static void
@@ -1532,15 +1528,15 @@
 		return;
 	}
 
-	surface->surface.resource.destroy = destroy_surface;
+	surface->resource.destroy = destroy_surface;
 
-	surface->surface.resource.object.id = id;
-	surface->surface.resource.object.interface = &wl_surface_interface;
-	surface->surface.resource.object.implementation =
+	surface->resource.object.id = id;
+	surface->resource.object.interface = &wl_surface_interface;
+	surface->resource.object.implementation =
 		(void (**)(void)) &surface_interface;
-	surface->surface.resource.data = surface;
+	surface->resource.data = surface;
 
-	wl_client_add_resource(client, &surface->surface.resource);
+	wl_client_add_resource(client, &surface->resource);
 }
 
 static void
diff --git a/src/compositor.h b/src/compositor.h
index 68b388a..9525a32 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -211,7 +211,7 @@
 struct weston_pointer_grab;
 struct weston_pointer_grab_interface {
 	void (*focus)(struct weston_pointer_grab *grab,
-		      struct wl_surface *surface,
+		      struct weston_surface *surface,
 		      wl_fixed_t x,
 		      wl_fixed_t y);
 	void (*motion)(struct weston_pointer_grab *grab,
@@ -225,7 +225,7 @@
 struct weston_pointer_grab {
 	const struct weston_pointer_grab_interface *interface;
 	struct weston_pointer *pointer;
-	struct wl_surface *focus;
+	struct weston_surface *focus;
 	wl_fixed_t x, y;
 };
 
@@ -241,7 +241,7 @@
 struct weston_keyboard_grab {
 	const struct weston_keyboard_grab_interface *interface;
 	struct weston_keyboard *keyboard;
-	struct wl_surface *focus;
+	struct weston_surface *focus;
 	uint32_t key;
 };
 
@@ -265,7 +265,7 @@
 struct weston_touch_grab {
 	const struct weston_touch_grab_interface *interface;
 	struct weston_touch *touch;
-	struct wl_surface *focus;
+	struct weston_surface *focus;
 };
 
 struct wl_data_offer {
@@ -289,7 +289,7 @@
 	struct weston_seat *seat;
 
 	struct wl_list resource_list;
-	struct wl_surface *focus;
+	struct weston_surface *focus;
 	struct wl_resource *focus_resource;
 	struct wl_listener focus_listener;
 	uint32_t focus_serial;
@@ -303,7 +303,7 @@
 	uint32_t grab_time;
 
 	wl_fixed_t x, y;
-	struct wl_surface *current;
+	struct weston_surface *current;
 	struct wl_listener current_listener;
 	wl_fixed_t current_x, current_y;
 
@@ -315,7 +315,7 @@
 	struct weston_seat *seat;
 
 	struct wl_list resource_list;
-	struct wl_surface *focus;
+	struct weston_surface *focus;
 	struct wl_resource *focus_resource;
 	struct wl_listener focus_listener;
 	uint32_t focus_serial;
@@ -334,7 +334,7 @@
 weston_pointer_destroy(struct weston_pointer *pointer);
 void
 weston_pointer_set_focus(struct weston_pointer *pointer,
-			 struct wl_surface *surface,
+			 struct weston_surface *surface,
 			 wl_fixed_t sx, wl_fixed_t sy);
 void
 weston_pointer_start_grab(struct weston_pointer *pointer,
@@ -343,7 +343,7 @@
 weston_pointer_end_grab(struct weston_pointer *pointer);
 void
 weston_pointer_set_current(struct weston_pointer *pointer,
-			   struct wl_surface *surface);
+			   struct weston_surface *surface);
 
 struct weston_keyboard *
 weston_keyboard_create(void);
@@ -351,7 +351,7 @@
 weston_keyboard_destroy(struct weston_keyboard *keyboard);
 void
 weston_keyboard_set_focus(struct weston_keyboard *keyboard,
-			  struct wl_surface *surface);
+			  struct weston_surface *surface);
 void
 weston_keyboard_start_grab(struct weston_keyboard *device,
 			   struct weston_keyboard_grab *grab);
@@ -401,7 +401,7 @@
 	struct weston_seat *seat;
 
 	struct wl_list resource_list;
-	struct wl_surface *focus;
+	struct weston_surface *focus;
 	struct wl_resource *focus_resource;
 	struct wl_listener focus_listener;
 	uint32_t focus_serial;
@@ -441,7 +441,7 @@
 	int32_t hotspot_x, hotspot_y;
 	struct wl_list link;
 	enum weston_keyboard_modifier modifier_state;
-	struct wl_surface *saved_kbd_focus;
+	struct weston_surface *saved_kbd_focus;
 	struct wl_listener saved_kbd_focus_listener;
 
 	uint32_t selection_serial;
@@ -453,7 +453,7 @@
 	struct wl_client *drag_client;
 	struct wl_data_source *drag_data_source;
 	struct wl_listener drag_data_source_listener;
-	struct wl_surface *drag_focus;
+	struct weston_surface *drag_focus;
 	struct wl_resource *drag_focus_resource;
 	struct wl_listener drag_focus_listener;
 	struct weston_pointer_grab drag_grab;
@@ -618,7 +618,7 @@
  */
 
 struct weston_surface {
-	struct wl_surface surface;
+	struct wl_resource resource;
 	struct weston_compositor *compositor;
 	pixman_region32_t clip;
 	pixman_region32_t damage;
diff --git a/src/data-device.c b/src/data-device.c
index ee17f76..c0fb581 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -193,7 +193,7 @@
 			      struct weston_surface *surface)
 {
 	if (surface->configure) {
-		wl_resource_post_error(&surface->surface.resource,
+		wl_resource_post_error(&surface->resource,
 				       WL_DISPLAY_ERROR_INVALID_OBJECT,
 				       "surface->configure already set");
 		return 0;
@@ -206,7 +206,7 @@
 	surface->configure = drag_surface_configure;
 	surface->configure_private = seat;
 
-	wl_signal_add(&surface->surface.resource.destroy_signal,
+	wl_signal_add(&surface->resource.destroy_signal,
 		       &seat->drag_surface_destroy_listener);
 
 	return 1;
@@ -235,7 +235,7 @@
 
 static void
 drag_grab_focus(struct weston_pointer_grab *grab,
-		struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
+		struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
 {
 	struct weston_seat *seat =
 		container_of(grab, struct weston_seat, drag_grab);
diff --git a/src/input.c b/src/input.c
index d0ccc62..5fdf76f 100644
--- a/src/input.c
+++ b/src/input.c
@@ -59,12 +59,11 @@
 						 &pointer->current_x,
 						 &pointer->current_y);
 
-	if (&surface->surface != pointer->current) {
+	if (surface != pointer->current) {
 		interface = pointer->grab->interface;
-		weston_pointer_set_current(pointer, &surface->surface);
-		interface->focus(pointer->grab, &surface->surface,
-				 pointer->current_x,
-				 pointer->current_y);
+		weston_pointer_set_current(pointer, surface);
+		interface->focus(pointer->grab, surface,
+				 pointer->current_x, pointer->current_y);
 	}
 
 	focus = (struct weston_surface *) pointer->grab->focus;
@@ -119,7 +118,7 @@
 
 static void
 default_grab_focus(struct weston_pointer_grab *grab,
-		   struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
+		   struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
 {
 	struct weston_pointer *pointer = grab->pointer;
 
@@ -239,7 +238,7 @@
 }
 
 static struct wl_resource *
-find_resource_for_surface(struct wl_list *list, struct wl_surface *surface)
+find_resource_for_surface(struct wl_list *list, struct weston_surface *surface)
 {
 	struct wl_resource *r;
 
@@ -402,7 +401,7 @@
 
 WL_EXPORT void
 weston_pointer_set_focus(struct weston_pointer *pointer,
-			 struct wl_surface *surface,
+			 struct weston_surface *surface,
 			 wl_fixed_t sx, wl_fixed_t sy)
 {
 	struct weston_keyboard *kbd = pointer->seat->keyboard;
@@ -453,7 +452,7 @@
 
 WL_EXPORT void
 weston_keyboard_set_focus(struct weston_keyboard *keyboard,
-			  struct wl_surface *surface)
+			  struct weston_surface *surface)
 {
 	struct wl_resource *resource;
 	struct wl_display *display;
@@ -545,7 +544,7 @@
 
 WL_EXPORT void
 weston_pointer_set_current(struct weston_pointer *pointer,
-			   struct wl_surface *surface)
+			   struct weston_surface *surface)
 {
 	if (pointer->current)
 		wl_list_remove(&pointer->current_listener.link);
@@ -682,7 +681,7 @@
 	struct weston_compositor *compositor = seat->compositor;
 
 	if (seat->keyboard) {
-		weston_keyboard_set_focus(seat->keyboard, &surface->surface);
+		weston_keyboard_set_focus(seat->keyboard, surface);
 		wl_data_device_set_keyboard_focus(seat);
 	}
 
@@ -927,7 +926,7 @@
 {
 	struct weston_compositor *compositor = seat->compositor;
 	struct weston_keyboard *keyboard = seat->keyboard;
-	struct wl_surface *surface;
+	struct weston_surface *surface;
 	uint32_t *k, serial;
 
 	serial = wl_display_next_serial(compositor->wl_display);
@@ -986,7 +985,7 @@
 }
 
 static void
-touch_set_focus(struct weston_seat *seat, struct wl_surface *surface)
+touch_set_focus(struct weston_seat *seat, struct weston_surface *surface)
 {
 	struct wl_resource *resource;
 
@@ -1047,7 +1046,7 @@
 		 * until all touch points are up again. */
 		if (seat->num_tp == 1) {
 			es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
-			touch_set_focus(seat, &es->surface);
+			touch_set_focus(seat, es);
 		} else if (touch->focus) {
 			es = (struct weston_surface *) touch->focus;
 			weston_surface_from_global_fixed(es, x, y, &sx, &sy);
@@ -1152,7 +1151,7 @@
 
 	if (surface && surface != seat->sprite) {
 		if (surface->configure) {
-			wl_resource_post_error(&surface->surface.resource,
+			wl_resource_post_error(&surface->resource,
 					       WL_DISPLAY_ERROR_INVALID_OBJECT,
 					       "surface->configure already "
 					       "set");
@@ -1166,7 +1165,7 @@
 	if (!surface)
 		return;
 
-	wl_signal_add(&surface->surface.resource.destroy_signal,
+	wl_signal_add(&surface->resource.destroy_signal,
 		      &seat->sprite_destroy_listener);
 
 	surface->configure = pointer_cursor_surface_configure;
diff --git a/src/shell.c b/src/shell.c
index 4021e7d..bdb8d4c 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -324,11 +324,11 @@
 		      &grab->shsurf_destroy_listener);
 
 	grab->pointer = pointer;
-	grab->grab.focus = &shsurf->surface->surface;
+	grab->grab.focus = shsurf->surface;
 
 	weston_pointer_start_grab(pointer, &grab->grab);
 	desktop_shell_send_grab_cursor(shell->child.desktop_shell, cursor);
-	weston_pointer_set_focus(pointer, &shell->grab_surface->surface,
+	weston_pointer_set_focus(pointer, shell->grab_surface,
 				 wl_fixed_from_int(0), wl_fixed_from_int(0));
 }
 
@@ -498,11 +498,10 @@
 restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
 {
 	struct focus_state *state, *next;
-	struct wl_surface *surface;
+	struct weston_surface *surface;
 
 	wl_list_for_each_safe(state, next, &ws->focus_list, link) {
-		surface = state->keyboard_focus ?
-			&state->keyboard_focus->surface : NULL;
+		surface = state->keyboard_focus;
 
 		weston_keyboard_set_focus(state->seat->keyboard, surface);
 	}
@@ -513,7 +512,7 @@
 		    struct weston_seat *seat)
 {
 	struct focus_state *state;
-	struct wl_surface *surface;
+	struct weston_surface *surface;
 
 	wl_list_for_each(state, &ws->focus_list, link) {
 		if (state->seat == seat) {
@@ -900,8 +899,7 @@
 
 	drop_focus_state(shell, from, surface);
 	wl_list_for_each(seat, &shell->compositor->seat_list, link)
-		if (seat->keyboard &&
-		    seat->keyboard->focus == &surface->surface)
+		if (seat->keyboard && seat->keyboard->focus == surface)
 			weston_keyboard_set_focus(seat->keyboard, NULL);
 
 	weston_surface_damage_below(surface);
@@ -1017,7 +1015,7 @@
 
 static void
 noop_grab_focus(struct weston_pointer_grab *grab,
-		struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
+		struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
 {
 	grab->focus = NULL;
 }
@@ -1101,7 +1099,7 @@
 
 	if (seat->pointer->button_count == 0 ||
 	    seat->pointer->grab_serial != serial ||
-	    seat->pointer->focus != &shsurf->surface->surface)
+	    seat->pointer->focus != shsurf->surface)
 		return;
 
 	if (surface_move(shsurf, seat) < 0)
@@ -1228,7 +1226,7 @@
 
 	if (seat->pointer->button_count == 0 ||
 	    seat->pointer->grab_serial != serial ||
-	    seat->pointer->focus != &shsurf->surface->surface)
+	    seat->pointer->focus != shsurf->surface)
 		return;
 
 	if (surface_resize(shsurf, seat, edges) < 0)
@@ -1237,7 +1235,7 @@
 
 static void
 busy_cursor_grab_focus(struct weston_pointer_grab *base,
-		       struct wl_surface *surface, int32_t x, int32_t y)
+		       struct weston_surface *surface, int32_t x, int32_t y)
 {
 	struct shell_grab *grab = (struct shell_grab *) base;
 
@@ -1326,7 +1324,7 @@
 	shsurf->unresponsive = 1;
 
 	wl_list_for_each(seat, &shsurf->surface->compositor->seat_list, link)
-		if (seat->pointer->focus == &shsurf->surface->surface)
+		if (seat->pointer->focus == shsurf->surface)
 			set_busy_cursor(shsurf, seat->pointer);
 
 	return 1;
@@ -1421,10 +1419,8 @@
 			/* Received pong from previously unresponsive client */
 			wl_list_for_each(seat, &ec->seat_list, link) {
 				pointer = seat->pointer;
-				if (pointer->focus ==
-				    &shell->grab_surface->surface &&
-				    pointer->current ==
-				    &shsurf->surface->surface)
+				if (pointer->focus == shell->grab_surface &&
+				    pointer->current == shsurf->surface)
 					end_busy_cursor(shsurf, pointer);
 			}
 		}
@@ -1918,7 +1914,7 @@
 
 static void
 popup_grab_focus(struct weston_pointer_grab *grab,
-		 struct wl_surface *surface,
+		 struct weston_surface *surface,
 		 wl_fixed_t x,
 		 wl_fixed_t y)
 {
@@ -2015,7 +2011,7 @@
 	struct weston_seat *seat = shseat->seat;
 
 	if (wl_list_empty(&shseat->popup_grab.surfaces_list)) {
-		shseat->popup_grab.client = shsurf->surface->surface.resource.client;
+		shseat->popup_grab.client = shsurf->resource.client;
 		shseat->popup_grab.grab.interface = &popup_grab_interface;
 		/* We must make sure here that this popup was opened after
 		 * a mouse press, and not just by moving around with other
@@ -2190,7 +2186,7 @@
 
 	wl_signal_init(&shsurf->resource.destroy_signal);
 	shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy;
-	wl_signal_add(&surface->surface.resource.destroy_signal,
+	wl_signal_add(&surface->resource.destroy_signal,
 		      &shsurf->surface_destroy_listener);
 
 	/* init link so its safe to always remove it in destroy_shell_surface */
@@ -2841,7 +2837,7 @@
 
 	state->keyboard_focus = es;
 	wl_list_remove(&state->surface_destroy_listener.link);
-	wl_signal_add(&es->surface.resource.destroy_signal,
+	wl_signal_add(&es->resource.destroy_signal,
 		      &state->surface_destroy_listener);
 
 	switch (get_shell_surface_type(es)) {
@@ -3607,7 +3603,7 @@
 
 	wl_signal_init(&input_panel_surface->resource.destroy_signal);
 	input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy;
-	wl_signal_add(&surface->surface.resource.destroy_signal,
+	wl_signal_add(&surface->resource.destroy_signal,
 		      &input_panel_surface->surface_destroy_listener);
 
 	wl_list_init(&input_panel_surface->link);
@@ -3778,8 +3774,7 @@
 		return;
 
 	wl_list_remove(&switcher->listener.link);
-	wl_signal_add(&next->surface.resource.destroy_signal,
-		      &switcher->listener);
+	wl_signal_add(&next->resource.destroy_signal, &switcher->listener);
 
 	switcher->current = next;
 	next->alpha = 1.0;
@@ -4023,7 +4018,7 @@
 force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
 		   void *data)
 {
-	struct wl_surface *focus_surface;
+	struct weston_surface *focus_surface;
 	struct wl_client *client;
 	struct desktop_shell *shell = data;
 	struct weston_compositor *compositor = shell->compositor;
diff --git a/src/tablet-shell.c b/src/tablet-shell.c
index 87df80a..7c75c1b 100644
--- a/src/tablet-shell.c
+++ b/src/tablet-shell.c
@@ -150,7 +150,7 @@
 		}
 	} else if (shell->current_client &&
 		   shell->current_client->surface != surface &&
-		   shell->current_client->client == surface->surface.resource.client) {
+		   shell->current_client->client == surface->resource.client) {
 		tablet_shell_set_state(shell, STATE_TASK);
 		shell->current_client->surface = surface;
 		weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
@@ -184,7 +184,7 @@
 	shell->lockscreen_surface = es;
 	shell->lockscreen_surface->configure = tablet_shell_surface_configure;
 	shell->lockscreen_listener.notify = handle_lockscreen_surface_destroy;
-	wl_signal_add(&es->surface.resource.destroy_signal,
+	wl_signal_add(&es->resource.destroy_signal,
 		      &shell->lockscreen_listener);
 }
 
@@ -216,8 +216,7 @@
 	weston_surface_set_position(shell->switcher_surface, 0, 0);
 
 	shell->switcher_listener.notify = handle_switcher_surface_destroy;
-	wl_signal_add(&es->surface.resource.destroy_signal,
-		      &shell->switcher_listener);
+	wl_signal_add(&es->resource.destroy_signal, &shell->switcher_listener);
 }
 
 static void
diff --git a/src/text-backend.c b/src/text-backend.c
index 036d48a..92efd9f 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -39,7 +39,7 @@
 
 	struct wl_list input_methods;
 
-	struct wl_surface *surface;
+	struct weston_surface *surface;
 
 	pixman_box32_t cursor_rectangle;
 
@@ -794,7 +794,7 @@
 	struct weston_keyboard *keyboard = data;
 	struct input_method *input_method =
 		container_of(listener, struct input_method, keyboard_focus_listener);
-	struct wl_surface *surface = keyboard->focus;
+	struct weston_surface *surface = keyboard->focus;
 
 	if (!input_method->model)
 		return;
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index e1147db..b4b0a83 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -1016,7 +1016,7 @@
 		&wm->server->compositor->shell_interface;
 
 	if (seat->pointer->button_count != 1 ||
-	    seat->pointer->focus != &window->surface->surface)
+	    seat->pointer->focus != window->surface)
 		return;
 
 	detail = client_message->data.data32[2];
@@ -1715,7 +1715,7 @@
 static struct weston_wm_window *
 get_wm_window(struct weston_surface *surface)
 {
-	struct wl_resource *resource = &surface->surface.resource;
+	struct wl_resource *resource = &surface->resource;
 	struct wl_listener *listener;
 
 	listener = wl_signal_get(&resource->destroy_signal, surface_destroy);
@@ -1852,7 +1852,7 @@
 {
 	struct weston_xserver *wxs = resource->data;
 	struct weston_wm *wm = wxs->wm;
-	struct wl_surface *surface = surface_resource->data;
+	struct weston_surface *surface = surface_resource->data;
 	struct weston_wm_window *window;
 
 	if (client != wxs->client)