Handle unmanaged windows appropriately

This commit is contained in:
Drew DeVault 2015-08-09 08:32:31 -04:00
parent f2b9fd6f39
commit 086691016e
2 changed files with 11 additions and 1 deletions

View file

@ -33,6 +33,7 @@ bool handle_view_created(wlc_handle view) {
} }
void handle_view_destroyed(wlc_handle view) { void handle_view_destroyed(wlc_handle view) {
sway_log(L_DEBUG, "Destroying window %d", view);
destroy_view(get_swayc_for_handle(view, &root_container)); destroy_view(get_swayc_for_handle(view, &root_container));
return true; return true;
} }
@ -53,7 +54,6 @@ bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers
bool ret = true; bool ret = true;
struct sway_mode *mode = config->current_mode; struct sway_mode *mode = config->current_mode;
sway_log(L_DEBUG, "key pressed: %d %d", sym, modifiers->mods);
// Lowercase if necessary // Lowercase if necessary
sym = tolower(sym); sym = tolower(sym);

View file

@ -121,6 +121,12 @@ swayc_t *get_focused_container(swayc_t *parent) {
} }
void add_view(wlc_handle view_handle) { void add_view(wlc_handle view_handle) {
const uint32_t type = wlc_view_get_type(view_handle);
if (type & WLC_BIT_UNMANAGED) {
sway_log(L_DEBUG, "Leaving view %d alone (unmanaged)", view_handle);
return;
}
swayc_t *parent = get_focused_container(&root_container); swayc_t *parent = get_focused_container(&root_container);
sway_log(L_DEBUG, "Adding new view %d under container %p %d", view_handle, parent, parent->type); sway_log(L_DEBUG, "Adding new view %d under container %p %d", view_handle, parent, parent->type);
@ -142,6 +148,10 @@ void add_view(wlc_handle view_handle) {
} }
void destroy_view(swayc_t *view) { void destroy_view(swayc_t *view) {
if (view == NULL) {
sway_log(L_DEBUG, "Warning: NULL passed into destroy_view");
return;
}
sway_log(L_DEBUG, "Destroying container %p", view); sway_log(L_DEBUG, "Destroying container %p", view);
swayc_t *parent = view->parent; swayc_t *parent = view->parent;
if (!parent) { if (!parent) {