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;
}
// 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;
// Flag to prevent the output mode event handler from calling us
@ -545,24 +538,27 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
}
}
// Find position for it
if (oc && (oc->x != -1 || oc->y != -1)) {
sway_log(SWAY_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
wlr_output_layout_add(root->output_layout, wlr_output, oc->x, oc->y);
} else {
wlr_output_layout_add_auto(root->output_layout, wlr_output);
}
if (!mirror_output_is_mirror_dst(output)) {
// Update output->{lx, ly, width, height}
struct wlr_box *output_box =
wlr_output_layout_get_box(root->output_layout, wlr_output);
output->lx = output_box->x;
output->ly = output_box->y;
output->width = output_box->width;
output->height = output_box->height;
// Find position for it
if (oc && (oc->x != -1 || oc->y != -1)) {
sway_log(SWAY_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
wlr_output_layout_add(root->output_layout, wlr_output, oc->x, oc->y);
} else {
wlr_output_layout_add_auto(root->output_layout, wlr_output);
}
if (!output->enabled) {
output_enable(output);
// Update output->{lx, ly, width, height}
struct wlr_box *output_box =
wlr_output_layout_get_box(root->output_layout, wlr_output);
output->lx = output_box->x;
output->ly = output_box->y;
output->width = output_box->width;
output->height = output_box->height;
if (!output->enabled) {
output_enable(output);
}
}
if (oc && oc->max_render_time >= 0) {

View file

@ -34,9 +34,7 @@ static struct wlr_output *container_output(struct sway_container *container) {
void vacate_output(struct sway_output *output) {
// arranges root
if (output->enabled) {
output_disable(output);
}
output_disable(output);
// idempotent
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.
*
* Any "pending" changes that were blocked in apply_output_config during the
* mirror session will be applied.
*/
void reclaim_output(struct sway_output *output) {
struct output_config *oc = find_output_config(output);
// calls output_enable
// calls wlr_output_layout_add, output_enable
apply_output_config(oc, output);
free_output_config(oc);