aboutsummaryrefslogtreecommitdiff
path: root/sway/layout.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-08-21 07:24:17 -0400
committerDrew DeVault <sir@cmpwn.com>2015-08-21 07:24:17 -0400
commita436fc17ffe3b8c7a98e8b0f4ae7ec765635d4aa (patch)
tree100d217f50e6116fbc7823fcb474b1060fde06e6 /sway/layout.c
parent0266b0666a837db946bc9bbb599136da0b569320 (diff)
parent68213d57c5c758d05582ef8a9f0db226ddbaefc7 (diff)
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) {
return parent;
}
+//TODO: Implement horizontal movement.
+//TODO: Implement move to a different workspace.
+void move_container(swayc_t *container,swayc_t* root,enum movement_direction direction){
+ sway_log(L_DEBUG, "Moved window");
+ swayc_t *temp;
+ int i;
+ uint clength = root->children->length;
+ //Rearrange
+ for (i = 0; i < clength; ++i) {
+ swayc_t *child = root->children->items[i];
+ if (child->handle == container->handle){
+ if (clength == 1){
+ //Only one container, meh.
+ break;
+ }
+ if (direction == MOVE_LEFT && i > 0){
+ temp = root->children->items[i-1];
+ root->children->items[i] = temp;
+ root->children->items[i-1] = container;
+ arrange_windows(&root_container,-1,-1);
+ }
+ else if (direction == MOVE_RIGHT && i < clength-1){
+ temp = root->children->items[i+1];
+ root->children->items[i] = temp;
+ root->children->items[i+1] = container;
+ arrange_windows(&root_container,-1,-1);
+
+ }
+ else if (direction == MOVE_UP){
+ sway_log(L_INFO, "Moving up not implemented");
+ }
+ else if (direction == MOVE_DOWN){
+ sway_log(L_INFO, "Moving down not implemented");
+ }
+
+ break;
+ }
+ else if (child->children != NULL){
+ move_container(container,child,direction);
+ }
+ }
+
+}
+
void arrange_windows(swayc_t *container, double width, double height) {
int i;