sway/desktop/output: listen to output mode in commit handle

master
Simon Zeni 2 years ago committed by Simon Ser
parent 3bd657c726
commit aa03a8fcb5

@ -43,7 +43,6 @@ struct sway_output {
struct wl_listener destroy; struct wl_listener destroy;
struct wl_listener commit; struct wl_listener commit;
struct wl_listener mode;
struct wl_listener present; struct wl_listener present;
struct wl_listener damage; struct wl_listener damage;
struct wl_listener frame; struct wl_listener frame;

@ -805,7 +805,6 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
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->present.link); wl_list_remove(&output->present.link);
wl_list_remove(&output->damage.link); wl_list_remove(&output->damage.link);
wl_list_remove(&output->frame.link); wl_list_remove(&output->frame.link);
@ -822,8 +821,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
update_output_manager_config(server); update_output_manager_config(server);
} }
static void handle_mode(struct wl_listener *listener, void *data) { static void handle_mode(struct sway_output *output) {
struct sway_output *output = wl_container_of(listener, output, mode);
if (!output->enabled && !output->enabling) { if (!output->enabled && !output->enabling) {
struct output_config *oc = find_output_config(output); struct output_config *oc = find_output_config(output);
if (output->wlr_output->current_mode != NULL && if (output->wlr_output->current_mode != NULL &&
@ -862,6 +860,10 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_output *output = wl_container_of(listener, output, commit); struct sway_output *output = wl_container_of(listener, output, commit);
struct wlr_output_event_commit *event = data; struct wlr_output_event_commit *event = data;
if (event->committed & WLR_OUTPUT_STATE_MODE) {
handle_mode(output);
}
if (!output->enabled) { if (!output->enabled) {
return; return;
} }
@ -954,8 +956,6 @@ void handle_new_output(struct wl_listener *listener, void *data) {
output->destroy.notify = handle_destroy; output->destroy.notify = handle_destroy;
wl_signal_add(&wlr_output->events.commit, &output->commit); wl_signal_add(&wlr_output->events.commit, &output->commit);
output->commit.notify = handle_commit; output->commit.notify = handle_commit;
wl_signal_add(&wlr_output->events.mode, &output->mode);
output->mode.notify = handle_mode;
wl_signal_add(&wlr_output->events.present, &output->present); wl_signal_add(&wlr_output->events.present, &output->present);
output->present.notify = handle_present; output->present.notify = handle_present;
wl_signal_add(&wlr_output->events.damage, &output->damage); wl_signal_add(&wlr_output->events.damage, &output->damage);

Loading…
Cancel
Save