summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <ddevault@linode.com>2015-08-10 11:50:32 -0400
committerLibravatar Drew DeVault <ddevault@linode.com>2015-08-10 11:50:32 -0400
commit06bca18a09d102aeed07284a4155909f6b75d896 (patch)
tree5a51f970e34acddea33d110dd4397b548a57e11f
parentAdd WIP notice (diff)
downloadsway-06bca18a09d102aeed07284a4155909f6b75d896.tar.gz
sway-06bca18a09d102aeed07284a4155909f6b75d896.tar.zst
sway-06bca18a09d102aeed07284a4155909f6b75d896.zip
Fix issue with untitled windows
-rw-r--r--sway/layout.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sway/layout.c b/sway/layout.c
index e9fa2a7a..d7806ee5 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -163,13 +163,14 @@ swayc_t *get_focused_container(swayc_t *parent) {
163void add_view(wlc_handle view_handle) { 163void add_view(wlc_handle view_handle) {
164 const uint32_t type = wlc_view_get_type(view_handle); 164 const uint32_t type = wlc_view_get_type(view_handle);
165 const char *title = wlc_view_get_title(view_handle); 165 const char *title = wlc_view_get_title(view_handle);
166 if ((type & WLC_BIT_UNMANAGED) || (type & WLC_BIT_POPUP) || (type & WLC_BIT_MODAL) || (type & WLC_BIT_SPLASH)) { 166 if ((type & WLC_BIT_OVERRIDE_REDIRECT) || (type & WLC_BIT_UNMANAGED) || (type &
167 WLC_BIT_POPUP) || (type & WLC_BIT_MODAL) || (type & WLC_BIT_SPLASH)) {
167 sway_log(L_DEBUG, "Leaving view %d:%s alone (unmanaged)", view_handle, title); 168 sway_log(L_DEBUG, "Leaving view %d:%s alone (unmanaged)", view_handle, title);
168 return; 169 return;
169 } 170 }
170 171
171 swayc_t *parent = get_focused_container(&root_container); 172 swayc_t *parent = get_focused_container(&root_container);
172 sway_log(L_DEBUG, "Adding new view %d:%s under container %p %d", view_handle, title, parent, parent->type); 173 sway_log(L_DEBUG, "Adding new view %d:%s:%d under container %p %d", view_handle, title, type, parent, parent->type);
173 174
174 while (parent->type == C_VIEW) { 175 while (parent->type == C_VIEW) {
175 parent = parent->parent; 176 parent = parent->parent;
@@ -181,8 +182,10 @@ void add_view(wlc_handle view_handle) {
181 view->handle = view_handle; 182 view->handle = view_handle;
182 view->parent = parent; 183 view->parent = parent;
183 view->type = C_VIEW; 184 view->type = C_VIEW;
184 view->name = malloc(strlen(title) + 1); 185 if (title) {
185 strcpy(view->name, title); 186 view->name = malloc(strlen(title) + 1);
187 strcpy(view->name, title);
188 }
186 add_child(parent, view); 189 add_child(parent, view);
187 190
188 unfocus_all(&root_container); 191 unfocus_all(&root_container);