Skip to content

Commit

Permalink
win: rename find_toplevel_nocache to find_managed_window_or_parent
Browse files Browse the repository at this point in the history
My previous understanding of this function is incorrect. Hopefully I got
it right this time.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed Apr 5, 2020
1 parent 71e1a8a commit 68fa49c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ static inline void ev_reparent_notify(session_t *ps, xcb_reparent_notify_event_t
// Firstly, check if it's a known client window
if (!w_top) {
// If not, look for its frame window
auto w_real_top = find_toplevel_nocache(ps, ev->parent);
auto w_real_top = find_managed_window_or_parent(ps, ev->parent);
// If found, and the client window has not been determined, or its
// frame may not have a correct client, continue
if (w_real_top && (!w_real_top->client_win ||
Expand Down Expand Up @@ -450,7 +450,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
(const uint32_t[]){determine_evmask(
ps, ev->window, WIN_EVMODE_UNKNOWN)});

auto w_top = find_toplevel_nocache(ps, ev->window);
auto w_top = find_managed_window_or_parent(ps, ev->window);
// Initialize client_win as early as possible
if (w_top &&
(!w_top->client_win || w_top->client_win == w_top->base.id) &&
Expand Down
2 changes: 1 addition & 1 deletion src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static inline struct managed_win *find_win_all(session_t *ps, const xcb_window_t
if (!w)
w = find_toplevel(ps, wid);
if (!w)
w = find_toplevel_nocache(ps, wid);
w = find_managed_window_or_parent(ps, wid);
return w;
}

Expand Down
4 changes: 2 additions & 2 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -2189,13 +2189,13 @@ struct managed_win *find_toplevel(session_t *ps, xcb_window_t id) {
}

/**
* Find out the WM frame of a client window by querying X.
* Find a managed window that is, or is a parent of `wid`.
*
* @param ps current session
* @param wid window ID
* @return struct _win object of the found window, NULL if not found
*/
struct managed_win *find_toplevel_nocache(session_t *ps, xcb_window_t wid) {
struct managed_win *find_managed_window_or_parent(session_t *ps, xcb_window_t wid) {
// TODO this should probably be an "update tree", then find_toplevel.
// current approach is a bit more "racy"
struct win *w = NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,13 @@ struct managed_win *find_managed_win(session_t *ps, xcb_window_t id);
struct win *find_win(session_t *ps, xcb_window_t id);
struct managed_win *find_toplevel(session_t *ps, xcb_window_t id);
/**
* Find out the WM frame of a client window by querying X.
* Find a managed window that is, or is a parent of `wid`.
*
* @param ps current session
* @param wid window ID
* @return struct _win object of the found window, NULL if not found
*/
struct managed_win *find_toplevel_nocache(session_t *ps, xcb_window_t wid);
struct managed_win *find_managed_window_or_parent(session_t *ps, xcb_window_t wid);

/**
* Check if a window is a fullscreen window.
Expand Down

0 comments on commit 68fa49c

Please sign in to comment.