make the Cage multi-monitor layout configurable

This commit is contained in:
Dima Krasner 2021-12-22 08:38:26 +02:00
parent 3321daef98
commit ad0872e33e
4 changed files with 38 additions and 2 deletions

View file

@ -52,7 +52,23 @@ output_enable(struct cg_output *output)
* duplicate the enabled property in cg_output. */
wlr_log(WLR_DEBUG, "Enabling output %s", wlr_output->name);
wlr_output_layout_add_auto(output->server->output_layout, wlr_output);
if (output->server->output_extend_mode == CAGE_OUTPUT_EXTEND_MODE_RIGHT) {
int max_x = 0, max_x_y = 0;
struct wlr_output_layout_output *l_output;
wl_list_for_each (l_output, &output->server->output_layout->outputs, link) {
int width, height;
wlr_output_effective_resolution(l_output->output, &width, &height);
if (l_output->x + width > max_x) {
max_x = l_output->x + width;
max_x_y = l_output->y;
}
}
wlr_output_layout_add(output->server->output_layout, wlr_output, max_x, max_x_y);
} else {
wlr_output_layout_add_auto(output->server->output_layout, wlr_output);
}
wlr_output_enable(wlr_output, true);
wlr_output_commit(wlr_output);