diff options
-rw-r--r-- | sway/border.c | 138 | ||||
-rw-r--r-- | sway/commands.c | 11 | ||||
-rw-r--r-- | sway/config.c | 2 | ||||
-rw-r--r-- | sway/container.c | 2 | ||||
-rw-r--r-- | sway/focus.c | 10 | ||||
-rw-r--r-- | sway/layout.c | 153 |
6 files changed, 245 insertions, 71 deletions
diff --git a/sway/border.c b/sway/border.c index a6ed4238..ada5af2a 100644 --- a/sway/border.c +++ b/sway/border.c | |||
@@ -91,7 +91,7 @@ int get_font_text_height(const char *font) { | |||
91 | return height; | 91 | return height; |
92 | } | 92 | } |
93 | 93 | ||
94 | static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *colors) { | 94 | static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *colors, bool top) { |
95 | struct wlc_geometry *b = &view->border_geometry; | 95 | struct wlc_geometry *b = &view->border_geometry; |
96 | struct wlc_geometry *v = &view->actual_geometry; | 96 | struct wlc_geometry *v = &view->actual_geometry; |
97 | 97 | ||
@@ -118,7 +118,7 @@ static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *col | |||
118 | 118 | ||
119 | // top border | 119 | // top border |
120 | int top_border = v->origin.y - b->origin.y; | 120 | int top_border = v->origin.y - b->origin.y; |
121 | if (top_border > 0) { | 121 | if (top && top_border > 0) { |
122 | render_sharp_line(cr, | 122 | render_sharp_line(cr, |
123 | colors->child_border, | 123 | colors->child_border, |
124 | 0, 0, | 124 | 0, 0, |
@@ -138,38 +138,69 @@ static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *col | |||
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | static void render_with_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *colors) { | 141 | static void render_title_bar(swayc_t *view, cairo_t *cr, struct border_colors *colors) { |
142 | struct wlc_geometry *tb = &view->title_bar_geometry; | 142 | struct wlc_geometry *tb = &view->title_bar_geometry; |
143 | struct wlc_geometry *b = &view->border_geometry; | 143 | struct wlc_geometry *b = &view->border_geometry; |
144 | int title_y = MIN(view->actual_geometry.origin.y - (int)tb->size.h, 0); | 144 | int title_y = MIN(view->actual_geometry.origin.y - (int)tb->size.h, 0); |
145 | 145 | ||
146 | // borders | 146 | // borders |
147 | render_borders(view, cr, colors); | 147 | /* render_borders(view, cr, colors); */ |
148 | 148 | ||
149 | int x = tb->origin.x - b->origin.x; | ||
150 | int y = tb->origin.y - b->origin.y; | ||
151 | |||
152 | /* // title bar background */ | ||
153 | /* cairo_set_source_u32(cr, colors->child_border); */ | ||
154 | /* cairo_rectangle(cr, x, y, tb->size.w, tb->size.h); */ | ||
155 | /* cairo_fill(cr); */ | ||
149 | // title bar background | 156 | // title bar background |
150 | cairo_set_source_u32(cr, colors->background); | 157 | cairo_set_source_u32(cr, colors->background); |
151 | cairo_rectangle(cr, 0, title_y, tb->size.w, tb->size.h); | 158 | cairo_rectangle(cr, 0, title_y, tb->size.w, tb->size.h); |
152 | cairo_fill(cr); | 159 | cairo_fill(cr); |
153 | 160 | ||
154 | // header top line | 161 | // header top line |
162 | /* render_sharp_line(cr, colors->border, x, y, tb->size.w, 1); */ | ||
155 | render_sharp_line(cr, colors->border, 0, title_y, tb->size.w, 1); | 163 | render_sharp_line(cr, colors->border, 0, title_y, tb->size.w, 1); |
156 | 164 | ||
157 | // text | 165 | // text |
158 | if (view->name) { | 166 | if (view->name) { |
159 | int width, height; | 167 | int width, height; |
160 | get_text_size(cr, config->font, &width, &height, false, "%s", view->name); | 168 | get_text_size(cr, config->font, &width, &height, false, "%s", view->name); |
161 | int x = MIN(view->actual_geometry.origin.x, view->border_thickness); | 169 | int x_text = MIN(view->actual_geometry.origin.x, view->border_thickness); |
162 | int y = MIN(view->actual_geometry.origin.y - height - 2, 2); | 170 | int y_text = MIN(view->actual_geometry.origin.y - height - 2, 2); |
163 | cairo_move_to(cr, x, y); | 171 | cairo_move_to(cr, x_text, y_text); |
164 | cairo_set_source_u32(cr, colors->text); | 172 | cairo_set_source_u32(cr, colors->text); |
165 | pango_printf(cr, config->font, false, "%s", view->name); | 173 | pango_printf(cr, config->font, false, "%s", view->name); |
166 | } | 174 | } |
167 | 175 | ||
168 | // header bottom line | 176 | // titlebars has a border all around for tabbed layouts |
169 | render_sharp_line(cr, colors->border, | 177 | if (view->parent->layout == L_TABBED) { |
170 | view->actual_geometry.origin.x - b->origin.x, | 178 | // header bottom line |
171 | title_y + tb->size.h - 1, | 179 | render_sharp_line(cr, colors->border, x, y + tb->size.h - 1, |
172 | view->actual_geometry.size.w, 1); | 180 | tb->size.w, 1); |
181 | |||
182 | // left border | ||
183 | render_sharp_line(cr, colors->border, x, y, 1, tb->size.h); | ||
184 | |||
185 | // right border | ||
186 | render_sharp_line(cr, colors->border, x + tb->size.w - 1, y, | ||
187 | 1, tb->size.h); | ||
188 | |||
189 | return; | ||
190 | } | ||
191 | |||
192 | if ((uint32_t)(view->actual_geometry.origin.y - tb->origin.y) == tb->size.h) { | ||
193 | // header bottom line | ||
194 | render_sharp_line(cr, colors->border, | ||
195 | x + view->actual_geometry.origin.x - b->origin.x, | ||
196 | y + tb->size.h - 1, | ||
197 | view->actual_geometry.size.w, 1); | ||
198 | } else { | ||
199 | // header bottom line | ||
200 | render_sharp_line(cr, colors->border, x, | ||
201 | title_y + tb->size.h - 1, | ||
202 | tb->size.w, 1); | ||
203 | } | ||
173 | } | 204 | } |
174 | 205 | ||
175 | void map_update_view_border(swayc_t *view, void *data) { | 206 | void map_update_view_border(swayc_t *view, void *data) { |
@@ -179,6 +210,10 @@ void map_update_view_border(swayc_t *view, void *data) { | |||
179 | } | 210 | } |
180 | 211 | ||
181 | void update_view_border(swayc_t *view) { | 212 | void update_view_border(swayc_t *view) { |
213 | if (!view->visible) { | ||
214 | return; | ||
215 | } | ||
216 | |||
182 | cairo_t *cr = NULL; | 217 | cairo_t *cr = NULL; |
183 | cairo_surface_t *surface = NULL; | 218 | cairo_surface_t *surface = NULL; |
184 | 219 | ||
@@ -187,6 +222,7 @@ void update_view_border(swayc_t *view) { | |||
187 | view->border = NULL; | 222 | view->border = NULL; |
188 | } | 223 | } |
189 | 224 | ||
225 | // get focused and focused_intactive views | ||
190 | swayc_t *focused = get_focused_view(&root_container); | 226 | swayc_t *focused = get_focused_view(&root_container); |
191 | swayc_t *container = swayc_parent_by_type(view, C_CONTAINER); | 227 | swayc_t *container = swayc_parent_by_type(view, C_CONTAINER); |
192 | swayc_t *focused_inactive = NULL; | 228 | swayc_t *focused_inactive = NULL; |
@@ -199,40 +235,70 @@ void update_view_border(swayc_t *view) { | |||
199 | } | 235 | } |
200 | } | 236 | } |
201 | 237 | ||
202 | switch (view->border_type) { | 238 | swayc_t *p = view->parent; |
203 | case B_NONE: | ||
204 | break; | ||
205 | case B_PIXEL: | ||
206 | cr = create_border_buffer(view, view->border_geometry, &surface); | ||
207 | if (!cr) { | ||
208 | break; | ||
209 | } | ||
210 | 239 | ||
240 | if (p->layout == L_TABBED || p->layout == L_STACKED) { | ||
241 | cr = create_border_buffer(view, view->border_geometry, &surface); | ||
211 | if (focused == view) { | 242 | if (focused == view) { |
212 | render_borders(view, cr, &config->border_colors.focused); | 243 | render_borders(view, cr, &config->border_colors.focused, false); |
213 | } else if (focused_inactive == view) { | 244 | } else if (focused_inactive == view) { |
214 | render_borders(view, cr, &config->border_colors.focused_inactive); | 245 | render_borders(view, cr, &config->border_colors.focused_inactive, false); |
215 | } else { | 246 | } else { |
216 | render_borders(view, cr, &config->border_colors.unfocused); | 247 | render_borders(view, cr, &config->border_colors.unfocused, false); |
217 | } | 248 | } |
218 | 249 | ||
219 | break; | 250 | int i; |
220 | case B_NORMAL: | 251 | for (i = 0; i < p->children->length; ++i) { |
221 | cr = create_border_buffer(view, view->border_geometry, &surface); | 252 | swayc_t *child = p->children->items[i]; |
222 | if (!cr) { | ||
223 | break; | ||
224 | } | ||
225 | 253 | ||
226 | if (focused == view) { | 254 | if (focused == child) { |
227 | render_with_title_bar(view, cr, &config->border_colors.focused); | 255 | render_title_bar(child, cr, &config->border_colors.focused); |
228 | } else if (focused_inactive == view) { | 256 | } else if (focused_inactive == child) { |
229 | render_with_title_bar(view, cr, &config->border_colors.focused_inactive); | 257 | render_title_bar(child, cr, &config->border_colors.focused_inactive); |
230 | } else { | 258 | } else { |
231 | render_with_title_bar(view, cr, &config->border_colors.unfocused); | 259 | render_title_bar(child, cr, &config->border_colors.unfocused); |
260 | } | ||
232 | } | 261 | } |
262 | } else { | ||
263 | switch (view->border_type) { | ||
264 | case B_NONE: | ||
265 | break; | ||
266 | case B_PIXEL: | ||
267 | cr = create_border_buffer(view, view->border_geometry, &surface); | ||
268 | if (!cr) { | ||
269 | break; | ||
270 | } | ||
271 | |||
272 | if (focused == view) { | ||
273 | render_borders(view, cr, &config->border_colors.focused, true); | ||
274 | } else if (focused_inactive == view) { | ||
275 | render_borders(view, cr, &config->border_colors.focused_inactive, true); | ||
276 | } else { | ||
277 | render_borders(view, cr, &config->border_colors.unfocused, true); | ||
278 | } | ||
233 | 279 | ||
234 | break; | 280 | break; |
281 | case B_NORMAL: | ||
282 | cr = create_border_buffer(view, view->border_geometry, &surface); | ||
283 | if (!cr) { | ||
284 | break; | ||
285 | } | ||
286 | |||
287 | if (focused == view) { | ||
288 | render_borders(view, cr, &config->border_colors.focused, false); | ||
289 | render_title_bar(view, cr, &config->border_colors.focused); | ||
290 | } else if (focused_inactive == view) { | ||
291 | render_borders(view, cr, &config->border_colors.focused_inactive, false); | ||
292 | render_title_bar(view, cr, &config->border_colors.focused_inactive); | ||
293 | } else { | ||
294 | render_borders(view, cr, &config->border_colors.unfocused, false); | ||
295 | render_title_bar(view, cr, &config->border_colors.unfocused); | ||
296 | } | ||
297 | |||
298 | break; | ||
299 | } | ||
235 | } | 300 | } |
301 | |||
236 | if (surface) { | 302 | if (surface) { |
237 | cairo_surface_flush(surface); | 303 | cairo_surface_flush(surface); |
238 | cairo_surface_destroy(surface); | 304 | cairo_surface_destroy(surface); |
diff --git a/sway/commands.c b/sway/commands.c index 11284577..07dd715c 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1759,7 +1759,15 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { | |||
1759 | parent = parent->parent; | 1759 | parent = parent->parent; |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | if (strcasecmp(argv[0], "splith") == 0) { | 1762 | if (strcasecmp(argv[0], "default") == 0) { |
1763 | // TODO: determine default from default_orientation and | ||
1764 | // cmd_workspace_layout | ||
1765 | parent->layout = L_HORIZ; | ||
1766 | } else if (strcasecmp(argv[0], "tabbed") == 0) { | ||
1767 | parent->layout = L_TABBED; | ||
1768 | } else if (strcasecmp(argv[0], "stacking") == 0) { | ||
1769 | parent->layout = L_STACKED; | ||
1770 | } else if (strcasecmp(argv[0], "splith") == 0) { | ||
1763 | parent->layout = L_HORIZ; | 1771 | parent->layout = L_HORIZ; |
1764 | } else if (strcasecmp(argv[0], "splitv") == 0) { | 1772 | } else if (strcasecmp(argv[0], "splitv") == 0) { |
1765 | parent->layout = L_VERT; | 1773 | parent->layout = L_VERT; |
@@ -1770,6 +1778,7 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { | |||
1770 | parent->layout = L_VERT; | 1778 | parent->layout = L_VERT; |
1771 | } | 1779 | } |
1772 | } | 1780 | } |
1781 | |||
1773 | arrange_windows(parent, parent->width, parent->height); | 1782 | arrange_windows(parent, parent->width, parent->height); |
1774 | 1783 | ||
1775 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 1784 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
diff --git a/sway/config.c b/sway/config.c index ebcee95b..c11ccf53 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -160,7 +160,7 @@ static void config_defaults(struct sway_config *config) { | |||
160 | config->dragging_key = M_LEFT_CLICK; | 160 | config->dragging_key = M_LEFT_CLICK; |
161 | config->resizing_key = M_RIGHT_CLICK; | 161 | config->resizing_key = M_RIGHT_CLICK; |
162 | config->floating_scroll = FSB_GAPS_INNER; | 162 | config->floating_scroll = FSB_GAPS_INNER; |
163 | config->default_layout = L_NONE; | 163 | config->default_layout = L_HORIZ; |
164 | config->default_orientation = L_NONE; | 164 | config->default_orientation = L_NONE; |
165 | config->font = strdup("monospace 10"); | 165 | config->font = strdup("monospace 10"); |
166 | config->font_height = get_font_text_height(config->font); | 166 | config->font_height = get_font_text_height(config->font); |
diff --git a/sway/container.c b/sway/container.c index 95a46632..e77ba062 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -725,7 +725,7 @@ void update_visibility_output(swayc_t *container, wlc_handle output) { | |||
725 | if (parent->type == C_OUTPUT | 725 | if (parent->type == C_OUTPUT |
726 | || parent->layout == L_TABBED | 726 | || parent->layout == L_TABBED |
727 | || parent->layout == L_STACKED) { | 727 | || parent->layout == L_STACKED) { |
728 | container->visible = parent->focused == container; | 728 | container->visible = parent->focused == container && parent->visible; |
729 | } | 729 | } |
730 | // Set visibility and output for view | 730 | // Set visibility and output for view |
731 | if (container->type == C_VIEW) { | 731 | if (container->type == C_VIEW) { |
diff --git a/sway/focus.c b/sway/focus.c index cdc9a888..8acdc772 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -141,9 +141,17 @@ bool set_focused_container(swayc_t *c) { | |||
141 | // set focus if view_focus is unlocked | 141 | // set focus if view_focus is unlocked |
142 | if (!locked_view_focus) { | 142 | if (!locked_view_focus) { |
143 | wlc_view_focus(p->handle); | 143 | wlc_view_focus(p->handle); |
144 | update_view_border(p); | 144 | if (p->parent->layout != L_TABBED |
145 | && p->parent->layout != L_STACKED) { | ||
146 | update_view_border(p); | ||
147 | } | ||
145 | } | 148 | } |
146 | } | 149 | } |
150 | |||
151 | // rearrange if parent container is tabbed/stacked | ||
152 | if (p->parent->layout == L_TABBED || p->parent->layout == L_STACKED) { | ||
153 | arrange_windows(p->parent, -1, -1); | ||
154 | } | ||
147 | } else if (p->type == C_WORKSPACE) { | 155 | } else if (p->type == C_WORKSPACE) { |
148 | // remove previous focus if view_focus is unlocked | 156 | // remove previous focus if view_focus is unlocked |
149 | if (!locked_view_focus) { | 157 | if (!locked_view_focus) { |
diff --git a/sway/layout.c b/sway/layout.c index 0b498937..0328d361 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -453,14 +453,24 @@ void update_geometry(swayc_t *container) { | |||
453 | gap -= 1; | 453 | gap -= 1; |
454 | } | 454 | } |
455 | 455 | ||
456 | int width = container->width; | ||
457 | int height = container->height; | ||
458 | |||
459 | // use parent size if window is in a stacked/tabbed layout | ||
460 | swayc_t *parent = container->parent; | ||
461 | if (parent->layout == L_STACKED || parent->layout == L_TABBED) { | ||
462 | width = parent->width; | ||
463 | height = parent->height; | ||
464 | } | ||
465 | |||
456 | struct wlc_geometry geometry = { | 466 | struct wlc_geometry geometry = { |
457 | .origin = { | 467 | .origin = { |
458 | .x = container->x + gap/2 < op->width ? container->x + gap/2 : op->width-1, | 468 | .x = container->x + gap/2 < op->width ? container->x + gap/2 : op->width-1, |
459 | .y = container->y + gap/2 < op->height ? container->y + gap/2 : op->height-1 | 469 | .y = container->y + gap/2 < op->height ? container->y + gap/2 : op->height-1 |
460 | }, | 470 | }, |
461 | .size = { | 471 | .size = { |
462 | .w = container->width > gap ? container->width - gap : 1, | 472 | .w = width > gap ? width - gap : 1, |
463 | .h = container->height > gap ? container->height - gap : 1, | 473 | .h = height > gap ? height - gap : 1, |
464 | } | 474 | } |
465 | }; | 475 | }; |
466 | if (swayc_is_fullscreen(container)) { | 476 | if (swayc_is_fullscreen(container)) { |
@@ -480,16 +490,16 @@ void update_geometry(swayc_t *container) { | |||
480 | // with gap, and align correctly). | 490 | // with gap, and align correctly). |
481 | if (container->x - gap <= ws->x) { | 491 | if (container->x - gap <= ws->x) { |
482 | geometry.origin.x = ws->x; | 492 | geometry.origin.x = ws->x; |
483 | geometry.size.w = container->width - gap/2; | 493 | geometry.size.w = width - gap/2; |
484 | } | 494 | } |
485 | if (container->y - gap <= ws->y) { | 495 | if (container->y - gap <= ws->y) { |
486 | geometry.origin.y = ws->y; | 496 | geometry.origin.y = ws->y; |
487 | geometry.size.h = container->height - gap/2; | 497 | geometry.size.h = height - gap/2; |
488 | } | 498 | } |
489 | if (container->x + container->width + gap >= ws->x + ws->width) { | 499 | if (container->x + width + gap >= ws->x + ws->width) { |
490 | geometry.size.w = ws->x + ws->width - geometry.origin.x; | 500 | geometry.size.w = ws->x + ws->width - geometry.origin.x; |
491 | } | 501 | } |
492 | if (container->y + container->height + gap >= ws->y + ws->height) { | 502 | if (container->y + height + gap >= ws->y + ws->height) { |
493 | geometry.size.h = ws->y + ws->height - geometry.origin.y; | 503 | geometry.size.h = ws->y + ws->height - geometry.origin.y; |
494 | } | 504 | } |
495 | } | 505 | } |
@@ -533,33 +543,93 @@ void update_geometry(swayc_t *container) { | |||
533 | } | 543 | } |
534 | } | 544 | } |
535 | 545 | ||
536 | switch (container->border_type) { | 546 | int title_bar_height = config->font_height + 4; //borders + padding |
537 | case B_NONE: | 547 | |
538 | break; | 548 | if (parent->layout == L_TABBED) { |
539 | case B_PIXEL: | 549 | int i, x = 0, w, l, r; |
550 | l = parent->children->length; | ||
551 | w = geometry.size.w / l; | ||
552 | r = geometry.size.w % l; | ||
553 | for (i = 0; i < parent->children->length; ++i) { | ||
554 | swayc_t *view = parent->children->items[i]; | ||
555 | if (view == container) { | ||
556 | x = w * i; | ||
557 | if (i == l - 1) { | ||
558 | w += r; | ||
559 | } | ||
560 | break; | ||
561 | } | ||
562 | } | ||
563 | |||
564 | struct wlc_geometry title_bar = { | ||
565 | .origin = { | ||
566 | .x = container->border_geometry.origin.x + x, | ||
567 | .y = container->border_geometry.origin.y | ||
568 | }, | ||
569 | .size = { | ||
570 | .w = w, | ||
571 | .h = title_bar_height | ||
572 | } | ||
573 | }; | ||
540 | geometry.origin.x += border_left; | 574 | geometry.origin.x += border_left; |
541 | geometry.origin.y += border_top; | 575 | geometry.origin.y += title_bar.size.h; |
542 | geometry.size.w -= (border_left + border_right); | 576 | geometry.size.w -= (border_left + border_right); |
543 | geometry.size.h -= (border_top + border_bottom); | 577 | geometry.size.h -= (border_bottom + title_bar.size.h); |
544 | break; | 578 | container->title_bar_geometry = title_bar; |
545 | case B_NORMAL: | 579 | } else if (parent->layout == L_STACKED) { |
546 | { | 580 | int i, y; |
547 | struct wlc_geometry title_bar = { | 581 | for (i = 0; i < parent->children->length; ++i) { |
548 | .origin = { | 582 | swayc_t *view = parent->children->items[i]; |
549 | .x = container->border_geometry.origin.x, | 583 | if (view == container) { |
550 | .y = container->border_geometry.origin.y | 584 | y = title_bar_height * i; |
551 | }, | 585 | } |
552 | .size = { | 586 | } |
553 | .w = container->border_geometry.size.w, | 587 | |
554 | .h = config->font_height + 4 // borders + padding | 588 | struct wlc_geometry title_bar = { |
555 | } | 589 | .origin = { |
556 | }; | 590 | .x = container->border_geometry.origin.x, |
591 | .y = container->border_geometry.origin.y + y | ||
592 | }, | ||
593 | .size = { | ||
594 | .w = container->border_geometry.size.w, | ||
595 | .h = title_bar_height | ||
596 | } | ||
597 | }; | ||
598 | title_bar_height = title_bar_height * parent->children->length; | ||
599 | geometry.origin.x += border_left; | ||
600 | geometry.origin.y += title_bar_height; | ||
601 | geometry.size.w -= (border_left + border_right); | ||
602 | geometry.size.h -= (border_bottom + title_bar_height); | ||
603 | container->title_bar_geometry = title_bar; | ||
604 | } else { | ||
605 | switch (container->border_type) { | ||
606 | case B_NONE: | ||
607 | break; | ||
608 | case B_PIXEL: | ||
557 | geometry.origin.x += border_left; | 609 | geometry.origin.x += border_left; |
558 | geometry.origin.y += title_bar.size.h; | 610 | geometry.origin.y += border_top; |
559 | geometry.size.w -= (border_left + border_right); | 611 | geometry.size.w -= (border_left + border_right); |
560 | geometry.size.h -= (border_bottom + title_bar.size.h); | 612 | geometry.size.h -= (border_top + border_bottom); |
561 | container->title_bar_geometry = title_bar; | ||
562 | break; | 613 | break; |
614 | case B_NORMAL: | ||
615 | { | ||
616 | struct wlc_geometry title_bar = { | ||
617 | .origin = { | ||
618 | .x = container->border_geometry.origin.x, | ||
619 | .y = container->border_geometry.origin.y | ||
620 | }, | ||
621 | .size = { | ||
622 | .w = container->border_geometry.size.w, | ||
623 | .h = title_bar_height | ||
624 | } | ||
625 | }; | ||
626 | geometry.origin.x += border_left; | ||
627 | geometry.origin.y += title_bar.size.h; | ||
628 | geometry.size.w -= (border_left + border_right); | ||
629 | geometry.size.h -= (border_bottom + title_bar.size.h); | ||
630 | container->title_bar_geometry = title_bar; | ||
631 | break; | ||
632 | } | ||
563 | } | 633 | } |
564 | } | 634 | } |
565 | 635 | ||
@@ -648,7 +718,7 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
648 | height = container->height = height - gap * 2; | 718 | height = container->height = height - gap * 2; |
649 | sway_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", container->name, container->x, container->y); | 719 | sway_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", container->name, container->x, container->y); |
650 | } | 720 | } |
651 | // children are properly handled below | 721 | // children are properly handled below |
652 | break; | 722 | break; |
653 | case C_VIEW: | 723 | case C_VIEW: |
654 | { | 724 | { |
@@ -683,6 +753,7 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
683 | } | 753 | } |
684 | scale += *old_width; | 754 | scale += *old_width; |
685 | } | 755 | } |
756 | |||
686 | // Resize windows | 757 | // Resize windows |
687 | if (scale > 0.1) { | 758 | if (scale > 0.1) { |
688 | scale = width / scale; | 759 | scale = width / scale; |
@@ -734,6 +805,26 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
734 | } | 805 | } |
735 | } | 806 | } |
736 | break; | 807 | break; |
808 | case L_TABBED: | ||
809 | case L_STACKED: | ||
810 | { | ||
811 | swayc_t *focused = NULL; | ||
812 | for (i = 0; i < container->children->length; ++i) { | ||
813 | swayc_t *child = container->children->items[i]; | ||
814 | child->x = x; | ||
815 | child->y = y; | ||
816 | if (child == container->focused) { | ||
817 | focused = child; | ||
818 | } else { | ||
819 | arrange_windows_r(child, -1, -1); | ||
820 | } | ||
821 | } | ||
822 | |||
823 | if (focused) { | ||
824 | arrange_windows_r(focused, -1, -1); | ||
825 | } | ||
826 | break; | ||
827 | } | ||
737 | } | 828 | } |
738 | 829 | ||
739 | // Arrage floating layouts for workspaces last | 830 | // Arrage floating layouts for workspaces last |
@@ -840,12 +931,12 @@ swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_directio | |||
840 | return get_swayc_in_output_direction(output, dir); | 931 | return get_swayc_in_output_direction(output, dir); |
841 | } else { | 932 | } else { |
842 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { | 933 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { |
843 | if (parent->layout == L_HORIZ) { | 934 | if (parent->layout == L_HORIZ || parent->layout == L_TABBED) { |
844 | can_move = true; | 935 | can_move = true; |
845 | diff = dir == MOVE_LEFT ? -1 : 1; | 936 | diff = dir == MOVE_LEFT ? -1 : 1; |
846 | } | 937 | } |
847 | } else { | 938 | } else { |
848 | if (parent->layout == L_VERT) { | 939 | if (parent->layout == L_VERT || parent->layout == L_STACKED) { |
849 | can_move = true; | 940 | can_move = true; |
850 | diff = dir == MOVE_UP ? -1 : 1; | 941 | diff = dir == MOVE_UP ? -1 : 1; |
851 | } | 942 | } |