Call cont_child() more liberally (#3996)

Following the reproduction instructions from
https://github.com/i3/i3/issues/3242#issuecomment-436175346

For me, #3242 happened when the following sequence executed:
1. Fullscreening window correctly calls `stop_child()` in
6e24e2ad6f/i3bar/src/xcb.c (L685)
2. Xrandr change, `reconfig_windows()` is called and `output->visible` is
set to `true` in this line:
6e24e2ad6f/i3bar/src/xcb.c (L1791)
3. When the window's fullscreen is disabled,
`handle_visibility_notify()` returns in this line:
6e24e2ad6f/i3bar/src/xcb.c (L677)
because previously `output->visible` was set to `true`

To fix this, I call `cont_child()` more leniently since it is a no-op
when the child is not stopped.

Fixes #3242
Closes #3761
This commit is contained in:
Orestis Floros 2020-04-09 10:43:48 +02:00 committed by GitHub
parent 6e24e2ad6f
commit 016d4a3f45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -673,9 +673,6 @@ static void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
continue; continue;
} }
if (output->bar.id == event->window) { if (output->bar.id == event->window) {
if (output->visible == visible) {
return;
}
output->visible = visible; output->visible = visible;
} }
num_visible += output->visible; num_visible += output->visible;
@ -683,10 +680,7 @@ static void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
if (num_visible == 0) { if (num_visible == 0) {
stop_child(); stop_child();
} else if (num_visible == visible) { } else {
/* Wake the child only when transitioning from 0 to 1 visible bar.
* We cannot transition from 0 to 2 or more visible bars at once since
* visibility events are delivered to each window separately */
cont_child(); cont_child();
} }
} }