diff options
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sway/layout.c b/sway/layout.c index 35aa4942..7eaa9ea4 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -108,6 +108,50 @@ swayc_t *remove_child(swayc_t *child) { | |||
108 | return parent; | 108 | return parent; |
109 | } | 109 | } |
110 | 110 | ||
111 | //TODO: Implement horizontal movement. | ||
112 | //TODO: Implement move to a different workspace. | ||
113 | void move_container(swayc_t *container,swayc_t* root,enum movement_direction direction){ | ||
114 | sway_log(L_DEBUG, "Moved window"); | ||
115 | swayc_t *temp; | ||
116 | int i; | ||
117 | uint clength = root->children->length; | ||
118 | //Rearrange | ||
119 | for (i = 0; i < clength; ++i) { | ||
120 | swayc_t *child = root->children->items[i]; | ||
121 | if (child->handle == container->handle){ | ||
122 | if (clength == 1){ | ||
123 | //Only one container, meh. | ||
124 | break; | ||
125 | } | ||
126 | if (direction == MOVE_LEFT && i > 0){ | ||
127 | temp = root->children->items[i-1]; | ||
128 | root->children->items[i] = temp; | ||
129 | root->children->items[i-1] = container; | ||
130 | arrange_windows(&root_container,-1,-1); | ||
131 | } | ||
132 | else if (direction == MOVE_RIGHT && i < clength-1){ | ||
133 | temp = root->children->items[i+1]; | ||
134 | root->children->items[i] = temp; | ||
135 | root->children->items[i+1] = container; | ||
136 | arrange_windows(&root_container,-1,-1); | ||
137 | |||
138 | } | ||
139 | else if (direction == MOVE_UP){ | ||
140 | sway_log(L_INFO, "Moving up not implemented"); | ||
141 | } | ||
142 | else if (direction == MOVE_DOWN){ | ||
143 | sway_log(L_INFO, "Moving down not implemented"); | ||
144 | } | ||
145 | |||
146 | break; | ||
147 | } | ||
148 | else if (child->children != NULL){ | ||
149 | move_container(container,child,direction); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | } | ||
154 | |||
111 | 155 | ||
112 | void arrange_windows(swayc_t *container, double width, double height) { | 156 | void arrange_windows(swayc_t *container, double width, double height) { |
113 | int i; | 157 | int i; |