[PATCH 02/17] shell: Add missing cases to switch statements for surface types

Philip Withnall philip at tecnocode.co.uk
Mon Nov 25 10:01:31 PST 2013


From: Philip Withnall <philip.withnall at collabora.co.uk>

This fixes a load of GCC warnings when compiling with -Wswitch-enum
-Wswitch-default, and makes it clearer that those cases have been
thought about explicitly when writing the code, rather than just being
forgotten.
---
 src/shell.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/shell.c b/src/shell.c
index cf91775..1a35d54 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2256,6 +2256,7 @@ reset_surface_type(struct shell_surface *surface)
 	case SHELL_SURFACE_TRANSIENT:
 	case SHELL_SURFACE_POPUP:
 	case SHELL_SURFACE_XWAYLAND:
+	default:
 		break;
 	}
 
@@ -2303,6 +2304,8 @@ set_surface_type(struct shell_surface *shsurf)
 					 shsurf->transient.y);
 		break;
 
+	case SHELL_SURFACE_POPUP:
+	case SHELL_SURFACE_NONE:
 	default:
 		break;
 	}
@@ -3828,6 +3831,12 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
 		shell_stack_fullscreen(get_shell_surface(main_surface));
 		shell_configure_fullscreen(get_shell_surface(main_surface));
 		return;
+	case SHELL_SURFACE_TOPLEVEL:
+	case SHELL_SURFACE_TRANSIENT:
+	case SHELL_SURFACE_MAXIMIZED:
+	case SHELL_SURFACE_POPUP:
+	case SHELL_SURFACE_XWAYLAND:
+	case SHELL_SURFACE_NONE:
 	default:
 		restore_all_output_modes(shell->compositor);
 		ws = get_current_workspace(shell);
@@ -4296,6 +4305,8 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
 					 shsurf->view->geometry.x + sx,
 					 shsurf->view->geometry.y + sy);
 		break;
+	case SHELL_SURFACE_TRANSIENT:
+	case SHELL_SURFACE_XWAYLAND:
 	default:
 		;
 	}
@@ -4316,6 +4327,8 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
 	case SHELL_SURFACE_NONE:
 		break;
 	case SHELL_SURFACE_XWAYLAND:
+	case SHELL_SURFACE_TOPLEVEL:
+	case SHELL_SURFACE_MAXIMIZED:
 	default:
 		ws = get_current_workspace(shell);
 		wl_list_remove(&shsurf->view->layer_link);
@@ -4346,6 +4359,8 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
 				activate(shell, shsurf->surface, seat);
 		}
 		break;
+	case SHELL_SURFACE_POPUP:
+	case SHELL_SURFACE_NONE:
 	default:
 		break;
 	}
@@ -4399,7 +4414,10 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
 			get_output_panel_height(shell,shsurf->output) - surf_y;
 		break;
 	case SHELL_SURFACE_TOPLEVEL:
-		break;
+	case SHELL_SURFACE_TRANSIENT:
+	case SHELL_SURFACE_POPUP:
+	case SHELL_SURFACE_XWAYLAND:
+	case SHELL_SURFACE_NONE:
 	default:
 		break;
 	}
@@ -4879,6 +4897,10 @@ switcher_next(struct switcher *switcher)
 			weston_view_geometry_dirty(view);
 			weston_surface_damage(view->surface);
 			break;
+		case SHELL_SURFACE_TRANSIENT:
+		case SHELL_SURFACE_POPUP:
+		case SHELL_SURFACE_XWAYLAND:
+		case SHELL_SURFACE_NONE:
 		default:
 			break;
 		}
-- 
1.8.3.1



More information about the wayland-devel mailing list