Change fade callback function parameter

Change `win *` to `win **`, because a window could be freed by the
callback, so we can set `*w` to NULL to communicate that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2018-09-29 23:30:19 +01:00
parent 417744df14
commit ab12467c3f
3 changed files with 52 additions and 65 deletions

View File

@ -47,9 +47,6 @@ find_client_win(session_t *ps, Window w);
win *find_toplevel2(session_t *ps, Window wid);
void set_fade_callback(session_t *ps, win *w,
void (*callback) (session_t *ps, win *w), bool exec_callback);
void map_win(session_t *ps, Window id);
void
@ -348,17 +345,6 @@ wid_set_text_prop(session_t *ps, Window wid, Atom prop_atom, char *str) {
return true;
}
/**
* Execute fade callback of a window if fading finished.
*/
static inline void
check_fade_fin(session_t *ps, win *w) {
if (w->fade_callback && w->opacity == w->opacity_tgt) {
// Must be the last line as the callback could destroy w!
set_fade_callback(ps, w, NULL, true);
}
}
/**
* Stop listening for events on a particular window.
*/