Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terminals in floating scratchpads lose transparency after restarting i3 #299

Closed
ghost opened this issue Jan 15, 2020 · 41 comments
Closed

terminals in floating scratchpads lose transparency after restarting i3 #299

ghost opened this issue Jan 15, 2020 · 41 comments
Milestone

Comments

@ghost
Copy link

ghost commented Jan 15, 2020

Platform

archlinux, fully up to date

GPU, drivers, and screen setup

intel uhd 620, xf86-video-intel v1:2.99.917+899+gf66d3954-1

Environment

i3 (without gaps)

picom version

v7.5

Configuration:

mark-ovredir-focused = true;
shadow = true;
no-dock-shadow = true;
no-dnd-shadow = true; 
clear-shadow = true;
shadow-radius = 5;
shadow-offset-x = -5;
shadow-offset-y = -5;
shadow-ignore-shaped = true;
detect-client-leader = false;

Steps of reproduction

  1. open a terminal in a floating scratchpad, the terminal may be either urxvtc or alacritty, i didn't test with others, but i think it happens in any terminal
  2. restart i3 with mod+shift+r

Expected behavior

Current Behavior

the window is no longer transparent and there is a trail behind last entered symbol

Stack trace

Other details

herre's a video https://vimeo.com/384925512

@ghost
Copy link
Author

ghost commented Jan 15, 2020

sometimes it happens to regular windows too (as opposed to floating scratchpads)

@ghost
Copy link
Author

ghost commented Jan 15, 2020

this is the log when picom is ran from a terminal and i restart i3

[ 01/15/2020 06:18:38.326 x_create_picture_with_pictfmt_and_pixmap ERROR ] failed to create picture
[ 01/15/2020 06:18:38.327 paint_one ERROR ] Window 0x0160002d is missing painting data.

also i just noticed that a config does not matter

@ghost
Copy link
Author

ghost commented Jan 15, 2020

i found this #284, but it doesn't seem like my case. i set my wallpaper with feh

@yshui
Copy link
Owner

yshui commented Jan 17, 2020

This might be an i3 bug.

Please run this command:

xwininfo -id $(xwininfo -children | awk '/Parent/ { print $4; }')

, click on the window which has lost its transparency, then post the output here.

@ghost
Copy link
Author

ghost commented Jan 17, 2020

@yshui

 ~ xwininfo -id $(xwininfo -children | awk '/Parent/ { print $4; }')

xwininfo: Window id: 0x140005a "[i3 con] container around 0x55dec898cb80"

  Absolute upper-left X:  1174
  Absolute upper-left Y:  547
  Relative upper-left X:  1174
  Relative upper-left Y:  547
  Width: 648
  Height: 488
  Depth: 32
  Visual: 0x8f
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x1400000 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: yes
  Corners:  +1174+547  -98+547  -98-45  +1174-45
  -geometry 648x488-98-45

@yshui
Copy link
Owner

yshui commented Jan 17, 2020

Thanks.

does reapplying the wallpaper fix your problem?

@ghost
Copy link
Author

ghost commented Jan 17, 2020

no

@yshui
Copy link
Owner

yshui commented Jan 17, 2020

OK.

I need more information to figure out what this is. Can you capture an apitrace?

@ghost
Copy link
Author

ghost commented Jan 17, 2020

okay so here's what it outputed into stdin

 ~ apitrace trace --api gl /usr/bin/picom
apitrace: loaded into /usr/bin/apitrace
apitrace: unloaded from /usr/bin/apitrace
apitrace: loaded into /usr/bin/picom
[ 01/17/2020 23:26:07.239 parse_config_libconfig WARN ] Option `no-dock-shadow` is deprecated, and will be removed. Please use the wintype option `shadow` of `dock` instead.
[ 01/17/2020 23:26:07.239 parse_config_libconfig WARN ] Option `no-dnd-shadow` is deprecated, and will be removed. Please use the wintype option `shadow` of `dnd` instead.
[ 01/17/2020 23:26:07.239 parse_config_libconfig WARN ] "clear-shadow" is removed as an option, and is always enabled now. Consider removing it from your config file
apitrace: tracing to /home/tho/picom.trace
[ 01/17/2020 23:26:15.230 x_create_picture_with_pictfmt_and_pixmap ERROR ] failed to create picture
[ 01/17/2020 23:26:15.231 paint_one ERROR ] Window 0x01200058 is missing painting data.
^Capitrace: unloaded from /usr/bin/picom
zsh: segmentation fault (core dumped)  apitrace trace --api gl /usr/bin/picom

and
and this is the log picom.trace.txt

@ghost
Copy link
Author

ghost commented Jan 17, 2020

btw this issue wasn't an issue when i used old compton. (i'm on arch)

@xzfc
Copy link

xzfc commented Feb 26, 2020

I can reproduce a similar problem with this minimal example:

  1. Install peek. Although, any other RGBA app would suffice, I think.

  2. Run i3 with this config in Xephyr:

$ Xephyr :10
$ unset I3SOCK; DISPLAY=:10 i3 -c i3-config.txt
  1. You should see the peek window with a transparent border. img1.png

  2. Press F1 to restart i3, then move the peek window around. I see the trail: img2.png

i3 version: 4.16, 4.17.1, 4.18.
picom version: v7.5.
I can't reproduce it on xcompmgr v1.1.8.

@yshui yshui added this to the v8 milestone Mar 10, 2020
@yshui
Copy link
Owner

yshui commented Apr 1, 2020

@xzfc Can you check if this has been fixed in the latest next branch?

@xzfc
Copy link

xzfc commented Apr 2, 2020

@yshui No, same result.

$ picom --version
vgit-85086

@yshui
Copy link
Owner

yshui commented Apr 2, 2020

@xzfc I cannot reproduce this locally. Also you are on a commit that does not exist in this repo?

@xzfc
Copy link

xzfc commented Apr 2, 2020

I'm on 85086bc.

@yshui
Copy link
Owner

yshui commented Apr 2, 2020

@xzfc Ah, sorry.

Can you attach your picom configuration?

@yshui
Copy link
Owner

yshui commented Apr 2, 2020

@xzfc Did you meant to have --experimental-backends in the i3-config.txt you sent?

@yshui
Copy link
Owner

yshui commented Apr 2, 2020

Never mind, I figured it out.

@xzfc
Copy link

xzfc commented Apr 2, 2020

Can you attach your picom configuration?

I have no picom configuration.

@yshui
Copy link
Owner

yshui commented Apr 2, 2020

No problem.

I think this is not a problem in the new backends as long as you have a wallpaper, and I will fix the no wallpaper case. Something odd is going on in the old backends, so I will be looking into it.

@xzfc
Copy link

xzfc commented Apr 2, 2020

It's still reproducible with picom --experimental-backends and wallpaper set by feh --no-fehbg --bg-fill ….

@yshui
Copy link
Owner

yshui commented Apr 2, 2020

Do you have a screenshot? Because I tried that and didn't see any problem.

@xzfc
Copy link

xzfc commented Apr 2, 2020

img3.png

@yshui
Copy link
Owner

yshui commented Apr 2, 2020

This is very odd, I cannot make it happen on my computer. I believe I am doing the exact same thing as you.

I am using your i3-config.txt, and running picom with picom --experimental-backends --config /dev/null.

Edit: oops, never mind. it's happening now.

@xzfc
Copy link

xzfc commented Apr 3, 2020

I've bisected it to the first bad commit: 426043b.

@xzfc
Copy link

xzfc commented Apr 3, 2020

I think I've found the root of the problem. See how window hierarchy is changed during the i3 restart process:

  1. root -> frame1 -> peek (before the restart)
  2. root -> peek
    Right before the restart, i3 destroys the frame window and remaps the client window to root.
  3. root -> frame2 -> placeholder
    After restart occurs, i3 creates a frame containing a temporary placeholder window.
  4. root -> frame2 -> peek
    Then, i3 replaces the placeholder window by an actual client window. The frame window remains the same. (it is called "swallowing" in i3 documentation)

