diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-09 08:32:31 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-09 08:35:33 -0400 |
commit | 086691016e7cbe9794b73c174eaefa77e2d56498 (patch) | |
tree | 6d64cafadaf4812bb0362f23e66e9a50fe50bb3d | |
parent | Add readme (diff) | |
download | sway-086691016e7cbe9794b73c174eaefa77e2d56498.tar.gz sway-086691016e7cbe9794b73c174eaefa77e2d56498.tar.zst sway-086691016e7cbe9794b73c174eaefa77e2d56498.zip |
Handle unmanaged windows appropriately
-rw-r--r-- | sway/handlers.c | 2 | ||||
-rw-r--r-- | sway/layout.c | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 59e67f59..f1098835 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -33,6 +33,7 @@ bool handle_view_created(wlc_handle view) { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | void handle_view_destroyed(wlc_handle view) { | 35 | void handle_view_destroyed(wlc_handle view) { |
36 | sway_log(L_DEBUG, "Destroying window %d", view); | ||
36 | destroy_view(get_swayc_for_handle(view, &root_container)); | 37 | destroy_view(get_swayc_for_handle(view, &root_container)); |
37 | return true; | 38 | return true; |
38 | } | 39 | } |
@@ -53,7 +54,6 @@ bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers | |||
53 | 54 | ||
54 | bool ret = true; | 55 | bool ret = true; |
55 | struct sway_mode *mode = config->current_mode; | 56 | struct sway_mode *mode = config->current_mode; |
56 | sway_log(L_DEBUG, "key pressed: %d %d", sym, modifiers->mods); | ||
57 | 57 | ||
58 | // Lowercase if necessary | 58 | // Lowercase if necessary |
59 | sym = tolower(sym); | 59 | sym = tolower(sym); |
diff --git a/sway/layout.c b/sway/layout.c index 403ec13a..2a57ccce 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -121,6 +121,12 @@ swayc_t *get_focused_container(swayc_t *parent) { | |||
121 | } | 121 | } |
122 | 122 | ||
123 | void add_view(wlc_handle view_handle) { | 123 | void add_view(wlc_handle view_handle) { |
124 | const uint32_t type = wlc_view_get_type(view_handle); | ||
125 | if (type & WLC_BIT_UNMANAGED) { | ||
126 | sway_log(L_DEBUG, "Leaving view %d alone (unmanaged)", view_handle); | ||
127 | return; | ||
128 | } | ||
129 | |||
124 | swayc_t *parent = get_focused_container(&root_container); | 130 | swayc_t *parent = get_focused_container(&root_container); |
125 | sway_log(L_DEBUG, "Adding new view %d under container %p %d", view_handle, parent, parent->type); | 131 | sway_log(L_DEBUG, "Adding new view %d under container %p %d", view_handle, parent, parent->type); |
126 | 132 | ||
@@ -142,6 +148,10 @@ void add_view(wlc_handle view_handle) { | |||
142 | } | 148 | } |
143 | 149 | ||
144 | void destroy_view(swayc_t *view) { | 150 | void destroy_view(swayc_t *view) { |
151 | if (view == NULL) { | ||
152 | sway_log(L_DEBUG, "Warning: NULL passed into destroy_view"); | ||
153 | return; | ||
154 | } | ||
145 | sway_log(L_DEBUG, "Destroying container %p", view); | 155 | sway_log(L_DEBUG, "Destroying container %p", view); |
146 | swayc_t *parent = view->parent; | 156 | swayc_t *parent = view->parent; |
147 | if (!parent) { | 157 | if (!parent) { |