mirror of https://github.com/yshui/picom.git
wm: add a function to count managed windows
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
9210536db1
commit
d8c34ed4f7
10
src/wm.c
10
src/wm.c
|
@ -243,6 +243,16 @@ void wm_stack_move_to_top(struct wm *wm, struct win *w) {
|
|||
wm_stack_move_before(wm, w, wm->window_stack.next);
|
||||
}
|
||||
|
||||
unsigned wm_stack_num_managed_windows(const struct wm *wm) {
|
||||
unsigned count = 0;
|
||||
list_foreach(struct win, w, &wm->window_stack, stack_neighbour) {
|
||||
if (w->managed) {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
struct managed_win *wm_find_by_client(struct wm *wm, xcb_window_t client) {
|
||||
if (!client) {
|
||||
return NULL;
|
||||
|
|
1
src/wm.h
1
src/wm.h
|
@ -87,6 +87,7 @@ void wm_stack_move_to_top(struct wm *wm, struct win *w);
|
|||
/// Replace window `old` with `new_` in the stack, also replace the window in the hash
|
||||
/// table. `old` will be freed.
|
||||
void wm_stack_replace(struct wm *wm, struct win *old, struct win *new_);
|
||||
unsigned attr_const wm_stack_num_managed_windows(const struct wm *wm);
|
||||
|
||||
struct subwin *wm_subwin_add_and_subscribe(struct wm *wm, struct x_connection *c,
|
||||
xcb_window_t id, xcb_window_t parent);
|
||||
|
|
Loading…
Reference in New Issue