Make potentially window destroying functions take simple pointers
Instead of pointer to pointer. The two level of pointers were used to inform the caller the window has been destroyed (pointer set to NULL). Now, destruction of windows are now signaled by the return value, which is marked `must_use`. Problem with taking pointer to pointer is that they tends to pollute the function signatures a little bit. And we are not using it well anyways. A lot of the callers passes pointers to local variables to those functions, so the information about window destruction doesn't actually bubble up. So, we switch to use just one level of pointers instead. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
11
src/event.c
11
src/event.c
@ -263,9 +263,9 @@ static inline void ev_destroy_notify(session_t *ps, xcb_destroy_notify_event_t *
|
||||
auto w = find_win(ps, ev->window);
|
||||
if (w) {
|
||||
if (w->managed) {
|
||||
unmap_win(ps, (struct managed_win **)&w, true);
|
||||
auto _ attr_unused = unmap_win(ps, (struct managed_win *)w, true);
|
||||
} else {
|
||||
destroy_unmanaged_win(ps, &w);
|
||||
destroy_unmanaged_win(ps, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -280,7 +280,7 @@ static inline void ev_map_notify(session_t *ps, xcb_map_notify_event_t *ev) {
|
||||
static inline void ev_unmap_notify(session_t *ps, xcb_unmap_notify_event_t *ev) {
|
||||
auto w = find_managed_win(ps, ev->window);
|
||||
if (w) {
|
||||
unmap_win(ps, &w, false);
|
||||
auto _ attr_unused = unmap_win(ps, w, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,9 +306,10 @@ static inline void ev_reparent_notify(session_t *ps, xcb_reparent_notify_event_t
|
||||
auto w = find_win(ps, ev->window);
|
||||
if (w) {
|
||||
if (w->managed) {
|
||||
unmap_win(ps, (struct managed_win **)&w, true);
|
||||
auto _ attr_unused =
|
||||
unmap_win(ps, (struct managed_win *)w, true);
|
||||
} else {
|
||||
destroy_unmanaged_win(ps, &w);
|
||||
destroy_unmanaged_win(ps, w);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user