mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -04:00
sway_mirror: allow output configuration changes during mirror session
This commit is contained in:
parent
494388bcd2
commit
65f27b2fbc
2 changed files with 21 additions and 30 deletions
|
|
@ -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,24 +538,27 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find position for it
|
if (!mirror_output_is_mirror_dst(output)) {
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update output->{lx, ly, width, height}
|
// Find position for it
|
||||||
struct wlr_box *output_box =
|
if (oc && (oc->x != -1 || oc->y != -1)) {
|
||||||
wlr_output_layout_get_box(root->output_layout, wlr_output);
|
sway_log(SWAY_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
|
||||||
output->lx = output_box->x;
|
wlr_output_layout_add(root->output_layout, wlr_output, oc->x, oc->y);
|
||||||
output->ly = output_box->y;
|
} else {
|
||||||
output->width = output_box->width;
|
wlr_output_layout_add_auto(root->output_layout, wlr_output);
|
||||||
output->height = output_box->height;
|
}
|
||||||
|
|
||||||
if (!output->enabled) {
|
// Update output->{lx, ly, width, height}
|
||||||
output_enable(output);
|
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) {
|
if (oc && oc->max_render_time >= 0) {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue