xrender-sync-fence might be enabled after init because of driver
detection. Instead of creating it on demand, just always create it as
this is simpler.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
We use the __GL_YIELD=usleep workaround when we detect the NVIDIA
driver, so we could use glFinish without the NVIDIA driver taking all
the CPU.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Because it needs to be cleared when we reset, so we don't use a freed
fbconfig across reset.
Related: #381
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
GLX context is not destroyed immediately after calling
glXDestroyContext. It is only destroyed when it's no longer
being used. So make sure to release the context
Fixes#381
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Flags might be cleared on a destroyed window, if it's set because of an
event received before the window is destroyed.
Eventually we want to delay the handling of destroy notify as well.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Mark it CLIENT_STALE and clear the client instead of recheck it
immediately. It's better to recheck when we have the server grabbed.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Make sure the window struct is indeed destroyed and freed when a window
is reparented away from root. So we won't find it later and get
confused.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Don't just mark it as CLIENT_STALE. To make sure we don't later find the
old frame window as the frame of the client.
Fix assertion failure in ev_destroy_notify.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
win_on_factor_change is called when client window changed for a frame,
in that case, the mode of the window could change.
Related: #299
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This reverts commit 04fe4a76b2.
This brings back the previous incomplete fix attempt for #299. See the
commit message of the revert for why it's incomplete.
A different fix is then attempted, see commit xxxxxxx for how that fix
works.
However, the second fix is incomplete by itself as well. The reason is
that i3 reparent the real window to the frame first, before destroying
the placeholder client of that frame. So briefly, that frame would have
2 client windows. And the frame is mapped before the placeholder is
destroyed. So even though we only call win_recheck_client when/if the
frame window is mapped, it can still be called when there are 2 client
windows, it would pick up the wrong client window in that case.
So what we need is to combine both fixes.
The second fix makes sure we are up to date on the client window
information when we starts to listen for events on the frame window;
while the first fix would keep us up to date afterwards.
This revert also includes a fix for assertion failure raised in #371
See #299 for root cause of the bug.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Instead of handling reparent notify on the spot by updating the client
windows, setup a flag on the window and call win_recheck_client later.
This makes handling of complex scenarios easier. As example, see the
case in issue #299.
Note this is not a complete fix for #299
Handle more (hopefully all) edge-cases when updating `opacity_target_old`:
* `MAPPING` transitions to `FADING` if new target is reached. Otherwise
no update.
* `FADING` clamps to current `opacity` if old target is too small.
* `UNMAPPING`/`DESTROYING` clamps to current `opacity` if old target is
too small.
* Add new field `opacity_target_old` to `struct managed_win` for
tracking relevant `opacity_target` changes.
* Smoothly fade blur-texture opacity on window opacity changes (based on
window opacity), when the window was or will be fully transparent
(`w->opacity ~< 0.004`).
* Fixed alpha-clipping of the blur-texture when using `inactive-opacity` or
repeatedly setting window opacity with large fade intervals (should fix#314).
These two flags are intended for subtly different things. I can probably
justify the distinction, but it's definitely difficult to explain. And
there is no obvious benefits to keep them separate.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Commits reverted:
b652e8b58dbdf809d039e9ab970989481ac54f67
While those commits themselves could be useful even if they don't
completely fix#299, they come with the risks of introduce more
unforeseen bugs, which outweigh their benefit, so revert them.
A brief explanation of their problem:
The fix hinges on the destroy event of the client window to work.
However, the client window could be destroyed so fast, before we even
handle the map, or even the create, event of the frame. And we won't be
listening for substructure events on the frame at the point the client
window is destroyed. Thus completely miss the client window destroy
event.
Because of the inherent racy nature of Xorg, this approach is really
difficult to make work.
Fixes#371
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
So we can pick up destroy notify of the client windows. Because we need
the destroy notify of the client window to trigger a client window
recheck on the frame window. This is to handle the case where a frame
window is later reused, and the case where multiple client windows are
momentarily attached to the same frame[1].
This will also cause events previously unseen to be generated. Most of
the events would be ignored, because they don't have a corresponding
managed window. Change has been made to ev_reparent_notify, so it would
handle the case where a client window is reparented from one frame to
another[2]. Previously such events are not received by picom.
Related[1]: e9ab970989
Related[2]: 481ac54f67
Related: #299
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
We detach the client window from its frame when it's destroyed, so later
a new window can be attached to that frame. But turns out that's not
enough.
When i3 restarts, it attaches a placeholder window to the frame, then
the real window, and only after that, it will destroy the placeholder.
The real window will fail to attach as the frame already has a client.
When the placeholder is destroyed, we have to call recheck client to
pick up the real window that failed to attach previously.
Related: #299
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>