|
|
|
@ -70,7 +70,7 @@ swayc_t *new_output(wlc_handle handle) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sway_log(L_DEBUG, "Added output %lu:%s", handle, name);
|
|
|
|
|
sway_log(L_DEBUG, "New output %lu:%s", handle, name);
|
|
|
|
|
|
|
|
|
|
struct output_config *oc = NULL;
|
|
|
|
|
int i;
|
|
|
|
@ -88,36 +88,12 @@ swayc_t *new_output(wlc_handle handle) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
swayc_t *output = new_swayc(C_OUTPUT);
|
|
|
|
|
if (oc && oc->width != -1 && oc->height != -1) {
|
|
|
|
|
output->width = oc->width;
|
|
|
|
|
output->height = oc->height;
|
|
|
|
|
struct wlc_size new_size = { .w = oc->width, .h = oc->height };
|
|
|
|
|
wlc_output_set_resolution(handle, &new_size);
|
|
|
|
|
} else {
|
|
|
|
|
output->width = size->w;
|
|
|
|
|
output->height = size->h;
|
|
|
|
|
}
|
|
|
|
|
output->handle = handle;
|
|
|
|
|
output->name = name ? strdup(name) : NULL;
|
|
|
|
|
|
|
|
|
|
// Find position for it
|
|
|
|
|
if (oc && oc->x != -1 && oc->y != -1) {
|
|
|
|
|
sway_log(L_DEBUG, "Set %s position to %d, %d", name, oc->x, oc->y);
|
|
|
|
|
output->x = oc->x;
|
|
|
|
|
output->y = oc->y;
|
|
|
|
|
} else {
|
|
|
|
|
int x = 0;
|
|
|
|
|
for (i = 0; i < root_container.children->length; ++i) {
|
|
|
|
|
swayc_t *c = root_container.children->items[i];
|
|
|
|
|
if (c->type == C_OUTPUT) {
|
|
|
|
|
if (c->width + c->x > x) {
|
|
|
|
|
x = c->width + c->x;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
output->x = x;
|
|
|
|
|
}
|
|
|
|
|
output->width = size->w;
|
|
|
|
|
output->height = size->h;
|
|
|
|
|
|
|
|
|
|
apply_output_config(oc, output);
|
|
|
|
|
add_child(&root_container, output);
|
|
|
|
|
|
|
|
|
|
// Create workspace
|
|
|
|
|