diff options
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sway/layout.c b/sway/layout.c index 5e144cd8..e196ebd3 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -349,10 +349,31 @@ static void swap_children(swayc_t *container, int a, int b) { | |||
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | void move_container(swayc_t *container, enum movement_direction dir) { | 352 | void move_container(swayc_t *container, enum movement_direction dir, int move_amt) { |
353 | enum swayc_layouts layout = L_NONE; | 353 | enum swayc_layouts layout = L_NONE; |
354 | swayc_t *parent = container->parent; | 354 | swayc_t *parent = container->parent; |
355 | if (container->is_floating || (container->type != C_VIEW && container->type != C_CONTAINER)) { | 355 | if (container->is_floating) { |
356 | swayc_t *output = swayc_parent_by_type(container, C_OUTPUT); | ||
357 | switch(dir) { | ||
358 | case MOVE_LEFT: | ||
359 | container->x = MAX(0, container->x - move_amt); | ||
360 | break; | ||
361 | case MOVE_RIGHT: | ||
362 | container->x = MIN(output->width - container->width, container->x + move_amt); | ||
363 | break; | ||
364 | case MOVE_UP: | ||
365 | container->y = MAX(0, container->y - move_amt); | ||
366 | break; | ||
367 | case MOVE_DOWN: | ||
368 | container->y = MIN(output->height - container->height, container->y + move_amt); | ||
369 | break; | ||
370 | default: | ||
371 | break; | ||
372 | } | ||
373 | update_geometry(container); | ||
374 | return; | ||
375 | } | ||
376 | if (container->type != C_VIEW && container->type != C_CONTAINER) { | ||
356 | return; | 377 | return; |
357 | } | 378 | } |
358 | if (dir == MOVE_UP || dir == MOVE_DOWN) { | 379 | if (dir == MOVE_UP || dir == MOVE_DOWN) { |