aboutsummaryrefslogtreecommitdiffstats
path: root/sway/layout.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-08-21 07:24:17 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-08-21 07:24:17 -0400
commita436fc17ffe3b8c7a98e8b0f4ae7ec765635d4aa (patch)
tree100d217f50e6116fbc7823fcb474b1060fde06e6 /sway/layout.c
parentFix compiler warnings (which were really errors) (diff)
parentFixed style errors (diff)
downloadsway-a436fc17ffe3b8c7a98e8b0f4ae7ec765635d4aa.tar.gz
sway-a436fc17ffe3b8c7a98e8b0f4ae7ec765635d4aa.tar.zst
sway-a436fc17ffe3b8c7a98e8b0f4ae7ec765635d4aa.zip
Merge pull request #105 from Half-Shot/master
Basic 'move' functionality.
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 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.
113void 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
112void arrange_windows(swayc_t *container, double width, double height) { 156void arrange_windows(swayc_t *container, double width, double height) {
113 int i; 157 int i;