compositor: Return a user-defined exit code

Currently, once we've reached our main's wl_display_run(), we always
return ret=EXIT_SUCCESS when weston terminates through wl_display_terminate.

This patch makes it possible to specify another return value by setting
prior to terminating Weston. This is useful for automated tests that want
to report test failures to the overlying testing infrastructure.

Signed-off-by: Frederic Plourde <frederic.plourde@collabora.co.uk>
[Pekka: fixed some tabs.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/src/compositor.h b/src/compositor.h
index a0aef02..e936eda 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -664,6 +664,8 @@
 	int32_t kb_repeat_delay;
 
 	clockid_t presentation_clock;
+
+	int exit_code;
 };
 
 struct weston_buffer {
@@ -1264,6 +1266,9 @@
 void
 weston_compositor_shutdown(struct weston_compositor *ec);
 void
+weston_compositor_exit_with_code(struct weston_compositor *compositor,
+				 int exit_code);
+void
 weston_output_init_zoom(struct weston_output *output);
 void
 weston_output_update_zoom(struct weston_output *output);