x: restrict the scope of arguments taken by x_get_prop*

They only need a xcb_connection_t, don't need to pass the whole
session_t.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2020-12-26 07:39:21 +00:00
parent e3d4ce6612
commit d61fa6eb0c
4 changed files with 30 additions and 28 deletions

View File

@@ -1370,12 +1370,12 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w
int word_count = 1;
if (pleaf->index < 0) {
// Get length of property in 32-bit multiples
auto prop_info = x_get_prop_info(ps, wid, pleaf->tgtatom);
auto prop_info = x_get_prop_info(ps->c, wid, pleaf->tgtatom);
word_count = to_int_checked((prop_info.length + 4 - 1) / 4);
}
winprop_t prop =
x_get_prop_with_offset(ps, wid, pleaf->tgtatom, idx, word_count,
c2_get_atom_type(pleaf), pleaf->format);
winprop_t prop = x_get_prop_with_offset(
ps->c, wid, pleaf->tgtatom, idx, word_count,
c2_get_atom_type(pleaf), pleaf->format);
ntargets = (pleaf->index < 0 ? prop.nitems : min2(prop.nitems, 1));
if (ntargets > 0) {
@@ -1447,12 +1447,12 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w
int word_count = 1;
if (pleaf->index < 0) {
// Get length of property in 32-bit multiples
auto prop_info = x_get_prop_info(ps, wid, pleaf->tgtatom);
auto prop_info = x_get_prop_info(ps->c, wid, pleaf->tgtatom);
word_count = to_int_checked((prop_info.length + 4 - 1) / 4);
}
winprop_t prop =
x_get_prop_with_offset(ps, wid, pleaf->tgtatom, idx, word_count,
c2_get_atom_type(pleaf), pleaf->format);
winprop_t prop = x_get_prop_with_offset(
ps->c, wid, pleaf->tgtatom, idx, word_count,
c2_get_atom_type(pleaf), pleaf->format);
ntargets = (pleaf->index < 0 ? prop.nitems : min2(prop.nitems, 1));
targets = targets_free = (const char **)ccalloc(2 * ntargets, char *);