X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fmanage.c;h=4821e28f76451e393b925adb8cab6cca6b634913;hb=0639a7d95ba29229db7d545ad758ca6946ad293d;hp=c4d6172b99fefe5baa1b7a4899c5abeeedec544a;hpb=36664c628993ac04ba1edca41686019fef58ddcc;p=i3%2Fi3 diff --git a/src/manage.c b/src/manage.c index c4d6172b..4821e28f 100644 --- a/src/manage.c +++ b/src/manage.c @@ -85,15 +85,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki utf8_title_cookie, title_cookie, class_cookie, leader_cookie, transient_cookie; - wm_type_cookie = xcb_get_any_property_unchecked(conn, false, window, atoms[_NET_WM_WINDOW_TYPE], UINT32_MAX); - strut_cookie = xcb_get_any_property_unchecked(conn, false, window, atoms[_NET_WM_STRUT_PARTIAL], UINT32_MAX); - state_cookie = xcb_get_any_property_unchecked(conn, false, window, atoms[_NET_WM_STATE], UINT32_MAX); - utf8_title_cookie = xcb_get_any_property_unchecked(conn, false, window, atoms[_NET_WM_NAME], 128); - leader_cookie = xcb_get_any_property_unchecked(conn, false, window, atoms[WM_CLIENT_LEADER], UINT32_MAX); - transient_cookie = xcb_get_any_property_unchecked(conn, false, window, WM_TRANSIENT_FOR, UINT32_MAX); - title_cookie = xcb_get_any_property_unchecked(conn, false, window, WM_NAME, 128); - class_cookie = xcb_get_any_property_unchecked(conn, false, window, WM_CLASS, 128); - /* TODO: also get wm_normal_hints here. implement after we got rid of xcb-event */ geomc = xcb_get_geometry(conn, d); @@ -126,6 +117,18 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki goto out; } +#define GET_PROPERTY(atom, len) xcb_get_property_unchecked(conn, false, window, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, len) + + wm_type_cookie = GET_PROPERTY(A__NET_WM_WINDOW_TYPE, UINT32_MAX); + strut_cookie = GET_PROPERTY(A__NET_WM_STRUT_PARTIAL, UINT32_MAX); + state_cookie = GET_PROPERTY(A__NET_WM_STATE, UINT32_MAX); + utf8_title_cookie = GET_PROPERTY(A__NET_WM_NAME, 128); + leader_cookie = GET_PROPERTY(A_WM_CLIENT_LEADER, UINT32_MAX); + transient_cookie = GET_PROPERTY(A_WM_TRANSIENT_FOR, UINT32_MAX); + title_cookie = GET_PROPERTY(A_WM_NAME, 128); + class_cookie = GET_PROPERTY(A_WM_CLASS, 128); + /* TODO: also get wm_normal_hints here. implement after we got rid of xcb-event */ + DLOG("reparenting!\n"); uint32_t mask = 0; uint32_t values[1]; @@ -157,7 +160,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki Con *search_at = croot; xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, wm_type_cookie, NULL); - if (xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_DOCK])) { + if (xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_DOCK)) { LOG("This window is of type dock\n"); Output *output = get_output_containing(geom->x, geom->y); if (output != NULL) { @@ -254,10 +257,10 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki /* set floating if necessary */ bool want_floating = false; - if (xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_DIALOG]) || - xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_UTILITY]) || - xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_TOOLBAR]) || - xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_SPLASH])) { + if (xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_DIALOG) || + xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_UTILITY) || + xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_TOOLBAR) || + xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_SPLASH)) { LOG("This window is a dialog window, setting floating\n"); want_floating = true; } @@ -308,7 +311,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki xcb_change_window_attributes(conn, window, mask, values); reply = xcb_get_property_reply(conn, state_cookie, NULL); - if (xcb_reply_contains_atom(reply, atoms[_NET_WM_STATE_FULLSCREEN])) + if (xcb_reply_contains_atom(reply, A__NET_WM_STATE_FULLSCREEN)) con_toggle_fullscreen(nc); /* Put the client inside the save set. Upon termination (whether killed or