picom icon indicating copy to clipboard operation
picom copied to clipboard

Shadows do not respect rounded corners

Open noctuid opened this issue 2 years ago • 14 comments

In #770, yes I was talking about how the shadow is still as if there are not rounded corners with --experimental-backends:

2022-02-14T19:44:32_-_picomconf

noctuid avatar Feb 15 '22 00:02 noctuid

I can confirm the same behaviour with latest git commit.

Platform

Gentoo ~amd64

GPU, drivers, and screen setup

glxinfo -B direct rendering: Yes Memory info (GL_NVX_gpu_memory_info): Dedicated video memory: 6144 MB Total available memory: 6144 MB Currently available dedicated video memory: 3947 MB OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2 OpenGL core profile version string: 4.6.0 NVIDIA 510.54 OpenGL core profile shading language version string: 4.60 NVIDIA OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 510.54 OpenGL shading language version string: 4.60 NVIDIA OpenGL context flags: (none) OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 510.54 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

picom details

Diagnostics **Version:** vgit-aa316
Extensions:
  • Shape: Yes
  • XRandR: Yes
  • Present: Present
Misc:
  • Use Overlay: No (Another compositor is already running)
  • Config file used: /home/swimmer/.config/picom/picom.conf
Drivers (inaccurate):

NVIDIA

Backend: glx
  • Driver vendors:
  • GLX: NVIDIA Corporation
  • GL: NVIDIA Corporation
  • GL renderer: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2
Configuration

backend = "glx"; vsync = true; glx-no-stencil = true; glx-no-rebind-pixmap = true; detect-transient = true; detect-client-leader = true; xrender-sync-fence = true; use-ewmh-active-win = true; log-level = "warn";

shadow = true; shadow-radius = 24; shadow-opacity = 0.80 shadow-offset-x = -8; shadow-offset-y = -8; shadow-exclude = [ "class_g = 'scribus'" ];

corner-radius = 24; detect-rounded-corners = true; rounded-corners-exclude = [ "window_type = 'dock'", "class_g = 'Polybar'", "class_g = 'Mixxx'", ];

fading = true; fade-in-step = 0.80; fade-out-step = 0.80; fade-delta = 10

active-opacity = 0.90; inactive-opacity = 0.90; inactive-dim = 0.20; transparent-clipping = true; detect-client-opacity = true; focus-exclude = [ "class_g = 'Gimp'", "class_g = 'scribus'", "class_g = 'Rofi'", "name = 'Calendar'" ]

blur-method = "dual_kawase"; blur-strength = 4; blur-background-exclude = [ "class_g = 'scribus'", ];

wintypes: { tooltip = { fade = true; shadow = true; opacity = 1.0; focus = true; full-shadow = true; }; dock = { shadow = true; full-shadow = false; clip-shadow-above = true; } dnd = { shadow = false; } notification = { full-shadow = true; } popup_menu = { opacity = 0.8; } dropdown_menu = { opacity = 0.8; } };

wimstefan avatar Mar 06 '22 12:03 wimstefan

Think this could similar to my issue posted here https://github.com/yshui/picom/issues/794

jarrard avatar Mar 10 '22 18:03 jarrard

I am facing the same issue on Arch Linux with AwesomeWM.

The issue as been discussed at https://github.com/jonaburg/picom/issues/62 as well.

And there is a mention of a commit by @s0nny7 in yet another picom fork which apparently solves the problem - https://github.com/ibhagwan/picom/pull/34/commits/d74c099083487783af7254cb55780ffb20100e53

I have tried the patched fork by @Arian8j2 mentioned in the former discussion but it did not work for me.

Perhaps, if someone can take inspiration from the mentioned commit and write a solution for this fork, it would be great!

akshat157 avatar Mar 21 '22 23:03 akshat157

I have the same issue as @akshat157 I just compiled @Arian8j2 fork but corner shadows issue remains.

In this post some one mentioned ibhagwan's fork works if the @Arian8j2's fork doesn't, but it only have Archilinux and Void Linux support to compile [sad emoji here].

