Commit Graph

39 Commits

Author SHA1 Message Date
Arda Atci
157cb57ea7 Merge remote-tracking branch 'yshui/next' into next 2022-12-20 03:07:52 +03:00
Yuxuan Shui
4594168946 utils: add rolling_avg
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-12-13 14:35:26 +00:00
Yuxuan Shui
91e023971d utils: add rolling_max
For tracking rolling max of a stream of integers.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-12-13 14:35:20 +00:00
Arda Atci
f6b0b04f5b picom upto date sync with yshui, full anim support 2022-10-04 00:24:05 +03:00
Yuxuan Shui
9b419504e8 backend: add the make_mask interface
This is used to create image masks that can be used to mask out
`compose` regions. For example, this can be used to mask out window body
so shadow won't be painted on them.

This could be more efficient than using rectangular regions for masking,
when there are a large number of rectangles; or more flexible, in the
case of window with rounded corners.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-24 08:39:21 +01:00
Yuxuan Shui
96fcc6089e c2: silence a compiler warning
GCC warns about a use after free, because a pointer is used in pointer
comparison after it was freed. This particular case is completely safe,
but GCC warns anyway.

Move the free after the comparison requires me duplicating the free a
couple of times, so instead I made use of the cleanup attribute to auto
free the pointer when it goes out of scope.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-07-16 15:05:03 +01:00
Yuxuan Shui
b7df820ff2 backend: add new property: BORDER_WIDTH
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-01-24 17:34:33 +00:00
Rafael Kitover
062f50af39 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>
2021-10-29 18:42:22 +00:00
Yuxuan Shui
d00c1c7a1d compile.h, utils.h: rename popcount
Rename `popcountl` to `popcntul` to avoid name conflicts with NetBSD
system headers.

Remove the unused `popcount` function.

Closes #502

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-07 19:35:55 +01:00
Yuxuan Shui
2b677c8fc4 options: support shadow-color as a commandline option
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-08-18 02:39:43 +01:00
Yuxuan Shui
bdf3aabb75 x: use xcb constants in _x_strerror as mush as possible
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-31 05:46:28 +01:00
Rytis Karpuska
e510814b7c implement bright window dimming 2019-11-09 17:54:57 +02:00
Yuxuan Shui
8ddbebb5d1 rename: replace "compton" in the codebase
leftovers:

1) config file path. Has to implement compatibility functionalities before
  we can change it.

2) links in man pages. Has to migrate the repo first.

3) _COMPTON_SHADOW, it has become a defacto standard, so we have to keep
   supporting it.

4) dbus names, undecided whether we should/could change it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-23 20:24:20 +01:00
Yuxuan Shui
583cf35bed Fix compiler warnings in release builds
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-12 15:12:17 +01:00
Yuxuan Shui
bb756b2238 Fix compiler warning about unused parameters
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 02:27:02 +01:00
Yuxuan Shui
452e313c64 kernel: tweak gaussian deviation
So that the shadow doesn't look cut off or fuzzy.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:30 +01:00
Yuxuan Shui
2040190fb6 utils: improve CHECK() macro
Include the original expression in the assertion failure message.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:26 +01:00
Yuxuan Shui
0733f7540f Silence unused variable warning in release build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:26 +01:00
Yuxuan Shui
9677750e3d Improve checked cast macros
to_{int,char,i16}_checked now works with unsigned types (except
uint64_t).

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:25 +01:00
Yuxuan Shui
0037b7e5fb Eliminate implicit conversions
Use explicit conversions everywhere. Adding bounds check assertions when
necessary.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:25 +01:00
Yuxuan Shui
532a90d573 Use __builtin_isnan
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:25 +01:00
Yuxuan Shui
472185e885 core: split out event code
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui
e82bc0ca23 Silence a warning in release build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 14:15:25 +00:00
Yuxuan Shui
bb8fd08b5b Fix a compiler complaint
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-18 21:32:49 +00:00
Yuxuan Shui
8922312e42 Refactor FBConfig lookup
Background: To bind a Xorg window content to a OpenGL FBConfig, which
has to match the color format the Xorg window is using.

Previously, compton just find a FBConfig that has the same depth. This
led to chjj/compton#477, which has been fixed by a ugly hack.

The commit refactor the lookup mechanism to take as much into
consideration as we reasonably can. Hopefully preventing similar
breakages in the future.

Also, some code sharing between the old and new glx backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:41:47 +00:00
Yuxuan Shui
916e23861a Improve the header includes, cont'd
Also check in the modulemap file, and add a option to build with clang's
-fmodules.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-20 17:10:06 +00:00
Yuxuan Shui
86e744345e Fix build with gcc 6
gcc want _Noreturn to be the first thing in declaration.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-25 14:55:01 +00:00
Yuxuan Shui
311fa65840 Mark report_allocation_failure as noreturn
Silence an static analyzer warning

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-25 04:11:29 +00:00
Yuxuan Shui
1ea611c90e Improved allocation failure reporting
Now it reports file and line number of the function too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 14:19:10 +00:00
Yuxuan Shui
e58cbf8add Convert non-mandatory attributes to macros
They're shorter and more portable.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-19 20:50:02 +00:00
Yuxuan Shui
68873efaa2 Move likely/unlikely to compiler.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 19:14:01 +00:00
Yuxuan Shui
b8912fa749 Use checked allocation everywhere
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 18:57:46 +00:00
Yuxuan Shui
acb81bc9a9 Add log.h to files that need it
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 17:53:17 +00:00
Yuxuan Shui
0cebbc370a Function movements
* string functions mstr*() are moved to string_utils.c
* allocation wrappers are moved to utils.h
* printf_* functions are moved to log.h

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 17:43:36 +00:00
Yuxuan Shui
f65d7b2e64 Fix unsupported optimize attribute on clang
Use optnone instead, this does require a more recent clang though. In
general, just don't use -ffast-math.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-03 14:05:13 +00:00
Yuxuan Shui
be09a9a835 Workaround compiling with -ffast-math
And add a compiler warning.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-02 13:57:42 +00:00
Yuxuan Shui
0686300013 Move some common functions to utils.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui
ee318582f5 Sort out license problems
IANAL, but I think I am allowed to add missing copyright notices for
someone else. And I did my best job using git history to figure out who
wrote which functions. So I hope everything is fine.
2018-10-03 22:14:51 +01:00
Yuxuan Shui
3f4c05720d utils.h: Some utility functions and macros
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:33 +01:00