diff options
author | emersion <contact@emersion.fr> | 2018-02-12 10:36:43 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-02-12 10:36:43 +0100 |
commit | 10ecf871f27ddd7170b6fb9ee7bd055b9cb3423c (patch) | |
tree | 6f7fd24b33ae1cf0e2b83c55778d1b2bafb08b6f /rootston/output.c | |
parent | 5e58d46cc1a90810e3ee76203cee8ca2f14fb462 (diff) |
Remove wlr_backend.events.{output_remove,device_remove}
Diffstat (limited to 'rootston/output.c')
-rw-r--r-- | rootston/output.c | 47 |
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); -} |