And seems picom¹ doesn't handle transition 3→4 well. It still thinks that frame2 contains placeholder and doesn't know that it is destroyed and replaced by peek.

¹ as of the first bad commit 426043b

@yshui
Copy link
Owner

yshui commented Apr 5, 2020

@xzfc That's a very good observation. That helps a lot, thanks.

@yshui
Copy link
Owner

yshui commented Apr 5, 2020

Apparently picom is only listen for reparent-to-root and reparent-from-root events, and is thus not getting any reparent events like the ones generated in step 4.

@yshui
Copy link
Owner

yshui commented Apr 5, 2020

I think we had this problem since the compton days.

@yshui
Copy link
Owner

yshui commented Apr 5, 2020

@xzfc I think I fixed this in next, can you try it? Although I might have introduced new bugs while fixing this...

@yshui
Copy link
Owner

yshui commented Apr 5, 2020

TODO: add a testcase for this issue

@xzfc
Copy link

xzfc commented Apr 6, 2020

It still happens, although it's not every time. It's rare (~1/20) if there is only one window on the workspace, but it's more often if there are multiple windows.

To reproduce, open 4 peek windows and press F1 repeatedly until you'll see artifacts inside any window. Then, if you move the window with artifacts, you'll see the trail.

Screenshots: without-artifacts.png with-artifacts.png

Also, there is a minor issue: after the restart (assuming there is no trail), the border is not transparent until you move the window.

@yshui
Copy link
Owner

yshui commented Apr 6, 2020

Ah, this is very annoying 😢 Looks like a bug dependent on in what order things happen. At least we are going the right direction.

@yshui
Copy link
Owner

yshui commented Apr 6, 2020

I think I know

Things happen in this order:

  1. reparent placeholder to frame
  2. map frame
  3. destroy placeholder

picom only starts to listen for child destroy event after 2. So if we received/handled the MapNotify too late, we won't get the DestroyNotify for the placeholder, and thing will break.

@yshui
Copy link
Owner

yshui commented Apr 6, 2020

And there is no guaranteed way to do this "fast enough". The moment we learn about the frame window, step 1-3 could have all happened. Looks like we need a different strategy.

@yshui
Copy link
Owner

yshui commented Apr 7, 2020

i am terribly sorry. stupid github

@yshui yshui reopened this Apr 7, 2020
@yshui
Copy link
Owner

yshui commented Apr 9, 2020

I have an automated test script in place to reproduce it. I have a tentative fix in place, but this issue is still reproducible ~2% of the time.

yshui added a commit that referenced this issue Apr 10, 2020
yshui added a commit that referenced this issue Apr 10, 2020
yshui added a commit that referenced this issue Apr 10, 2020
This reverts commit 04fe4a7.

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>
yshui added a commit that referenced this issue Apr 11, 2020
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
yshui added a commit that referenced this issue Apr 11, 2020
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
yshui added a commit that referenced this issue Apr 11, 2020
This reverts commit 04fe4a7.

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>
yshui added a commit that referenced this issue Apr 11, 2020
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>
yshui added a commit that referenced this issue Apr 11, 2020
Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
yshui added a commit that referenced this issue Apr 11, 2020
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
yshui added a commit that referenced this issue Apr 11, 2020
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
yshui added a commit that referenced this issue Apr 11, 2020
This reverts commit 04fe4a7.

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>
yshui added a commit that referenced this issue Apr 11, 2020
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>
yshui added a commit that referenced this issue Apr 11, 2020
Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
@yshui yshui closed this as completed in a11bc61 Apr 11, 2020
@yshui yshui reopened this Apr 11, 2020
@yshui yshui closed this as completed Apr 11, 2020
@yshui
Copy link
Owner

yshui commented Apr 11, 2020

@xzfc Should've been fixed in next now.

@xzfc
Copy link

xzfc commented Apr 17, 2020

Thank you.

@mark-jordanovic-lewis
Copy link

mark-jordanovic-lewis commented Apr 17, 2023

I am having the same issue on all transparent windows on Manjaro i3. It's just a QoL issue.
Apologies. Simply running picom sorts the windows correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants