diff options
author | 2015-08-09 20:40:29 -0400 | |
---|---|---|
committer | 2015-08-09 20:40:52 -0400 | |
commit | 2b1a0728b8a37ae8551df29574ddcf5d01f99199 (patch) | |
tree | 06738548f3642a98eccde5ee8b823159a06db272 | |
parent | log: add newline (diff) | |
download | sway-2b1a0728b8a37ae8551df29574ddcf5d01f99199.tar.gz sway-2b1a0728b8a37ae8551df29574ddcf5d01f99199.tar.zst sway-2b1a0728b8a37ae8551df29574ddcf5d01f99199.zip |
Keep track of window names
-rw-r--r-- | sway/layout.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sway/layout.c b/sway/layout.c index 7dbe686a..2913daa9 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -116,6 +116,9 @@ void init_layout() { | |||
116 | void free_swayc(swayc_t *container) { | 116 | void free_swayc(swayc_t *container) { |
117 | // NOTE: Does not handle moving children into a different container | 117 | // NOTE: Does not handle moving children into a different container |
118 | list_free(container->children); | 118 | list_free(container->children); |
119 | if (container->name) { | ||
120 | free(container->name); | ||
121 | } | ||
119 | free(container); | 122 | free(container); |
120 | } | 123 | } |
121 | 124 | ||
@@ -147,13 +150,14 @@ swayc_t *get_focused_container(swayc_t *parent) { | |||
147 | 150 | ||
148 | void add_view(wlc_handle view_handle) { | 151 | void add_view(wlc_handle view_handle) { |
149 | const uint32_t type = wlc_view_get_type(view_handle); | 152 | const uint32_t type = wlc_view_get_type(view_handle); |
150 | if (type & WLC_BIT_UNMANAGED) { | 153 | const char *title = wlc_view_get_title(view_handle); |
151 | sway_log(L_DEBUG, "Leaving view %d alone (unmanaged)", view_handle); | 154 | if ((type & WLC_BIT_UNMANAGED) || (type & WLC_BIT_POPUP) || (type & WLC_BIT_MODAL) || (type & WLC_BIT_SPLASH)) { |
155 | sway_log(L_DEBUG, "Leaving view %d:%s alone (unmanaged)", view_handle, title); | ||
152 | return; | 156 | return; |
153 | } | 157 | } |
154 | 158 | ||
155 | swayc_t *parent = get_focused_container(&root_container); | 159 | swayc_t *parent = get_focused_container(&root_container); |
156 | sway_log(L_DEBUG, "Adding new view %d under container %p %d", view_handle, parent, parent->type); | 160 | sway_log(L_DEBUG, "Adding new view %d:%s under container %p %d", view_handle, title, parent, parent->type); |
157 | 161 | ||
158 | while (parent->type == C_VIEW) { | 162 | while (parent->type == C_VIEW) { |
159 | parent = parent->parent; | 163 | parent = parent->parent; |
@@ -165,6 +169,8 @@ void add_view(wlc_handle view_handle) { | |||
165 | view->handle = view_handle; | 169 | view->handle = view_handle; |
166 | view->parent = parent; | 170 | view->parent = parent; |
167 | view->type = C_VIEW; | 171 | view->type = C_VIEW; |
172 | view->name = malloc(strlen(title) + 1); | ||
173 | strcpy(view->name, title); | ||
168 | add_child(parent, view); | 174 | add_child(parent, view); |
169 | 175 | ||
170 | unfocus_all(&root_container); | 176 | unfocus_all(&root_container); |