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)
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");
* 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 */
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);
}
}
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