diff options
author | Half-Shot <half-shot@molrams.com> | 2015-08-20 21:27:38 +0100 |
---|---|---|
committer | Half-Shot <half-shot@molrams.com> | 2015-08-20 21:29:40 +0100 |
commit | 2a62c5c7fb71fc815663281793ba6a89d2b246ed (patch) | |
tree | 88928911011bf8c1726198a7cbed8e21bb140253 /sway/layout.c | |
parent | Merge branch 'master' of https://github.com/SirCmpwn/sway (diff) | |
download | sway-2a62c5c7fb71fc815663281793ba6a89d2b246ed.tar.gz sway-2a62c5c7fb71fc815663281793ba6a89d2b246ed.tar.zst sway-2a62c5c7fb71fc815663281793ba6a89d2b246ed.zip |
Basic left right move command implemented.
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 45 |
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 | ||
94 | void 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 | ||
95 | void arrange_windows(swayc_t *container, int width, int height) { | 139 | void 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 | |||