Don't call map_win() in add_win()

Only case where you want to map window in add_win() is during compton
startup, when compton is registering existing windows. Otherwise,
add_win() is always called for newly created windows, so there will
always be a MapNotify coming up for that window. If we map newly created
windows in add_win(), we will try to map it a second time when the MapNotify
arrives.

So, just don't call map_win() from add_win(). For compton startup, we
explicitly call map_win() after calling add_win() in session_init.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-02-21 02:29:06 +00:00
parent ff37cf9756
commit 6c71146f1c
4 changed files with 39 additions and 27 deletions

View File

@ -1240,7 +1240,7 @@ ev_destroy_notify(session_t *ps, xcb_destroy_notify_event_t *ev) {
inline static void
ev_map_notify(session_t *ps, xcb_map_notify_event_t *ev) {
map_win(ps, ev->window);
map_win_by_id(ps, ev->window);
// FocusIn/Out may be ignored when the window is unmapped, so we must
// recheck focus here
if (ps->o.track_focus) {
@ -2771,6 +2771,12 @@ session_init(int argc, char **argv, Display *dpy, const char *config_file,
add_win(ps, children[i], i ? children[i-1] : XCB_NONE);
}
for (win *i = ps->list; i; i = i->next) {
if (i->a.map_state == XCB_MAP_STATE_VIEWABLE) {
map_win(ps, i);
}
}
free(reply);
log_trace("Initial stack:");
for (win *c = ps->list; c; c = c->next) {