desktop-shell: Drop next_type from shell_surface

The surface type now no longer changes and we track pending state changes in
next_state.  Instead of testing type != next_type to detect changes in
state, we just look at state_changed.
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 9b8253d..9f442ad 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -122,7 +122,7 @@
 	struct wl_list children_link;  /* sibling surfaces of this one */
 	struct desktop_shell *shell;
 
-	enum shell_surface_type type, next_type;
+	enum shell_surface_type type;
 	char *title, *class;
 	int32_t saved_x, saved_y;
 	int32_t saved_width, saved_height;
@@ -2125,7 +2125,7 @@
 {
 	shell_surface_set_parent(shsurf, NULL);
 	surface_clear_next_states(shsurf);
-	shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
+	shsurf->type = SHELL_SURFACE_TOPLEVEL;
 
 	/* The layer_link is updated in set_surface_type(),
 	 * called from configure. */
@@ -2151,7 +2151,7 @@
 	shsurf->transient.flags = flags;
 
 	shsurf->next_state.relative = true;
-	shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
+	shsurf->type = SHELL_SURFACE_TOPLEVEL;
 
 	/* The layer_link is updated in set_surface_type(),
 	 * called from configure. */
@@ -2187,7 +2187,7 @@
 
 	shsurf->next_state.fullscreen = true;
 	shsurf->state_changed = true;
-	shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
+	shsurf->type = SHELL_SURFACE_TOPLEVEL;
 
 	shsurf->client->send_configure(shsurf->surface, 0,
 				       shsurf->output->width,
@@ -2264,7 +2264,7 @@
 	shsurf->popup.x = x;
 	shsurf->popup.y = y;
 
-	shsurf->next_type = SHELL_SURFACE_POPUP;
+	shsurf->type = SHELL_SURFACE_POPUP;
 }
 
 static void
@@ -2307,7 +2307,7 @@
 
 	shsurf->next_state.maximized = true;
 	shsurf->state_changed = true;
-	shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
+	shsurf->type = SHELL_SURFACE_TOPLEVEL;
 }
 
 static void
@@ -2357,7 +2357,6 @@
 	if (surface->state.maximized)
 		unset_maximized(surface);
 
-	surface->type = SHELL_SURFACE_NONE;
 	return 0;
 }
 
@@ -2387,9 +2386,7 @@
 
 	reset_surface_type(shsurf);
 
-	shsurf->type = shsurf->next_type;
 	shsurf->state = shsurf->next_state;
-	shsurf->next_type = SHELL_SURFACE_NONE;
 	shsurf->state_changed = false;
 
 	switch (shsurf->type) {
@@ -2592,7 +2589,7 @@
 
 	shell_surface_set_parent(shsurf, NULL);
 
-	shsurf->next_type = SHELL_SURFACE_XWAYLAND;
+	shsurf->type = SHELL_SURFACE_XWAYLAND;
 }
 
 static const struct weston_pointer_grab_interface popup_grab_interface;
@@ -2971,7 +2968,6 @@
 	shsurf->parent = NULL;
 
 	shsurf->type = SHELL_SURFACE_NONE;
-	shsurf->next_type = SHELL_SURFACE_NONE;
 
 	shsurf->client = client;
 
@@ -2982,13 +2978,7 @@
 create_shell_surface(void *shell, struct weston_surface *surface,
 		     const struct weston_shell_client *client)
 {
-	struct shell_surface *shsurf;
-	shsurf = create_common_surface(shell, surface, client);
-
-	shsurf->type = SHELL_SURFACE_NONE;
-	shsurf->next_type = SHELL_SURFACE_NONE;
-
-	return shsurf;
+	return create_common_surface(shell, surface, client);
 }
 
 static struct weston_view *
@@ -3155,7 +3145,6 @@
 	}
 
 	shsurf->client->send_configure(shsurf->surface, 0, width, height);
-	shsurf->next_type = shsurf->type;
 }
 
 static void
@@ -3197,7 +3186,6 @@
 	}
 
 	shsurf->client->send_configure(shsurf->surface, 0, width, height);
-	shsurf->next_type = shsurf->type;
 }
 
 static const struct xdg_surface_interface xdg_surface_implementation = {
@@ -3247,10 +3235,9 @@
 		   const struct weston_shell_client *client)
 {
 	struct shell_surface *shsurf;
-	shsurf = create_common_surface(shell, surface, client);
 
-	shsurf->type = SHELL_SURFACE_NONE;
-	shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
+	shsurf = create_common_surface(shell, surface, client);
+	shsurf->type = SHELL_SURFACE_TOPLEVEL;
 
 	return shsurf;
 }
@@ -3340,10 +3327,9 @@
 		 int32_t x, int32_t y)
 {
 	struct shell_surface *shsurf;
-	shsurf = create_common_surface(shell, surface, client);
 
-	shsurf->type = SHELL_SURFACE_NONE;
-	shsurf->next_type = SHELL_SURFACE_POPUP;
+	shsurf = create_common_surface(shell, surface, client);
+	shsurf->type = SHELL_SURFACE_POPUP;
 	shsurf->popup.shseat = seat;
 	shsurf->popup.serial = serial;
 	shsurf->popup.x = x;
@@ -4935,9 +4921,7 @@
 	if (es->width == 0)
 		return;
 
-	if ((shsurf->next_type != SHELL_SURFACE_NONE &&
-	    shsurf->type != shsurf->next_type) ||
-	    shsurf->state_changed) {
+	if (shsurf->state_changed) {
 		set_surface_type(shsurf);
 		type_changed = 1;
 	}