summaryrefslogtreecommitdiff
path: root/ivi-shell
diff options
context:
space:
mode:
authorEmre Ucan <eucan@de.adit-jv.com>2018-06-06 09:25:28 +0200
committerTran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>2022-11-04 16:09:39 +0700
commitcbf476f208fbdcefe6e5502992d19ddc96d2e525 (patch)
treec98ee1ea8766478b7b1a4922c141cb797072889a /ivi-shell
parent1c5ce4c2cc8cb15c2ed8e76b73c107cb1389a333 (diff)
downloadweston-cbf476f208fbdcefe6e5502992d19ddc96d2e525.tar.gz
ivi-shell: listen output_created signal
listen the signal and create new ivi screens. this is required to handle hotplug events. Signed-off-by: Emre Ucan <eucan@de.adit-jv.com> don't need to check the output in event, remove the typecast Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
Diffstat (limited to 'ivi-shell')
-rw-r--r--ivi-shell/ivi-layout-private.h2
-rw-r--r--ivi-shell/ivi-layout.c50
2 files changed, 34 insertions, 18 deletions
diff --git a/ivi-shell/ivi-layout-private.h b/ivi-shell/ivi-layout-private.h
index 47262f0d..5c01f245 100644
--- a/ivi-shell/ivi-layout-private.h
+++ b/ivi-shell/ivi-layout-private.h
@@ -115,6 +115,8 @@ struct ivi_layout {
struct ivi_layout_transition_set *transitions;
struct wl_list pending_transition_list; /* transition_node::link */
+
+ struct wl_listener output_created;
};
struct ivi_layout *get_instance(void);
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index d3a9f1f1..3b354906 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -260,34 +260,44 @@ ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf)
free(ivisurf);
}
-/**
- * Internal API to initialize ivi_screens found from output_list of weston_compositor.
- * Called by ivi_layout_init_with_compositor.
- */
static void
-create_screen(struct weston_compositor *ec)
+add_screen(struct weston_output *output)
{
struct ivi_layout *layout = get_instance();
struct ivi_layout_screen *iviscrn = NULL;
- struct weston_output *output = NULL;
- wl_list_for_each(output, &ec->output_list, link) {
- iviscrn = calloc(1, sizeof *iviscrn);
- if (iviscrn == NULL) {
- weston_log("fails to allocate memory\n");
- continue;
- }
+ iviscrn = calloc(1, sizeof *iviscrn);
+ if (iviscrn == NULL) {
+ weston_log("fails to allocate memory\n");
+ return;
+ }
- iviscrn->layout = layout;
+ iviscrn->layout = layout;
+ iviscrn->output = output;
- iviscrn->output = output;
+ wl_list_init(&iviscrn->pending.layer_list);
+ wl_list_init(&iviscrn->order.layer_list);
+ wl_list_insert(&layout->screen_list, &iviscrn->link);
+}
- wl_list_init(&iviscrn->pending.layer_list);
+static void
+output_created_event(struct wl_listener *listener, void *data)
+{
+ struct weston_output *created_output = data;
+ add_screen(created_output);
+}
- wl_list_init(&iviscrn->order.layer_list);
+/**
+ * Internal API to initialize ivi_screens found from output_list of weston_compositor.
+ * Called by ivi_layout_init_with_compositor.
+ */
+static void
+create_screen(struct weston_compositor *ec)
+{
+ struct weston_output *output = NULL;
- wl_list_insert(&layout->screen_list, &iviscrn->link);
- }
+ wl_list_for_each(output, &ec->output_list, link)
+ add_screen(output);
}
/**
@@ -2045,6 +2055,9 @@ ivi_layout_init_with_compositor(struct weston_compositor *ec)
create_screen(ec);
+ layout->output_created.notify = output_created_event;
+ wl_signal_add(&ec->output_created_signal, &layout->output_created);
+
layout->transitions = ivi_layout_transition_set_create(ec);
wl_list_init(&layout->pending_transition_list);
@@ -2061,6 +2074,7 @@ ivi_layout_fini(void)
weston_layer_fini(&layout->layout_layer);
/* XXX: tear down everything else */
+ wl_list_remove(&layout->output_created.link);
}
static struct ivi_layout_interface ivi_layout_interface = {