summaryrefslogtreecommitdiffstats
path: root/sway/workspace.c
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-18 11:22:52 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-18 11:22:52 -0700
commit03e83c7ef94e90a78390209af8d9c2a0c0adb237 (patch)
treeea13031298833fff8e57ec2b1f2d652d608b7db5 /sway/workspace.c
parentFixed mouse clicks from triggering a segfault (diff)
downloadsway-03e83c7ef94e90a78390209af8d9c2a0c0adb237.tar.gz
sway-03e83c7ef94e90a78390209af8d9c2a0c0adb237.tar.zst
sway-03e83c7ef94e90a78390209af8d9c2a0c0adb237.zip
restored fullscreen/focus behavior
Diffstat (limited to 'sway/workspace.c')
-rw-r--r--sway/workspace.c58
1 files changed, 23 insertions, 35 deletions
diff --git a/sway/workspace.c b/sway/workspace.c
index ed545804..05a669fe 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -178,43 +178,37 @@ void workspace_switch(swayc_t *workspace) {
178 return; 178 return;
179 } 179 }
180 sway_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name); 180 sway_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
181 181 set_focused_container(get_focused_view(workspace));
182 // Remove focus from current view 182 arrange_windows(workspace, -1, -1);
183 swayc_t *current = get_focused_view(&root_container);
184 if (current && current->type == C_VIEW) {
185 wlc_view_set_state(current->handle, WLC_BIT_ACTIVATED, false);
186 }
187
188 set_focused_container(workspace);
189 active_workspace = workspace; 183 active_workspace = workspace;
190} 184}
191 185
192/* XXX:DEBUG:XXX */ 186/* XXX:DEBUG:XXX */
193static void container_log(const swayc_t *c) { 187static void container_log(const swayc_t *c) {
194 fprintf(stderr, "focus:%c|", 188 fprintf(stderr, "focus:%c|",
195 c->is_focused ? 'F' : //Focused 189 c->is_focused ? 'F' : //Focused
196 c == active_workspace ? 'W' : //active workspace 190 c == active_workspace ? 'W' : //active workspace
197 c == &root_container ? 'R' : //root 191 c == &root_container ? 'R' : //root
198 'X');//not any others 192 'X');//not any others
199 fprintf(stderr,"(%p)",c); 193 fprintf(stderr,"(%p)",c);
200 fprintf(stderr,"(p:%p)",c->parent); 194 fprintf(stderr,"(p:%p)",c->parent);
201 fprintf(stderr,"(f:%p)",c->focused); 195 fprintf(stderr,"(f:%p)",c->focused);
202 fprintf(stderr,"(h:%ld)",c->handle); 196 fprintf(stderr,"(h:%ld)",c->handle);
203 fprintf(stderr,"Type:"); 197 fprintf(stderr,"Type:");
204 fprintf(stderr, 198 fprintf(stderr,
205 c->type == C_ROOT ? "Root|" : 199 c->type == C_ROOT ? "Root|" :
206 c->type == C_OUTPUT ? "Output|" : 200 c->type == C_OUTPUT ? "Output|" :
207 c->type == C_WORKSPACE ? "Workspace|" : 201 c->type == C_WORKSPACE ? "Workspace|" :
208 c->type == C_CONTAINER ? "Container|" : 202 c->type == C_CONTAINER ? "Container|" :
209 c->type == C_VIEW ? "View|" : "Unknown|"); 203 c->type == C_VIEW ? "View|" : "Unknown|");
210 fprintf(stderr,"layout:"); 204 fprintf(stderr,"layout:");
211 fprintf(stderr, 205 fprintf(stderr,
212 c->layout == L_NONE ? "NONE|" : 206 c->layout == L_NONE ? "NONE|" :
213 c->layout == L_HORIZ ? "Horiz|": 207 c->layout == L_HORIZ ? "Horiz|":
214 c->layout == L_VERT ? "Vert|": 208 c->layout == L_VERT ? "Vert|":
215 c->layout == L_STACKED ? "Stacked|": 209 c->layout == L_STACKED ? "Stacked|":
216 c->layout == L_FLOATING ? "Floating|": 210 c->layout == L_FLOATING ? "Floating|":
217 "Unknown|"); 211 "Unknown|");
218 fprintf(stderr, "w:%d|h:%d|", c->width, c->height); 212 fprintf(stderr, "w:%d|h:%d|", c->width, c->height);
219 fprintf(stderr, "x:%d|y:%d|", c->x, c->y); 213 fprintf(stderr, "x:%d|y:%d|", c->x, c->y);
220 fprintf(stderr, "vis:%c|", c->visible?'t':'f'); 214 fprintf(stderr, "vis:%c|", c->visible?'t':'f');
@@ -223,30 +217,24 @@ static void container_log(const swayc_t *c) {
223 fprintf(stderr, "children:%d\n",c->children?c->children->length:0); 217 fprintf(stderr, "children:%d\n",c->children?c->children->length:0);
224} 218}
225void layout_log(const swayc_t *c, int depth) { 219void layout_log(const swayc_t *c, int depth) {
226 int i; 220 int i, d;
227 int e = c->children?c->children->length:0; 221 int e = c->children ? c->children->length : 0;
228 for (i = 0; i < depth; ++i) fputc(' ', stderr);
229 container_log(c); 222 container_log(c);
230 if (e) { 223 if (e) {
231 for (i = 0; i < depth; ++i) fputc(' ', stderr);
232 fprintf(stderr,"(\n");
233 for (i = 0; i < e; ++i) { 224 for (i = 0; i < e; ++i) {
225 fputc('|',stderr);
226 for (d = 0; d < depth; ++d) fputc('-', stderr);
234 layout_log(c->children->items[i], depth + 1); 227 layout_log(c->children->items[i], depth + 1);
235 } 228 }
236 for (i = 0; i < depth; ++i) fputc(' ', stderr);
237 fprintf(stderr,")\n");
238 } 229 }
239 if (c->type == C_WORKSPACE) { 230 if (c->type == C_WORKSPACE) {
240 e = c->floating?c->floating->length:0; 231 e = c->floating?c->floating->length:0;
241 for (i = 0; i < depth; ++i) fputc(' ', stderr);
242 if (e) { 232 if (e) {
243 for (i = 0; i < depth; ++i) fputc(' ', stderr);
244 fprintf(stderr,"(\n");
245 for (i = 0; i < e; ++i) { 233 for (i = 0; i < e; ++i) {
234 fputc('|',stderr);
235 for (d = 0; d < depth; ++d) fputc('-', stderr);
246 layout_log(c->floating->items[i], depth + 1); 236 layout_log(c->floating->items[i], depth + 1);
247 } 237 }
248 for (i = 0; i < depth; ++i) fputc(' ', stderr);
249 fprintf(stderr,")\n");
250 } 238 }
251 } 239 }
252} 240}