summaryrefslogtreecommitdiffstats
path: root/sway/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/layout.c')
-rw-r--r--sway/layout.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/sway/layout.c b/sway/layout.c
index 105359d2..9fdfd62a 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -91,6 +91,50 @@ swayc_t *remove_child(swayc_t *child) {
91 return parent; 91 return parent;
92} 92}
93 93
94void move_container(swayc_t *container,swayc_t* root,int direction){
95 sway_log(L_DEBUG, "Moved window");
96 swayc_t *temp;
97 int i;
98 uint clength = root->children->length;
99 //Rearrange
100 for (i = 0; i < clength; ++i) {
101 swayc_t *child = root->children->items[i];
102 if(child->handle == container->handle){
103 if(clength == 1){
104 //Only one container, meh.
105 break;
106 }
107
108 //TODO: Implement move to a different workspace.
109 if(direction == MOVE_LEFT && i > 0){
110 temp = root->children->items[i-1];
111 root->children->items[i] = temp;
112 root->children->items[i-1] = container;
113 arrange_windows(&root_container,-1,-1);
114 }
115 else if(direction == MOVE_RIGHT && i < clength-1){
116 temp = root->children->items[i+1];
117 root->children->items[i] = temp;
118 root->children->items[i+1] = container;
119 arrange_windows(&root_container,-1,-1);
120
121 }
122 else if(direction == MOVE_UP){
123 sway_log(L_INFO, "Moving up not implemented");
124 }
125 else if(direction == MOVE_DOWN){
126 sway_log(L_INFO, "Moving down not implemented");
127 }
128
129 break;
130 }
131 else if(child->children != NULL){
132 move_container(container,child,direction);
133 }
134 }
135
136}
137
94 138
95void arrange_windows(swayc_t *container, int width, int height) { 139void arrange_windows(swayc_t *container, int width, int height) {
96 int i; 140 int i;
@@ -282,4 +326,3 @@ swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent) {
282 } 326 }
283 return NULL; 327 return NULL;
284} 328}
285