From 39a609acb0a8cc774641f00307889b033de907f7 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Fri, 20 Sep 2019 02:15:41 +0100 Subject: [PATCH] event: do delayed window mapping This remove the only case where map_win_start is called outside of the X critical section. Signed-off-by: Yuxuan Shui --- src/compton.c | 3 +++ src/event.c | 2 +- src/win.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compton.c b/src/compton.c index 41dab06..f4cc3aa 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1272,6 +1272,9 @@ static void handle_new_windows(session_t *ps) { } auto mw = (struct managed_win *)new_w; if (mw->a.map_state == XCB_MAP_STATE_VIEWABLE) { + // Have to map immediately instead of queue window update + // because we need the window's extent right now. + // We can do this because we are in the critical section. map_win_start(ps, mw); // This window might be damaged before we called fill_win diff --git a/src/event.c b/src/event.c index a92fcf9..873d39d 100644 --- a/src/event.c +++ b/src/event.c @@ -285,7 +285,7 @@ static inline void ev_map_notify(session_t *ps, xcb_map_notify_event_t *ev) { return; } - map_win_start(ps, w); + win_queue_update(w, WIN_UPDATE_MAP); // FocusIn/Out may be ignored when the window is unmapped, so we must // recheck focus here diff --git a/src/win.c b/src/win.c index c83992b..23e6ad6 100644 --- a/src/win.c +++ b/src/win.c @@ -1976,6 +1976,7 @@ void win_update_screen(session_t *ps, struct managed_win *w) { /// Map an already registered window void map_win_start(session_t *ps, struct managed_win *w) { + assert(ps->server_grabbed); assert(w); // Don't care about window mapping if it's an InputOnly window @@ -2003,6 +2004,7 @@ void map_win_start(session_t *ps, struct managed_win *w) { assert(w); } + assert(w->state == WSTATE_UNMAPPED); assert((w->flags & WIN_FLAGS_IMAGES_NONE) == WIN_FLAGS_IMAGES_NONE || !ps->o.experimental_backends);