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

Fixed ugly dark shadows in case of smaller window than shadow radius. #695

Merged
merged 2 commits into from
Sep 21, 2021
Merged

Fixed ugly dark shadows in case of smaller window than shadow radius. #695

merged 2 commits into from
Sep 21, 2021

Conversation

pijulius
Copy link
Contributor

This fixes the ugly black shadow that I was thinking was related to overlapping shadows noted here:
#664 (comment)

but in reality it was simply caused by shadow opacity not being added to the shadows in case windows were smaller than the radius of the shadow.

@codecov
Copy link

codecov bot commented Sep 20, 2021

Codecov Report

Merging #695 (03322dd) into next (ee7d961) will increase coverage by 0.18%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #695      +/-   ##
==========================================
+ Coverage   39.29%   39.48%   +0.18%     
==========================================
  Files          46       46              
  Lines        9586     9584       -2     
==========================================
+ Hits         3767     3784      +17     
+ Misses       5819     5800      -19     
Impacted Files Coverage Δ
src/backend/backend_common.c 40.24% <0.00%> (+0.33%) ⬆️
src/picom.c 68.34% <0.00%> (+0.60%) ⬆️
src/win.c 69.00% <0.00%> (+0.96%) ⬆️

@tryone144
Copy link
Collaborator

Nice catch, thanks @pijulius.

To make the coding-style check happy, let clang-format format the files you have changed. 😉
If your editor does not support this you can do so manually with

$ clang-format -style=file -i PATH_TO_FILE

or use git-clang-format if that's available on your system.

@pijulius
Copy link
Contributor Author

Did run it through
clang-format -style=file -i backend_common.c

but that rewrites the whole file (please see attached diff) so not sure why a simply few lines of changes should get into a total rewrite of a file and then pushed. If I did something wrong just let me know and will update the file but really don't see any reason for rewriting the whole file.
backend_common.c.diff.txt

@tryone144
Copy link
Collaborator

but that rewrites the whole file (please see attached diff) so not sure why a simply few lines of changes should get into a total rewrite of a file

Well, that is certainly not what should happen. Your diff indicates a change from tabs to spaces for indentation, which is definitively not correct. My guess is that clang-format wasn't able to find the .clang-format file at the project root. You could check that with clang-format -style=file --dump-config.

@pijulius
Copy link
Contributor Author

Please check now, didn't download the whole project just the file and run clang-format on that and so the clang-format config files weren't used and that's why it was wrong in the first time. Sorry about that.

@tryone144 tryone144 merged commit de959f9 into yshui:next Sep 21, 2021
0x526f6f74 added a commit to 0x526f6f74/picom that referenced this pull request Dec 10, 2022
* Add build dependency Debian

* Use default `detect-client-leader` in sample conf

* Fixed ugly dark shadows in case of smaller window than shadow radius. (yshui#695)

* docs: explain the detect-client-leader option better

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: add new image property: corner radius

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: gl_common: handle corner radius property

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* options: don't disable rounded corner for new backends

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: set corner radius property

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: xrender: handle corner radius

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: xrender: cache rounded rectangle mask

xcb_render_triangle is slow because (at least for Glamor) it's
rasterizing the triangles on CPU.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* github: update git-clang-format-lint

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Fix lack of timespec_get() on Android.

Some versions of the Android libc do not have timespec_get(), use
clock_gettime() instead on Android.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>

* allow dots (.) in condition targets

* backend: xrender: fix accidentally deleted refcount decrement

Thanks, @tryone144

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: explicitly initialize corner_radius

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: xrender: fix clone_image

We were using default_clone_image, but:

1) it's copying the wrong type, xrender_image has an extra member.
2) it doesn't clone the rounded corner cache properly, that has to be
   separately reference counted.

Reported-in: yshui#728
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Fix segfaults on 32bit arch with --log-level=debug

There were a few improper uses of %ld for 64 bit numbers, as well as
some other 32 bit related warnings that I've fixed.

Signed-off-by: ktprograms <ktprograms@gmail.com>

* Use python3 for tests

The testcase python files were already compatible with python3, but the
shebang was wrongly set to just 'python'

* Fix all misspellings of _NET_WM_WINDOW_OPACITY.

* Fix 2 examples in manpage which had obsolete options.

* backend: add new property: BORDER_COLOR

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: add new property: BORDER_WIDTH

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: gl: trivial refactoring

* unifm -> uniform
* add macro for storing uniform locations

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: gl: draw border for rounded windows

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: gl: fix read_pixel

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: remove the read_pixel interface.

Sample the border color in the shader instead.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Formally deprecated the sw-opti option

It was deprecated in v6, but wasn't formally deprecated back then (e.g.
no warnings were printed for it). So formally deprecate it here.

