Move find_client_win to win.c

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-04-06 20:24:16 +01:00
parent 04fe4a76b2
commit df0be9e990
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
3 changed files with 28 additions and 30 deletions

View File

@ -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>.
*/ */

View File

@ -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);

View File

@ -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.
* *