X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fmanage.c;h=bcce8ab1fc502fb1779ec1f4147b59ec1a9fc893;hb=429d3100118d205f7d50ce323ae47a11181afee5;hp=3c6f48a69a86726796b860a625418d083ed306df;hpb=1585d942eac06ddf141c479c90262d0bae4f8cc4;p=i3%2Fi3 diff --git a/src/manage.c b/src/manage.c index 3c6f48a6..bcce8ab1 100644 --- a/src/manage.c +++ b/src/manage.c @@ -117,16 +117,14 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki goto out; } - uint32_t mask = 0; uint32_t values[1]; /* Set a temporary event mask for the new window, consisting only of * PropertyChange. We need to be notified of PropertyChanges because the * client can change its properties *after* we requested them but *before* * we actually reparented it and have set our final event mask. */ - mask = XCB_CW_EVENT_MASK; values[0] = XCB_EVENT_MASK_PROPERTY_CHANGE; - xcb_change_window_attributes(conn, window, mask, values); + xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values); #define GET_PROPERTY(atom, len) xcb_get_property_unchecked(conn, false, window, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, len) @@ -251,7 +249,9 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki free(name); Con *ws = con_get_workspace(nc); - Con *fs = (ws ? con_get_fullscreen_con(ws) : NULL); + Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL); + if (fs == NULL) + fs = con_get_fullscreen_con(croot, CF_GLOBAL); if (fs == NULL) { DLOG("Not in fullscreen mode, focusing\n"); @@ -264,8 +264,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki * focused (fullscreen) con. This way, the new container will be * focused after we return from fullscreen mode */ Con *first = TAILQ_FIRST(&(nc->parent->focus_head)); - TAILQ_REMOVE(&(nc->parent->focus_head), nc, focused); - TAILQ_INSERT_AFTER(&(nc->parent->focus_head), first, nc, focused); + if (first != nc) { + /* We only modify the focus stack if the container is not already + * the first one. This can happen when existing containers swallow + * new windows, for example when restarting. */ + TAILQ_REMOVE(&(nc->parent->focus_head), nc, focused); + TAILQ_INSERT_AFTER(&(nc->parent->focus_head), first, nc, focused); + } } /* set floating if necessary */ @@ -288,7 +293,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki if (config.popup_during_fullscreen == PDF_LEAVE_FULLSCREEN && fs != NULL) { LOG("There is a fullscreen window, leaving fullscreen mode\n"); - con_toggle_fullscreen(fs); + con_toggle_fullscreen(fs, CF_OUTPUT); } } @@ -319,14 +324,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki goto out; } - mask = XCB_CW_EVENT_MASK; - values[0] = CHILD_EVENT_MASK; - xcb_change_window_attributes(conn, window, mask, values); + values[0] = CHILD_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW; + xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values); xcb_flush(conn); reply = xcb_get_property_reply(conn, state_cookie, NULL); if (xcb_reply_contains_atom(reply, A__NET_WM_STATE_FULLSCREEN)) - con_toggle_fullscreen(nc); + con_toggle_fullscreen(nc, CF_OUTPUT); /* Put the client inside the save set. Upon termination (whether killed or * normal exit does not matter) of the window manager, these clients will