This also left the refresh-rate option unused, so that will be
deprecated too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove the glx-use-gpushader4 options

Deprecated since v6.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove the vsync-aggressive flag

Deprecated since v6.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove the glx-swap-method option

Deprecated since v6.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove error messages for --dbe and --paint-on-overlay

Deprecated since v4.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove error message for --alpha-step

Deprecated since v5.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove error message for -d and -S

Deprecated since v5.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove error message for --no-name-pixmap

Deprecated since v5.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove error message for --xrender-sync

Deprecated in v5.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Deprecate the refresh-rate options

It's meaningless without the sw-opti option, which has been deprecated
since v6.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* config_libconfig: reuse the deprecation message

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Remove error message for no-dock-shadow and no-dnd-shadow

Deprecated since v4.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Formally deprecate --menu-opacity

It was deprecated in v4, but warning message wasn't printed for
specifying it on the command line.

Properly deprecate it now.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Report error for setting vsync to non-boolean values

This is deprecated since v5, but we forgot to change this to error in
v8.

Doing it now.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* core: don't crash when binding root pixmap failed

Fixes yshui#767

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: fix win_get with "id"

The target name got changed to "base.id" by accident.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: properly handle object path

Previously we reply to requests sent to _any_ object path, even though
we only declare /com/github/chjj/compton. This commit makes sure we only
reply to request sent to the right path.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* tests: set dbus request to the right path

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Update CONTRIBUTORS

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Fix rounded corners on old pixmap for window animations

* Fix previous commit

* Fix code style

* dbus: expose windows as dbus objects

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: add some properties to window objects

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: add name property to windows

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: add mappepd property to windows

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: follow dbus naming conventions

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* config_libconfig: add dbus option

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: add Type property to window objects

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* dbus: add signal named according to dbus naming conventions

Some code generators don't work well with signal names not in
UpperCamelCase. (e.g. https://dbus.pages.freedesktop.org/zbus)

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Bump version number

Closes yshui#776

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: add new optional API: device_status

This is meant to be used to detect GPU resets.

Implemented in the glx backend using the GL_ARB_robustness extension.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: handle device reset

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: don't trust device_status after a reset

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: gl: don't fill window with big border_width

If a window's border_width is bigger than its corner_radius, the inner
radius of the border become less than 0, causing the entire window to be
filled.

Fixes yshui#778

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: gl: fix corner being drawn with wrong color

The outer pixels of the corner are drawn with antialiasing, but it color
used for antialiasing is wrong. The estimated border color is used when
there is actually no border.

Related: yshui#770

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* backend: gl: apply postprocessing to border_color

Previously postprocessing is omitted when estimating the color of the
border (e.g. dimming, opacity, inversion, etc.), causing the border to
be drawn with the wrong color.

Related: yshui#770

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* ci: fix codeql tasks

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>

* Made meson/install.sh executable

Changed permissions of meson/install.sh from 644 to 755 to be able to run it via "./install.sh" without first executing "chmod +x install.sh".

* README: Move old historical info out of main README

The picom project is no longer a fledgling fork needing to justify its
existence. The README should present the user with relevant information
regarding the current project rather than apologies for a 6-year-old
fork of a longer-defunct prior project.

1. Rename README_orig.md to History.md, so it can contain other content
   of a historical nature.
2. Move still-relevant historical content from README to History.
3. Add a brief intro blurb to README saying that picom is an X
   compositor.
4. Mention Compton in the CONTRIBUTORS section.
5. Point to licensing information from README.

* Fix code style

* Fix window size animations with rounded borders

This is a slightly hacky solution in that it does not properly animate
the borders changing; however, what actually happens in the borders is
barely noticeable (especially with non snail-paced animation speeds), so
it seems to be fine.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Signed-off-by: ktprograms <ktprograms@gmail.com>
Co-authored-by: Tom Dörr <tomdoerr96@gmail.com>
Co-authored-by: Johnny Pribyl <pribylsnbits@gmail.com>
Co-authored-by: Istvan Petres <pijulius@users.noreply.github.com>
Co-authored-by: yshui <yshuiv7@gmail.com>
Co-authored-by: Rafael Kitover <rkitover@gmail.com>
Co-authored-by: Tuomas Kinnunen <tuomas.kinnunen@aalto.fi>
Co-authored-by: ktprograms <ktprograms@gmail.com>
Co-authored-by: Bert Gijsbers <gijsbers@science.uva.nl>
Co-authored-by: Daniel Csillag <dccsillag@gmail.com>
Co-authored-by: i-c-u-p <96894903+i-c-u-p@users.noreply.github.com>
Co-authored-by: Tim Siegel <siegeltr@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants