output: change output::destroy to output::disable
This changes output::destroy to output::disable and emits it only once when an output is disabled, instead of twice in succession.
This commit is contained in:
parent
f2b6d1ec29
commit
ebfe432ec3
|
@ -48,7 +48,7 @@ struct sway_output {
|
||||||
struct wl_listener damage_frame;
|
struct wl_listener damage_frame;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal disable;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
struct timespec last_presentation;
|
struct timespec last_presentation;
|
||||||
|
|
|
@ -664,7 +664,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct sway_output *output = layer_surface->output->data;
|
struct sway_output *output = layer_surface->output->data;
|
||||||
sway_layer->output_destroy.notify = handle_output_destroy;
|
sway_layer->output_destroy.notify = handle_output_destroy;
|
||||||
wl_signal_add(&output->events.destroy, &sway_layer->output_destroy);
|
wl_signal_add(&output->events.disable, &sway_layer->output_destroy);
|
||||||
|
|
||||||
wl_list_insert(&output->layers[layer_surface->pending.layer],
|
wl_list_insert(&output->layers[layer_surface->pending.layer],
|
||||||
&sway_layer->link);
|
&sway_layer->link);
|
||||||
|
|
|
@ -754,18 +754,22 @@ static void update_output_manager_config(struct sway_server *server) {
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct sway_output *output = wl_container_of(listener, output, destroy);
|
struct sway_output *output = wl_container_of(listener, output, destroy);
|
||||||
struct sway_server *server = output->server;
|
struct sway_server *server = output->server;
|
||||||
wl_signal_emit(&output->events.destroy, output);
|
output_begin_destroy(output);
|
||||||
|
|
||||||
if (output->enabled) {
|
if (output->enabled) {
|
||||||
output_disable(output);
|
output_disable(output);
|
||||||
}
|
}
|
||||||
output_begin_destroy(output);
|
|
||||||
|
wl_list_remove(&output->link);
|
||||||
|
|
||||||
wl_list_remove(&output->destroy.link);
|
wl_list_remove(&output->destroy.link);
|
||||||
wl_list_remove(&output->commit.link);
|
wl_list_remove(&output->commit.link);
|
||||||
wl_list_remove(&output->mode.link);
|
wl_list_remove(&output->mode.link);
|
||||||
wl_list_remove(&output->present.link);
|
wl_list_remove(&output->present.link);
|
||||||
|
|
||||||
|
output->wlr_output->data = NULL;
|
||||||
|
output->wlr_output = NULL;
|
||||||
|
|
||||||
transaction_commit_dirty();
|
transaction_commit_dirty();
|
||||||
|
|
||||||
update_output_manager_config(server);
|
update_output_manager_config(server);
|
||||||
|
|
|
@ -95,7 +95,7 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
|
||||||
output->detected_subpixel = wlr_output->subpixel;
|
output->detected_subpixel = wlr_output->subpixel;
|
||||||
output->scale_filter = SCALE_FILTER_NEAREST;
|
output->scale_filter = SCALE_FILTER_NEAREST;
|
||||||
|
|
||||||
wl_signal_init(&output->events.destroy);
|
wl_signal_init(&output->events.disable);
|
||||||
|
|
||||||
wl_list_insert(&root->all_outputs, &output->link);
|
wl_list_insert(&root->all_outputs, &output->link);
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ void output_disable(struct sway_output *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
|
sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
|
||||||
wl_signal_emit(&output->events.destroy, output);
|
wl_signal_emit(&output->events.disable, output);
|
||||||
|
|
||||||
output_evacuate(output);
|
output_evacuate(output);
|
||||||
|
|
||||||
|
@ -289,10 +289,6 @@ void output_begin_destroy(struct sway_output *output) {
|
||||||
|
|
||||||
output->node.destroying = true;
|
output->node.destroying = true;
|
||||||
node_set_dirty(&output->node);
|
node_set_dirty(&output->node);
|
||||||
|
|
||||||
wl_list_remove(&output->link);
|
|
||||||
output->wlr_output->data = NULL;
|
|
||||||
output->wlr_output = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_output *output_from_wlr_output(struct wlr_output *output) {
|
struct sway_output *output_from_wlr_output(struct wlr_output *output) {
|
||||||
|
|
Loading…
Reference in a new issue