aboutsummaryrefslogtreecommitdiff
path: root/rootston/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'rootston/output.c')
-rw-r--r--rootston/output.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/rootston/output.c b/rootston/output.c
index fce875da..bd2ec18d 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -644,9 +644,22 @@ static void set_mode(struct wlr_output *output,
}
}
-void output_add_notify(struct wl_listener *listener, void *data) {
+static void output_handle_destroy(struct wl_listener *listener, void *data) {
+ struct roots_output *output = wl_container_of(listener, output, destroy);
+
+ // TODO: cursor
+ //example_config_configure_cursor(sample->config, sample->cursor,
+ // sample->compositor);
+
+ wl_list_remove(&output->link);
+ wl_list_remove(&output->destroy.link);
+ wl_list_remove(&output->frame.link);
+ free(output);
+}
+
+void handle_new_output(struct wl_listener *listener, void *data) {
struct roots_desktop *desktop = wl_container_of(listener, desktop,
- output_add);
+ new_output);
struct wlr_output *wlr_output = data;
struct roots_input *input = desktop->server->input;
struct roots_config *config = desktop->config;
@@ -670,6 +683,8 @@ void output_add_notify(struct wl_listener *listener, void *data) {
output->damage = wlr_output_damage_create(wlr_output);
+ output->destroy.notify = output_handle_destroy;
+ wl_signal_add(&wlr_output->events.destroy, &output->destroy);
output->frame.notify = output_damage_handle_frame;
wl_signal_add(&output->damage->events.frame, &output->frame);
@@ -699,31 +714,3 @@ void output_add_notify(struct wl_listener *listener, void *data) {
output_damage_whole(output);
}
-
-void output_remove_notify(struct wl_listener *listener, void *data) {
- struct wlr_output *wlr_output = data;
- struct roots_desktop *desktop =
- wl_container_of(listener, desktop, output_remove);
-
- struct roots_output *output = NULL, *_output;
- wl_list_for_each(_output, &desktop->outputs, link) {
- if (_output->wlr_output == wlr_output) {
- output = _output;
- break;
- }
- }
- if (!output) {
- return; // We are unfamiliar with this output
- }
-
- wlr_output_layout_remove(desktop->layout, output->wlr_output);
-
- // TODO: cursor
- //example_config_configure_cursor(sample->config, sample->cursor,
- // sample->compositor);
-
- wl_list_remove(&output->link);
- wl_list_remove(&output->frame.link);
- wlr_output_damage_destroy(output->damage);
- free(output);
-}