Move find_client_win to win.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
04fe4a76b2
commit
df0be9e990
28
src/picom.c
28
src/picom.c
|
@ -374,34 +374,6 @@ static void recheck_focus(session_t *ps) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Look for the client window of a particular window.
|
|
||||||
*/
|
|
||||||
xcb_window_t find_client_win(session_t *ps, xcb_window_t w) {
|
|
||||||
if (wid_has_prop(ps, w, ps->atoms->aWM_STATE)) {
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
xcb_query_tree_reply_t *reply =
|
|
||||||
xcb_query_tree_reply(ps->c, xcb_query_tree(ps->c, w), NULL);
|
|
||||||
if (!reply)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
xcb_window_t *children = xcb_query_tree_children(reply);
|
|
||||||
int nchildren = xcb_query_tree_children_length(reply);
|
|
||||||
int i;
|
|
||||||
xcb_window_t ret = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < nchildren; ++i) {
|
|
||||||
if ((ret = find_client_win(ps, children[i])))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(reply);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuild cached <code>screen_reg</code>.
|
* Rebuild cached <code>screen_reg</code>.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,8 +42,6 @@ void add_damage(session_t *ps, const region_t *damage);
|
||||||
|
|
||||||
uint32_t determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode);
|
uint32_t determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode);
|
||||||
|
|
||||||
xcb_window_t find_client_win(session_t *ps, xcb_window_t w);
|
|
||||||
|
|
||||||
void circulate_win(session_t *ps, xcb_circulate_notify_event_t *ce);
|
void circulate_win(session_t *ps, xcb_circulate_notify_event_t *ce);
|
||||||
|
|
||||||
void update_refresh_rate(session_t *ps);
|
void update_refresh_rate(session_t *ps);
|
||||||
|
|
28
src/win.c
28
src/win.c
|
@ -1046,6 +1046,34 @@ void win_unmark_client(session_t *ps, struct managed_win *w) {
|
||||||
(const uint32_t[]){determine_evmask(ps, client, WIN_EVMODE_UNKNOWN)});
|
(const uint32_t[]){determine_evmask(ps, client, WIN_EVMODE_UNKNOWN)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look for the client window of a particular window.
|
||||||
|
*/
|
||||||
|
static xcb_window_t find_client_win(session_t *ps, xcb_window_t w) {
|
||||||
|
if (wid_has_prop(ps, w, ps->atoms->aWM_STATE)) {
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
xcb_query_tree_reply_t *reply =
|
||||||
|
xcb_query_tree_reply(ps->c, xcb_query_tree(ps->c, w), NULL);
|
||||||
|
if (!reply)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
xcb_window_t *children = xcb_query_tree_children(reply);
|
||||||
|
int nchildren = xcb_query_tree_children_length(reply);
|
||||||
|
int i;
|
||||||
|
xcb_window_t ret = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < nchildren; ++i) {
|
||||||
|
if ((ret = find_client_win(ps, children[i])))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(reply);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recheck client window of a window.
|
* Recheck client window of a window.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue