Remove wlr_backend.events.{output_remove,device_remove}

This commit is contained in:
emersion 2018-02-12 10:36:43 +01:00
parent 5e58d46cc1
commit 10ecf871f2
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
25 changed files with 263 additions and 382 deletions

View file

@ -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);
}