Variable name change

win::destroyed to win::destroying, because it make slightly more sense.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-02 19:42:05 +00:00
parent 8371d6a0b7
commit 6eff9ebf8b
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
5 changed files with 30 additions and 28 deletions

View File

@ -838,7 +838,7 @@ find_win(session_t *ps, xcb_window_t id) {
win *w; win *w;
for (w = ps->list; w; w = w->next) { for (w = ps->list; w; w = w->next) {
if (w->id == id && !w->destroyed) if (w->id == id && !w->destroying)
return w; return w;
} }
@ -857,7 +857,7 @@ find_toplevel(session_t *ps, xcb_window_t id) {
return NULL; return NULL;
for (win *w = ps->list; w; w = w->next) { for (win *w = ps->list; w; w = w->next) {
if (w->client_win == id && !w->destroyed) if (w->client_win == id && !w->destroying)
return w; return w;
} }

View File

@ -610,7 +610,7 @@ paint_preprocess(session_t *ps, win *list) {
if (!w->ever_damaged if (!w->ever_damaged
|| w->g.x + w->g.width < 1 || w->g.y + w->g.height < 1 || w->g.x + w->g.width < 1 || w->g.y + w->g.height < 1
|| w->g.x >= ps->root_width || w->g.y >= ps->root_height || w->g.x >= ps->root_width || w->g.y >= ps->root_height
|| ((w->a.map_state == XCB_MAP_STATE_UNMAPPED || w->destroyed) && !w->paint.pixmap) || ((w->a.map_state == XCB_MAP_STATE_UNMAPPED || w->destroying) && !w->paint.pixmap)
|| (double) w->opacity / OPAQUE * MAX_ALPHA < 1 || (double) w->opacity / OPAQUE * MAX_ALPHA < 1
|| w->paint_excluded) || w->paint_excluded)
to_paint = false; to_paint = false;
@ -680,7 +680,7 @@ paint_preprocess(session_t *ps, win *list) {
reg_ignore_valid = reg_ignore_valid && w->reg_ignore_valid; reg_ignore_valid = reg_ignore_valid && w->reg_ignore_valid;
w->reg_ignore_valid = true; w->reg_ignore_valid = true;
assert(w->destroyed == (w->fade_callback == finish_destroy_win)); assert(w->destroying == (w->fade_callback == finish_destroy_win));
win_check_fade_finished(ps, &w); win_check_fade_finished(ps, &w);
// Avoid setting w->to_paint if w is freed // Avoid setting w->to_paint if w is freed
@ -930,7 +930,7 @@ unmap_win(session_t *ps, win **_w) {
win *w = *_w; win *w = *_w;
if (!w || w->a.map_state == XCB_MAP_STATE_UNMAPPED) return; if (!w || w->a.map_state == XCB_MAP_STATE_UNMAPPED) return;
if (w->destroyed) return; if (w->destroying) return;
// Set focus out // Set focus out
win_set_focused(ps, w, false); win_set_focused(ps, w, false);
@ -989,7 +989,7 @@ restack_win(session_t *ps, win *w, xcb_window_t new_above) {
// rehook // rehook
for (prev = &ps->list; *prev; prev = &(*prev)->next) { for (prev = &ps->list; *prev; prev = &(*prev)->next) {
if ((*prev)->id == new_above && !(*prev)->destroyed) { if ((*prev)->id == new_above && !(*prev)->destroying) {
found = true; found = true;
break; break;
} }
@ -1024,7 +1024,7 @@ restack_win(session_t *ps, win *w, xcb_window_t new_above) {
to_free = ev_window_name(ps, c->id, &window_name); to_free = ev_window_name(ps, c->id, &window_name);
desc = ""; desc = "";
if (c->destroyed) desc = "(D) "; if (c->destroying) desc = "(D) ";
printf("%#010lx \"%s\" %s", c->id, window_name, desc); printf("%#010lx \"%s\" %s", c->id, window_name, desc);
if (c->next) if (c->next)
printf("-> "); printf("-> ");
@ -1161,10 +1161,11 @@ circulate_win(session_t *ps, xcb_circulate_notify_event_t *ce) {
restack_win(ps, w, new_above); restack_win(ps, w, new_above);
} }
// TODO move to win.c
static void static void
finish_destroy_win(session_t *ps, win **_w) { finish_destroy_win(session_t *ps, win **_w) {
win *w = *_w; win *w = *_w;
assert(w->destroyed); assert(w->destroying);
win **prev = NULL, *i = NULL; win **prev = NULL, *i = NULL;
log_trace("(%#010x): Starting...", w->id); log_trace("(%#010x): Starting...", w->id);
@ -1199,12 +1200,12 @@ static void
destroy_win(session_t *ps, xcb_window_t id) { destroy_win(session_t *ps, xcb_window_t id) {
win *w = find_win(ps, id); win *w = find_win(ps, id);
log_trace("(%#010x \"%s\"): %p", id, (w ? w->name: NULL), w); log_trace("%#010x \"%s\": %p", id, (w ? w->name: NULL), w);
if (w) { if (w) {
unmap_win(ps, &w); unmap_win(ps, &w);
w->destroyed = true; w->destroying = true;
if (ps->o.no_fading_destroyed_argb) if (ps->o.no_fading_destroyed_argb)
win_determine_fade(ps, w); win_determine_fade(ps, w);
@ -3087,18 +3088,18 @@ session_destroy(session_t *ps) {
// Free window linked list // Free window linked list
{ {
win *next = NULL; win *next = NULL;
for (win *w = ps->list; w; w = next) { win *list = ps->list;
// Must be put here to avoid segfault ps->list = NULL;
for (win *w = list; w; w = next) {
next = w->next; next = w->next;
if (w->a.map_state == XCB_MAP_STATE_VIEWABLE && !w->destroyed) if (w->a.map_state == XCB_MAP_STATE_VIEWABLE && !w->destroying)
win_ev_stop(ps, w); win_ev_stop(ps, w);
free_win_res(ps, w); free_win_res(ps, w);
free(w); free(w);
} }
ps->list = NULL;
} }
// Free blacklists // Free blacklists

View File

@ -492,7 +492,7 @@ cdbus_apdarg_wids(session_t *ps, DBusMessage *msg, const void *data) {
// Get the number of wids we are to include // Get the number of wids we are to include
unsigned count = 0; unsigned count = 0;
for (win *w = ps->list; w; w = w->next) { for (win *w = ps->list; w; w = w->next) {
if (!w->destroyed) if (!w->destroying)
++count; ++count;
} }
@ -508,7 +508,7 @@ cdbus_apdarg_wids(session_t *ps, DBusMessage *msg, const void *data) {
{ {
cdbus_window_t *pcur = arr; cdbus_window_t *pcur = arr;
for (win *w = ps->list; w; w = w->next) { for (win *w = ps->list; w; w = w->next) {
if (!w->destroyed) { if (!w->destroying) {
*pcur = w->id; *pcur = w->id;
++pcur; ++pcur;
assert(pcur <= arr + count); assert(pcur <= arr + count);
@ -811,7 +811,7 @@ cdbus_process_win_get(session_t *ps, DBusMessage *msg) {
cdbus_m_win_get_do(mode, cdbus_reply_enum); cdbus_m_win_get_do(mode, cdbus_reply_enum);
cdbus_m_win_get_do(client_win, cdbus_reply_wid); cdbus_m_win_get_do(client_win, cdbus_reply_wid);
cdbus_m_win_get_do(ever_damaged, cdbus_reply_bool); cdbus_m_win_get_do(ever_damaged, cdbus_reply_bool);
cdbus_m_win_get_do(destroyed, cdbus_reply_bool); cdbus_m_win_get_do(destroying, cdbus_reply_bool);
cdbus_m_win_get_do(window_type, cdbus_reply_enum); cdbus_m_win_get_do(window_type, cdbus_reply_enum);
cdbus_m_win_get_do(wmwin, cdbus_reply_bool); cdbus_m_win_get_do(wmwin, cdbus_reply_bool);
cdbus_m_win_get_do(leader, cdbus_reply_wid); cdbus_m_win_get_do(leader, cdbus_reply_wid);

View File

@ -74,7 +74,7 @@ group_update_focused(session_t *ps, xcb_window_t leader) {
return; return;
for (win *w = ps->list; w; w = w->next) { for (win *w = ps->list; w; w = w->next) {
if (win_get_leader(ps, w) == leader && !w->destroyed) if (win_get_leader(ps, w) == leader && !w->destroying)
win_update_focused(ps, w); win_update_focused(ps, w);
} }
@ -93,7 +93,7 @@ group_is_focused(session_t *ps, xcb_window_t leader) {
return false; return false;
for (win *w = ps->list; w; w = w->next) { for (win *w = ps->list; w; w = w->next) {
if (win_get_leader(ps, w) == leader && !w->destroyed if (win_get_leader(ps, w) == leader && !w->destroying
&& win_is_focused_real(ps, w)) && win_is_focused_real(ps, w))
return true; return true;
} }
@ -329,7 +329,7 @@ void win_determine_mode(session_t *ps, win *w) {
void win_calc_opacity(session_t *ps, win *w) { void win_calc_opacity(session_t *ps, win *w) {
opacity_t opacity = OPAQUE; opacity_t opacity = OPAQUE;
if (w->destroyed || w->a.map_state != XCB_MAP_STATE_VIEWABLE) if (w->destroying || w->a.map_state != XCB_MAP_STATE_VIEWABLE)
opacity = 0; opacity = 0;
else { else {
// Try obeying opacity property and window type opacity firstly // Try obeying opacity property and window type opacity firstly
@ -360,8 +360,8 @@ void win_calc_opacity(session_t *ps, win *w) {
void win_calc_dim(session_t *ps, win *w) { void win_calc_dim(session_t *ps, win *w) {
bool dim; bool dim;
// Make sure we do nothing if the window is unmapped / destroyed // Make sure we do nothing if the window is unmapped / being destroyed
if (w->destroyed || w->a.map_state != XCB_MAP_STATE_VIEWABLE) if (w->destroying || w->a.map_state != XCB_MAP_STATE_VIEWABLE)
return; return;
if (ps->o.inactive_dim && !(w->focused)) { if (ps->o.inactive_dim && !(w->focused)) {
@ -386,7 +386,7 @@ void win_determine_fade(session_t *ps, win *w) {
w->fade_last = w->fade = w->fade_force; w->fade_last = w->fade = w->fade_force;
else if (ps->o.no_fading_openclose && w->in_openclose) else if (ps->o.no_fading_openclose && w->in_openclose)
w->fade_last = w->fade = false; w->fade_last = w->fade = false;
else if (ps->o.no_fading_destroyed_argb && w->destroyed && else if (ps->o.no_fading_destroyed_argb && w->destroying &&
win_has_alpha(w) && w->client_win && w->client_win != w->id) { win_has_alpha(w) && w->client_win && w->client_win != w->id) {
w->fade_last = w->fade = false; w->fade_last = w->fade = false;
} }
@ -756,7 +756,7 @@ bool add_win(session_t *ps, xcb_window_t id, xcb_window_t prev) {
.widthb = 0, .widthb = 0,
.heightb = 0, .heightb = 0,
.destroyed = false, .destroying = false,
.bounding_shaped = false, .bounding_shaped = false,
.rounded_corners = false, .rounded_corners = false,
.to_paint = false, .to_paint = false,
@ -831,7 +831,7 @@ bool add_win(session_t *ps, xcb_window_t id, xcb_window_t prev) {
win **p = NULL; win **p = NULL;
if (prev) { if (prev) {
for (p = &ps->list; *p; p = &(*p)->next) { for (p = &ps->list; *p; p = &(*p)->next) {
if ((*p)->id == prev && !(*p)->destroyed) if ((*p)->id == prev && !(*p)->destroying)
break; break;
} }
} else { } else {

View File

@ -130,8 +130,9 @@ struct win {
bool reg_ignore_valid; bool reg_ignore_valid;
/// Cached width/height of the window including border. /// Cached width/height of the window including border.
int widthb, heightb; int widthb, heightb;
/// Whether the window has been destroyed. /// Whether the window is being destroyed. This being true means destroy_win
bool destroyed; /// is called, but window might still need to be faded out
bool destroying;
/// Whether the window is bounding-shaped. /// Whether the window is bounding-shaped.
bool bounding_shaped; bool bounding_shaped;
/// Whether the window just have rounded corners. /// Whether the window just have rounded corners.