aboutsummaryrefslogtreecommitdiffstats
path: root/sway/workspace.c
diff options
context:
space:
mode:
authorLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-15 13:55:06 -0500
committerLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-15 13:55:06 -0500
commit618b3df0513dd2c63f6e64db1e125a609e1ec6b9 (patch)
tree994deaa15dbb04cc6e7cd7a0a79cf44fa18dbdeb /sway/workspace.c
parentAdded layout debugger back in and fixed mutlimonitor layout issues (diff)
downloadsway-618b3df0513dd2c63f6e64db1e125a609e1ec6b9.tar.gz
sway-618b3df0513dd2c63f6e64db1e125a609e1ec6b9.tar.zst
sway-618b3df0513dd2c63f6e64db1e125a609e1ec6b9.zip
Fixed workspace switching in multimonitor layouts
Diffstat (limited to 'sway/workspace.c')
-rw-r--r--sway/workspace.c110
1 files changed, 60 insertions, 50 deletions
diff --git a/sway/workspace.c b/sway/workspace.c
index 3f4590e2..1f7aeb64 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -94,70 +94,80 @@ swayc_t *workspace_find_by_name(const char* name) {
94} 94}
95 95
96void workspace_switch(swayc_t *workspace) { 96void workspace_switch(swayc_t *workspace) {
97 if (workspace != active_workspace && active_workspace) { 97 swayc_t *parent = workspace;
98 sway_log(L_DEBUG, "workspace: changing from '%s' to '%s'", active_workspace->name, workspace->name); 98 while (parent->type != C_OUTPUT) {
99 parent = parent->parent;
100 }
101 // The current workspace of the output our target workspace is in
102 swayc_t *c_workspace = parent->focused;
103 if (workspace != c_workspace && c_workspace) {
104 sway_log(L_DEBUG, "workspace: changing from '%s' to '%s'", c_workspace->name, workspace->name);
99 uint32_t mask = 1; 105 uint32_t mask = 1;
100 // set all c_views in the old workspace to the invisible mask
101 container_map(active_workspace, set_mask, &mask);
102 106
103 // and c_views in the new workspace to the visible mask 107 // set all c_views in the old workspace to the invisible mask if the workspace
108 // is in the same output & c_views in the new workspace to the visible mask
109
110 container_map(c_workspace, set_mask, &mask);
104 mask = 2; 111 mask = 2;
105 container_map(workspace, set_mask, &mask); 112 container_map(workspace, set_mask, &mask);
106
107 wlc_output_set_mask(wlc_get_focused_output(), 2); 113 wlc_output_set_mask(wlc_get_focused_output(), 2);
114
115
116 //wlc_output_set_mask(wlc_get_focused_output(), 2);
108 unfocus_all(&root_container); 117 unfocus_all(&root_container);
109 focus_view(workspace); 118 focus_view(workspace);
110 destroy_workspace(active_workspace); 119
120 destroy_workspace(c_workspace);
111 } 121 }
112 active_workspace = workspace; 122 active_workspace = workspace;
113} 123}
114 124
115/* XXX:DEBUG:XXX */ 125/* XXX:DEBUG:XXX */
116static void container_log(const swayc_t *c) { 126static void container_log(const swayc_t *c) {
117 fprintf(stderr, "focus:%c|", 127 fprintf(stderr, "focus:%c|",
118 c == get_focused_container(&root_container) ? 'F' : //Focused 128 c == get_focused_container(&root_container) ? 'F' : //Focused
119 c == active_workspace ? 'W' : //active workspace 129 c == active_workspace ? 'W' : //active workspace
120 c == &root_container ? 'R' : //root 130 c == &root_container ? 'R' : //root
121 'X');//not any others 131 'X');//not any others
122 fprintf(stderr,"(%p)",c); 132 fprintf(stderr,"(%p)",c);
123 fprintf(stderr,"(p:%p)",c->parent); 133 fprintf(stderr,"(p:%p)",c->parent);
124 fprintf(stderr,"(f:%p)",c->focused); 134 fprintf(stderr,"(f:%p)",c->focused);
125 fprintf(stderr,"Type:"); 135 fprintf(stderr,"Type:");
126 fprintf(stderr, 136 fprintf(stderr,
127 c->type == C_ROOT ? "Root|" : 137 c->type == C_ROOT ? "Root|" :
128 c->type == C_OUTPUT ? "Output|" : 138 c->type == C_OUTPUT ? "Output|" :
129 c->type == C_WORKSPACE ? "Workspace|" : 139 c->type == C_WORKSPACE ? "Workspace|" :
130 c->type == C_CONTAINER ? "Container|" : 140 c->type == C_CONTAINER ? "Container|" :
131 c->type == C_VIEW ? "View|" : 141 c->type == C_VIEW ? "View|" :
132 "Unknown|"); 142 "Unknown|");
133 fprintf(stderr,"layout:"); 143 fprintf(stderr,"layout:");
134 fprintf(stderr, 144 fprintf(stderr,
135 c->layout == L_NONE ? "NONE|" : 145 c->layout == L_NONE ? "NONE|" :
136 c->layout == L_HORIZ ? "Horiz|": 146 c->layout == L_HORIZ ? "Horiz|":
137 c->layout == L_VERT ? "Vert|": 147 c->layout == L_VERT ? "Vert|":
138 c->layout == L_STACKED ? "Stacked|": 148 c->layout == L_STACKED ? "Stacked|":
139 c->layout == L_FLOATING ? "Floating|": 149 c->layout == L_FLOATING ? "Floating|":
140 "Unknown|"); 150 "Unknown|");
141 fprintf(stderr, "w:%d|h:%d|", c->width, c->height); 151 fprintf(stderr, "w:%d|h:%d|", c->width, c->height);
142 fprintf(stderr, "x:%d|y:%d|", c->x, c->y); 152 fprintf(stderr, "x:%d|y:%d|", c->x, c->y);
143 fprintf(stderr, "vis:%c|", c->visible?'t':'f'); 153 fprintf(stderr, "vis:%c|", c->visible?'t':'f');
144 fprintf(stderr, "wgt:%d|", c->weight); 154 fprintf(stderr, "wgt:%d|", c->weight);
145 fprintf(stderr, "name:%.16s|", c->name); 155 fprintf(stderr, "name:%.16s|", c->name);
146 fprintf(stderr, "children:%d\n",c->children?c->children->length:0); 156 fprintf(stderr, "children:%d\n",c->children?c->children->length:0);
147} 157}
148void layout_log(const swayc_t *c, int depth) { 158void layout_log(const swayc_t *c, int depth) {
149 int i; 159 int i;
150 int e = c->children?c->children->length:0; 160 int e = c->children?c->children->length:0;
151 for (i = 0; i < depth; ++i) fputc(' ', stderr); 161 for (i = 0; i < depth; ++i) fputc(' ', stderr);
152 container_log(c); 162 container_log(c);
153 if (e) { 163 if (e) {
154 for (i = 0; i < depth; ++i) fputc(' ', stderr); 164 for (i = 0; i < depth; ++i) fputc(' ', stderr);
155 fprintf(stderr,"(\n"); 165 fprintf(stderr,"(\n");
156 for (i = 0; i < e; ++i) { 166 for (i = 0; i < e; ++i) {
157 layout_log(c->children->items[i], depth + 1); 167 layout_log(c->children->items[i], depth + 1);
158 } 168 }
159 for (i = 0; i < depth; ++i) fputc(' ', stderr); 169 for (i = 0; i < depth; ++i) fputc(' ', stderr);
160 fprintf(stderr,")\n"); 170 fprintf(stderr,")\n");
161 } 171 }
162} 172}
163/* XXX:DEBUG:XXX */ 173/* XXX:DEBUG:XXX */