sway_mirror: allow output configuration changes during mirror session

This commit is contained in:
Alexander Courtis 2022-01-12 12:08:36 +11:00
parent 494388bcd2
commit 65f27b2fbc
2 changed files with 21 additions and 30 deletions

View file

@ -483,13 +483,6 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
return false; return false;
} }
// block changes to active mirror dsts; these will be applied during reclaim_output
if (mirror_output_is_mirror_dst(output)) {
sway_log(SWAY_DEBUG, "Not configuring mirror dst output %s",
output->wlr_output->name);
return false;
}
struct wlr_output *wlr_output = output->wlr_output; struct wlr_output *wlr_output = output->wlr_output;
// Flag to prevent the output mode event handler from calling us // Flag to prevent the output mode event handler from calling us
@ -545,6 +538,8 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
} }
} }
if (!mirror_output_is_mirror_dst(output)) {
// Find position for it // Find position for it
if (oc && (oc->x != -1 || oc->y != -1)) { if (oc && (oc->x != -1 || oc->y != -1)) {
sway_log(SWAY_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); sway_log(SWAY_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
@ -564,6 +559,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
if (!output->enabled) { if (!output->enabled) {
output_enable(output); output_enable(output);
} }
}
if (oc && oc->max_render_time >= 0) { if (oc && oc->max_render_time >= 0) {
sway_log(SWAY_DEBUG, "Set %s max render time to %d", sway_log(SWAY_DEBUG, "Set %s max render time to %d",

View file

@ -34,9 +34,7 @@ static struct wlr_output *container_output(struct sway_container *container) {
void vacate_output(struct sway_output *output) { void vacate_output(struct sway_output *output) {
// arranges root // arranges root
if (output->enabled) {
output_disable(output); output_disable(output);
}
// idempotent // idempotent
wlr_output_layout_remove(root->output_layout, output->wlr_output); wlr_output_layout_remove(root->output_layout, output->wlr_output);
@ -44,15 +42,12 @@ void vacate_output(struct sway_output *output) {
/** /**
* Reclaim an output, arranging root as though it is a newly enabled output. * Reclaim an output, arranging root as though it is a newly enabled output.
*
* Any "pending" changes that were blocked in apply_output_config during the
* mirror session will be applied.
*/ */
void reclaim_output(struct sway_output *output) { void reclaim_output(struct sway_output *output) {
struct output_config *oc = find_output_config(output); struct output_config *oc = find_output_config(output);
// calls output_enable // calls wlr_output_layout_add, output_enable
apply_output_config(oc, output); apply_output_config(oc, output);
free_output_config(oc); free_output_config(oc);