Skip to content

output: reapply output config when fixed modes change #5942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/sway/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct sway_output {
struct wl_listener destroy;
struct wl_listener commit;
struct wl_listener mode;
struct wl_listener available_modes;
struct wl_listener present;
struct wl_listener damage_destroy;
struct wl_listener damage_frame;
Expand Down
13 changes: 13 additions & 0 deletions sway/desktop/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,17 @@ static void handle_mode(struct wl_listener *listener, void *data) {
update_output_manager_config(output->server);
}

static void handle_available_modes(struct wl_listener *listener, void *data) {
struct sway_output *output = wl_container_of(listener, output, available_modes);
struct output_config *oc = find_output_config(output);
apply_output_config(oc, output);
free_output_config(oc);

transaction_commit_dirty();

update_output_manager_config(output->server);
}

static void update_textures(struct sway_container *con, void *data) {
container_update_title_textures(con);
container_update_marks_textures(con);
Expand Down Expand Up @@ -928,6 +939,8 @@ void handle_new_output(struct wl_listener *listener, void *data) {
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.available_modes, &output->available_modes);
output->available_modes.notify = handle_available_modes;
wl_signal_add(&wlr_output->events.present, &output->present);
output->present.notify = handle_present;
wl_signal_add(&output->damage->events.frame, &output->damage_frame);
Expand Down