diff --git a/src/c2.c b/src/c2.c index cb1720c2e1..b7fbf2a0bb 100644 --- a/src/c2.c +++ b/src/c2.c @@ -1597,8 +1597,8 @@ static bool c2_string_op(const c2_l_t *leaf, const char *target) { unreachable(); } -static bool -c2_match_once_leaf_string(session_t *ps, const struct managed_win *w, const c2_l_t *leaf) { +static bool c2_match_once_leaf_string(struct x_connection *c, struct atom *atoms, + const struct managed_win *w, const c2_l_t *leaf) { const char **targets = NULL; const char **targets_free = NULL; @@ -1626,12 +1626,12 @@ c2_match_once_leaf_string(session_t *ps, const struct managed_win *w, const c2_l if (leaf->index < 0) { // index < 0 means match any index // Get length of property in 32-bit multiples - auto prop_info = x_get_prop_info(&ps->c, wid, leaf->tgtatom); + auto prop_info = x_get_prop_info(c, wid, leaf->tgtatom); word_count = to_int_checked((prop_info.length + 4 - 1) / 4); offset = 0; } winprop_t prop = - x_get_prop_with_offset(&ps->c, wid, leaf->tgtatom, offset, word_count, + x_get_prop_with_offset(c, wid, leaf->tgtatom, offset, word_count, c2_get_atom_type(leaf), leaf->format); ntargets = (leaf->index < 0 ? prop.nitems : min2(prop.nitems, 1)); @@ -1642,7 +1642,7 @@ c2_match_once_leaf_string(session_t *ps, const struct managed_win *w, const c2_l xcb_atom_t atom = (xcb_atom_t)winprop_get_int(prop, i); if (atom) { xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply( - ps->c.c, xcb_get_atom_name(ps->c.c, atom), NULL); + c->c, xcb_get_atom_name(c->c, atom), NULL); if (reply) { targets[i] = targets_free_inner[i] = strndup( xcb_get_atom_name_name(reply), @@ -1657,7 +1657,7 @@ c2_match_once_leaf_string(session_t *ps, const struct managed_win *w, const c2_l char **strlst = NULL; int nstr = 0; int index = max2(0, leaf->index); - if (wid_get_text_prop(&ps->c, ps->atoms, wid, leaf->tgtatom, &strlst, &nstr)) { + if (wid_get_text_prop(c, atoms, wid, leaf->tgtatom, &strlst, &nstr)) { if (leaf->index < 0 && nstr > 0 && strlen(strlst[0]) > 0) { ntargets = to_u32_checked(nstr); targets = (const char **)strlst; @@ -1727,7 +1727,7 @@ c2_match_once_leaf(session_t *ps, const struct managed_win *w, const c2_l_t *lea // Deal with integer patterns case C2_L_PTINT: return c2_match_once_leaf_int(ps, w, leaf); // String patterns - case C2_L_PTSTRING: return c2_match_once_leaf_string(ps, w, leaf); + case C2_L_PTSTRING: return c2_match_once_leaf_string(&ps->c, ps->atoms, w, leaf); default: log_error("Unknown pattern type %d.", leaf->ptntype); assert(false);