libweston: Add more functionality for handling weston_output objects

This patch implements additional functionality that will be used
for configuring, enabling and disabling weston's outputs. Its
indended use is by the compositors or user programs that want to
be able to configure, enable or disable an output at any time. An
output can only be configured while it's disabled.

The compositor and backend specific functionality is required
for these functions to be useful, and those will come later in
this series.

All the new functions have been documented, so I'll avoid
describing them here.

v2:

 - Minor documentation improvements.
 - Rename output-initialized to output->enabled.
 - Split weston_output_disable() further into
   weston_compositor_remove_output().
 - Rename weston_output_deinit() to weston_output_enable_undo().

 - Make weston_output_disable() call two functions mentioned
   above instead of calling weston_output_disable() directly.
   This means that backend needs to take care of doing backend
   specific disable in backend specific destroy function.

v3:

 - Require output->name to be set before calling
   weston_output_init_pending().
 - Require output->destroying to be set before
   calling weston_compositor_remove_output().
 - Split weston_output_init_pending() into
   weston_compositor_add_pending_output() so pending outputs
   can be announced separately.
 - Require output->disable() to be set in order for
   weston_output_disable() to be usable.
 - Fix output removing regression that happened when
   weston_output_disable() was split.
 - Minor documentation fix.

v4:

 - Bump libweston version to 2 as this patch breaks the ABI.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 16db03b..d3d779f 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -218,6 +218,12 @@
 			  uint16_t *b);
 
 	struct weston_timeline_object timeline;
+
+	bool enabled;
+	int scale;
+
+	int (*enable)(struct weston_output *output);
+	int (*disable)(struct weston_output *output);
 };
 
 enum weston_pointer_motion_mask {
@@ -767,6 +773,7 @@
 	struct wl_signal update_input_panel_signal;
 
 	struct wl_signal seat_created_signal;
+	struct wl_signal output_pending_signal;
 	struct wl_signal output_created_signal;
 	struct wl_signal output_destroyed_signal;
 	struct wl_signal output_moved_signal;
@@ -778,6 +785,7 @@
 	struct weston_layer fade_layer;
 	struct weston_layer cursor_layer;
 
+	struct wl_list pending_output_list;
 	struct wl_list output_list;
 	struct wl_list seat_list;
 	struct wl_list layer_list;
@@ -1813,6 +1821,31 @@
 int
 weston_compositor_load_xwayland(struct weston_compositor *compositor);
 
+void
+weston_output_set_scale(struct weston_output *output,
+			int32_t scale);
+
+void
+weston_output_set_transform(struct weston_output *output,
+			    uint32_t transform);
+
+void
+weston_output_init_pending(struct weston_output *output,
+			   struct weston_compositor *compositor);
+
+void
+weston_compositor_add_pending_output(struct weston_output *output,
+				     struct weston_compositor *compositor);
+
+int
+weston_output_enable(struct weston_output *output);
+
+void
+weston_output_disable(struct weston_output *output);
+
+void
+weston_pending_output_coldplug(struct weston_compositor *compositor);
+
 #ifdef  __cplusplus
 }
 #endif