Failrule avatar Mar 30 '22 18:03 Failrule

I have the same issue, had to revert to jonaburg fork because rounded borders + shadows essentially do not work with picom in arch (meaning you'll get square after the rounded borders). Found a fix for arch here: https://github.com/jonaburg/picom/issues/62

(packaged for arch at https://aur.archlinux.org/packages/picom-jonaburg-fix/ )

aleksfadini avatar Apr 24 '22 14:04 aleksfadini

The original commit that fixes this problem is here.

I would modify it and make a PR myself, but unfortunately I'm just not familiar at all with the picom codebase. It would be excellent if someone with more knowledge could take a look at this and make an implementation for this fork!

SaphiraKai avatar May 14 '22 18:05 SaphiraKai

I had a crack at it. Here is what I came up with. This isn't a patch but a replacement backend.c file. (which you can generate a patch from and edit the buildpkg file to apply said patch to test it)

backend.c.rounded.txt

jarrard avatar May 14 '22 21:05 jarrard

What branch is that file for? I tried plunking it into the next branch, but I got a bunch of undeclared errors for:

  • store_back_texture
  • backend_round_context
  • reg_bound_local

SaphiraKai avatar May 15 '22 02:05 SaphiraKai

Yeah probably need change those variables.. Sorry busy until late tomorrow, can't look now.

jarrard avatar May 15 '22 10:05 jarrard

Ok well the below segment of codes probably can be deleted as I think picom has a new way of storing and handling this. And I brought it over from the original as it seemed important to rounded corners.

Remove this below and test again, see what happens. LOL


		// Store the window background for rounded corners
		// If rounded corners backup the region first
		if (w->corner_radius > 0) {
			const int16_t x = w->g.x;
			const int16_t y = w->g.y;
			const auto wid = to_u16_checked(w->widthb);
			const auto hei = to_u16_checked(w->heightb);
			ps->backend_data->ops->store_back_texture(ps->backend_data, w,
							ps->backend_round_context, &reg_bound, x, y, wid, hei);
		}

AND probably this below also


		// Round the corners as last step after blur/shadow/dim/etc
		if (w->corner_radius > 0.0) {
			ps->backend_data->ops->round(ps->backend_data, w,
						ps->backend_round_context, w->win_image,
						&reg_bound, &reg_visible);
		}

PS. Sorry for late reply, had allot going on.

jarrard avatar May 17 '22 09:05 jarrard

No dice. Still have this error during compilation:

../src/backend/backend.c: In function ‘paint_all_new’:
../src/backend/backend.c:468:47: error: ‘reg_bound_local’ undeclared (first use in this function)
  468 |                         pixman_region32_fini(&reg_bound_local);
      |                                               ^~~~~~~~~~~~~~~

SaphiraKai avatar May 17 '22 20:05 SaphiraKai

Yeah so basically its saying we have not declared what reg_bound_local is/does. Not sure why yet.

You might have made mistake during editing because it shouldn't be at line 468 but ~456! (or maybe you had 10 more spaces somewhere)

(think I uploaded right one) backend.c.original.rounded.txt

jarrard avatar May 17 '22 23:05 jarrard

I'm afraid I don't have any useful information.

On Tue., May 17, 2022, 8:50 p.m. jarrard, @.***> wrote:

Yeah so basically its saying we have not declared what reg_bound_local is since its been removed in recent picom.

Will need to sift through the code to find a substitute function. Feel free to make suggestions, I'm just poking at things in the dark here.

— Reply to this email directly, view it on GitHub https://github.com/yshui/picom/issues/783#issuecomment-1129425774, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQBOWBYTF5FXETLLEO2EZFLVKQWELANCNFSM5ONAVAXQ . You are receiving this because you commented.Message ID: @.***>

SaphiraKai avatar May 18 '22 01:05 SaphiraKai

@SaphiraKai I just created a PR inspired by the commit you linked to. It works on my setup, could you check it works on your too ?

fuegoio avatar Jun 19 '22 21:06 fuegoio