diff options
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/sway/container.c b/sway/container.c index 4c523827..6c4206fb 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -70,7 +70,7 @@ swayc_t *new_output(wlc_handle handle) { | |||
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | sway_log(L_DEBUG, "Added output %lu:%s", handle, name); | 73 | sway_log(L_DEBUG, "New output %lu:%s", handle, name); |
74 | 74 | ||
75 | struct output_config *oc = NULL; | 75 | struct output_config *oc = NULL; |
76 | int i; | 76 | int i; |
@@ -88,36 +88,12 @@ swayc_t *new_output(wlc_handle handle) { | |||
88 | } | 88 | } |
89 | 89 | ||
90 | swayc_t *output = new_swayc(C_OUTPUT); | 90 | swayc_t *output = new_swayc(C_OUTPUT); |
91 | if (oc && oc->width != -1 && oc->height != -1) { | ||
92 | output->width = oc->width; | ||
93 | output->height = oc->height; | ||
94 | struct wlc_size new_size = { .w = oc->width, .h = oc->height }; | ||
95 | wlc_output_set_resolution(handle, &new_size); | ||
96 | } else { | ||
97 | output->width = size->w; | ||
98 | output->height = size->h; | ||
99 | } | ||
100 | output->handle = handle; | 91 | output->handle = handle; |
101 | output->name = name ? strdup(name) : NULL; | 92 | output->name = name ? strdup(name) : NULL; |
102 | 93 | output->width = size->w; | |
103 | // Find position for it | 94 | output->height = size->h; |
104 | if (oc && oc->x != -1 && oc->y != -1) { | ||
105 | sway_log(L_DEBUG, "Set %s position to %d, %d", name, oc->x, oc->y); | ||
106 | output->x = oc->x; | ||
107 | output->y = oc->y; | ||
108 | } else { | ||
109 | int x = 0; | ||
110 | for (i = 0; i < root_container.children->length; ++i) { | ||
111 | swayc_t *c = root_container.children->items[i]; | ||
112 | if (c->type == C_OUTPUT) { | ||
113 | if (c->width + c->x > x) { | ||
114 | x = c->width + c->x; | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | output->x = x; | ||
119 | } | ||
120 | 95 | ||
96 | apply_output_config(oc, output); | ||
121 | add_child(&root_container, output); | 97 | add_child(&root_container, output); |
122 | 98 | ||
123 | // Create workspace | 99 | // Create workspace |