aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-18 21:54:09 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-18 22:02:03 +1000
commit16c663ed49e3950388901f220066e4da69956dfb (patch)
treebf71a43528328a786be1a4de02781e6e83aea406 /sway/tree/layout.c
parentMerge pull request #2480 from RyanDwyer/fix-mod-resize (diff)
downloadsway-16c663ed49e3950388901f220066e4da69956dfb.tar.gz
sway-16c663ed49e3950388901f220066e4da69956dfb.tar.zst
sway-16c663ed49e3950388901f220066e4da69956dfb.zip
Rename container_sort_workspaces and container_wrap_children
This commit renames container_sort_workspaces to output_sort_workspaces and moves it to output.c. This also renames container_wrap_children to workspace_wrap_children and moves it to workspace.c. This function is only called with workspaces.
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c23
1 files changed, 0 insertions, 23 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 2b710403..49ec806e 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -1,5 +1,4 @@
1#define _POSIX_C_SOURCE 200809L 1#define _POSIX_C_SOURCE 200809L
2#include <ctype.h>
3#include <math.h> 2#include <math.h>
4#include <stdbool.h> 3#include <stdbool.h>
5#include <stdlib.h> 4#include <stdlib.h>
@@ -591,28 +590,6 @@ enum sway_container_layout container_get_default_layout(
591 } 590 }
592} 591}
593 592
594static int sort_workspace_cmp_qsort(const void *_a, const void *_b) {
595 struct sway_container *a = *(void **)_a;
596 struct sway_container *b = *(void **)_b;
597 int retval = 0;
598
599 if (isdigit(a->name[0]) && isdigit(b->name[0])) {
600 int a_num = strtol(a->name, NULL, 10);
601 int b_num = strtol(b->name, NULL, 10);
602 retval = (a_num < b_num) ? -1 : (a_num > b_num);
603 } else if (isdigit(a->name[0])) {
604 retval = -1;
605 } else if (isdigit(b->name[0])) {
606 retval = 1;
607 }
608
609 return retval;
610}
611
612void container_sort_workspaces(struct sway_container *output) {
613 list_stable_sort(output->children, sort_workspace_cmp_qsort);
614}
615
616/** 593/**
617 * Get swayc in the direction of newly entered output. 594 * Get swayc in the direction of newly entered output.
618 */ 595 */