When a output change role between master and slave in clone mode,
some work is needed, this signal is used to trigger this work.

Signed-off-by: Xiong Zhang <xiong.y.zh...@intel.com>
---
 desktop-shell/shell.c | 13 +++++++++++++
 src/compositor.c      |  1 +
 src/compositor.h      |  1 +
 3 files changed, 15 insertions(+)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 3831804..1e4a255 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -59,6 +59,7 @@ struct focus_state {
 struct shell_output {
        struct desktop_shell  *shell;
        struct weston_output  *output;
+       struct wl_listener    role_change_listener;
        struct wl_listener    destroy_listener;
        struct wl_list        link;
 };
@@ -5596,11 +5597,17 @@ handle_output_destroy(struct wl_listener *listener, 
void *data)
        shell_reposition_views_on_output_destroy(output_listener);
 
        wl_list_remove(&output_listener->destroy_listener.link);
+       wl_list_remove(&output_listener->role_change_listener.link);
        wl_list_remove(&output_listener->link);
        free(output_listener);
 }
 
 static void
+handle_output_role_change(struct wl_listener *listener, void *data)
+{
+}
+
+static void
 create_shell_output(struct desktop_shell *shell,
                                        struct weston_output *output)
 {
@@ -5615,6 +5622,11 @@ create_shell_output(struct desktop_shell *shell,
        shell_output->destroy_listener.notify = handle_output_destroy;
        wl_signal_add(&output->destroy_signal,
                      &shell_output->destroy_listener);
+
+       shell_output->role_change_listener.notify = handle_output_role_change;
+       wl_signal_add(&output->role_change_signal,
+                     &shell_output->role_change_listener);
+
        wl_list_insert(shell->output_list.prev, &shell_output->link);
 }
 
@@ -5697,6 +5709,7 @@ shell_destroy(struct wl_listener *listener, void *data)
 
        wl_list_for_each_safe(shell_output, tmp, &shell->output_list, link) {
                wl_list_remove(&shell_output->destroy_listener.link);
+               wl_list_remove(&shell_output->role_change_listener.link);
                wl_list_remove(&shell_output->link);
                free(shell_output);
        }
diff --git a/src/compositor.c b/src/compositor.c
index 2c30334..5c0f67d 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3283,6 +3283,7 @@ weston_output_init(struct weston_output *output, struct 
weston_compositor *c,
        wl_signal_init(&output->destroy_signal);
        wl_list_init(&output->animation_list);
        wl_list_init(&output->resource_list);
+       wl_signal_init(&output->role_change_signal);
 
        output->id = ffs(~output->compositor->output_id_pool) - 1;
        output->compositor->output_id_pool |= 1 << output->id;
diff --git a/src/compositor.h b/src/compositor.h
index 549d83d..0938078 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -216,6 +216,7 @@ struct weston_output {
        char *master_output_name;
        struct weston_output *master_output;
        struct wl_list clone_output_list;
+       struct wl_signal role_change_signal;
 
        void (*start_repaint_loop)(struct weston_output *output);
        int (*repaint)(struct weston_output *output,
-- 
1.8.3.2

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to