From 498cf268f712e0bc8d00cf9ef7e3886129904c67 Mon Sep 17 00:00:00 2001 From: taiyu Date: Sun, 16 Aug 2015 18:24:46 -0700 Subject: unmanaged views handled better --- sway/container.c | 12 ++---------- sway/handlers.c | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sway/container.c b/sway/container.c index 3158b8b0..89958a4f 100644 --- a/sway/container.c +++ b/sway/container.c @@ -125,18 +125,10 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) { } swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { - const uint32_t type = wlc_view_get_type(handle); const char *title = wlc_view_get_title(handle); - /* Skip if unmanaged window */ - if ((type & WLC_BIT_OVERRIDE_REDIRECT) || (type & WLC_BIT_UNMANAGED) || - (type & WLC_BIT_POPUP) || (type & WLC_BIT_MODAL) || (type & WLC_BIT_SPLASH)) { - sway_log(L_DEBUG, "Leaving view %d:%s alone (unmanaged)", handle, title); - return NULL; - } - swayc_t *view = new_swayc(C_VIEW); - sway_log(L_DEBUG, "Adding new view %d:%s:%d to container %p %d", - handle, title, type, sibling, sibling?sibling->type:0); + sway_log(L_DEBUG, "Adding new view %d:%s to container %p %d", + handle, title, sibling, sibling?sibling->type:0); //Setup values view->handle = handle; view->name = strdup(title); diff --git a/sway/handlers.c b/sway/handlers.c index e57b791b..817f197e 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -87,17 +87,26 @@ static void handle_output_focused(wlc_handle output, bool focus) { static bool handle_view_created(wlc_handle handle) { swayc_t *focused = get_focused_container(&root_container); - swayc_t *view = new_view(focused, handle); - if (view) { + uint32_t type = wlc_view_get_type(handle); + //If override_redirect/unmanaged/popup/modal/splach + if (type) { + sway_log(L_DEBUG,"Unmanaged window of type %x left alone", type); + wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); + if (type & WLC_BIT_UNMANAGED) { + return true; + } + //for things like Dmenu + if (type & WLC_BIT_OVERRIDE_REDIRECT) { + wlc_view_focus(handle); + } + } else { + swayc_t *view = new_view(focused, handle); //Set maximize flag for windows. //TODO: floating windows have this unset wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); unfocus_all(&root_container); focus_view(view); arrange_windows(view->parent, -1, -1); - } else { //Unmanaged view - wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); - wlc_view_focus(handle); } if (wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { unfocus_all(&root_container); -- cgit v1.2.3-54-g00ecf