summaryrefslogtreecommitdiffstats
path: root/sway/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/layout.c')
-rw-r--r--sway/layout.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sway/layout.c b/sway/layout.c
index 8c011fdb..a48f15c4 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
111void move_container(swayc_t *container,swayc_t* root,int direction){
112 sway_log(L_DEBUG, "Moved window");
113 swayc_t *temp;
114 int i;
115 uint clength = root->children->length;
116 //Rearrange
117 for (i = 0; i < clength; ++i) {
118 swayc_t *child = root->children->items[i];
119 if(child->handle == container->handle){
120 if(clength == 1){
121 //Only one container, meh.
122 break;
123 }
124 //TODO: Implement horizontal movement.
125 //TODO: Implement move to a different workspace.
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
112void arrange_windows(swayc_t *container, int width, int height) { 156void arrange_windows(swayc_t *container, int width, int height) {
113 int i; 157 int i;