* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
- * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
*
* manage.c: Initially managing new windows (or existing ones on restart).
*
geomc = xcb_get_geometry(conn, d);
-#define FREE_GEOMETRY() do { \
- if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) != NULL) \
- free(geom); \
-} while (0)
/* Check if the window is mapped (it could be not mapped when intializing and
calling manage_window() for every window) */
if ((attr = xcb_get_window_attributes_reply(conn, cookie, 0)) == NULL) {
DLOG("Could not get attributes\n");
- FREE_GEOMETRY();
+ xcb_discard_reply(conn, geomc.sequence);
return;
}
if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) {
- FREE_GEOMETRY();
+ xcb_discard_reply(conn, geomc.sequence);
goto out;
}
/* Don’t manage clients with the override_redirect flag */
if (attr->override_redirect) {
- FREE_GEOMETRY();
+ xcb_discard_reply(conn, geomc.sequence);
goto out;
}
/* Check if the window is already managed */
if (con_by_window_id(window) != NULL) {
DLOG("already managed (by con %p)\n", con_by_window_id(window));
- FREE_GEOMETRY();
+ xcb_discard_reply(conn, geomc.sequence);
goto out;
}
window_update_transient_for(cwindow, xcb_get_property_reply(conn, transient_cookie, NULL));
window_update_strut_partial(cwindow, xcb_get_property_reply(conn, strut_cookie, NULL));
window_update_role(cwindow, xcb_get_property_reply(conn, role_cookie, NULL), true);
- window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL));
+ bool urgency_hint;
+ window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL), &urgency_hint);
xcb_get_property_reply_t *startup_id_reply;
startup_id_reply = xcb_get_property_reply(conn, startup_id_cookie, NULL);
x_set_name(nc, name);
free(name);
+ /* handle fullscreen containers */
Con *ws = con_get_workspace(nc);
Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL);
if (fs == NULL)
fs = con_get_fullscreen_con(croot, CF_GLOBAL);
+ xcb_get_property_reply_t *state_reply = xcb_get_property_reply(conn, state_cookie, NULL);
+ if (xcb_reply_contains_atom(state_reply, A__NET_WM_STATE_FULLSCREEN)) {
+ fs = NULL;
+ con_toggle_fullscreen(nc, CF_OUTPUT);
+ }
+
+ FREE(state_reply);
+
if (fs == NULL) {
DLOG("Not in fullscreen mode, focusing\n");
if (!cwindow->dock) {
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, CF_OUTPUT);
-
- FREE(reply);
-
/* Put the client inside the save set. Upon termination (whether killed or
* normal exit does not matter) of the window manager, these clients will
* be correctly reparented to their most closest living ancestor (=
/* Send an event about window creation */
ipc_send_window_new_event(nc);
+ /* Windows might get managed with the urgency hint already set (Pidgin is
+ * known to do that), so check for that and handle the hint accordingly.
+ * This code needs to be in this part of manage_window() because the window
+ * needs to be on the final workspace first. */
+ con_set_urgency(nc, urgency_hint);
+
geom_out:
free(geom);
out: