Commit Graph

29 Commits

Author SHA1 Message Date
Yuxuan Shui 14cf5f455e
Improve config file search order
Previously the search order is:

~/.config/compton/compton.conf
/etc/xdg/compton/compton.conf
~/.config/compton.conf
/etc/xdg/compton.conf
...

Now the search order is:

~/.config/compton/compton.conf
~/.config/compton.conf
~/.compton.conf
/etc/xdg/compton/compton.conf
...

In other word, compton will now search all possible user config file
path first before searching for a system config file.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-30 22:12:43 +00:00
Yuxuan Shui f649a949e2
Even more includes
Expand the modulemap to cover some of the system headers too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-20 22:09:22 +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 80847dd3fa
Refactor the XSync fence code
Use a temporary fence everytime. Convert the Xlib XSync functions to use
xcb_sync_*.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-30 07:06:47 +00:00
Yuxuan Shui 7915ade1be
Make --logpath work again
Also add a new option "log-file" to config file and command line, it
doesn the same thing as --logpath.

--logpath was never documented, and "log-file" is more consistent with
the naming of options.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-21 22:59:21 +00:00
Yuxuan Shui cb7d852b0f
Clean up options/config file parsing
* Pass a options_t, not session_t
* Slightly improve error handling when setting vsync method via dbus

The goal here is to limit the scope of what a given function can access.
And session_t contains basically everything, so don't pass it around.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-21 17:21:52 +00:00
Yuxuan Shui a6fef8e8fb
Convert printf_* from config.c and config_libconfig.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 17:35:45 +00:00
Yuxuan Shui d9409ae2c9
Add command line and config file option log-level
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 01:26:04 +00:00
Yuxuan Shui e29d9510ed
Remove a debug message
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-16 00:52:45 +00:00
Yuxuan Shui 94b1bc0387
Use libxdg-basedir for finding config files
Also add a new config file path:
{$XDG_CONFIG_DIRS,$XDG_CONFIG_HOME}/compton/compton.conf

(For those not familiar with xdg: now compton will look for
~/.config/compton/compton.conf too)

Closes #62

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 19:53:16 +00:00
Yuxuan Shui b73dce1d6d
Replace mstrcpy, mstrncpy with strdup, strndup
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 19:07:14 +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 f83eb79c05
Add wintype option `redir-ignore`.
This cause certain window types to be ignored in deciding whether the
screen should be redirected after being unredirected.

Fixes #58

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-04 16:36:49 +00:00
Yuxuan Shui 8f05b03411
Move the initialization of wintype options into common function
Make sure the wintype options are properly initialized even when there
is no config file specified/supported.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-04 16:29:32 +00:00
Yuxuan Shui f97cf48865
Clean up the wintype option logic
I just realized wintype option shadow and fade never worked. If you set
the global shadow option to true, wintype shadow option will have no effect.

Now the wintype options will properly override the global ones.

Also remove deprecated options from compton.sample.conf.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-04 15:13:08 +00:00
Yuxuan Shui 0a6f48dba2 Support all alpha values
Remove alpha_step, and support all 256 alpha values.

1 pixel pictures don't really use that many resources.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-19 12:43:46 +00:00
Yuxuan Shui 0dcb0e0dc6 Add per window type option full-shadow
When this option is enabled for a window type, shadow will be drawn in
areas that are obscure by the shape of the window.

Useful when the given window type has parts of the window transparent,
and you want to have shadows in those areas.

Fixes #45

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-09 19:56:05 +00:00
Yuxuan Shui b18d46bcbd Revert "Remove xrender-sync and xrender-sync-fence"
This reverts commit 50e2259404.

Temporarily revert the removal until we have more information about this whole
thing.

Turns out a couple of drivers don't work properly without the sync fence,
including intel, llvmpipe and NVIDIA.

Although sync fence is needed, from the information I have gathered (looking
at old bug reports, protocol specifications, look at other compositors' code),
compton's usage of it is not proper. So we need to rewrite it in the future,
after we get more information from driver developers.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-08 18:07:18 +00:00
Yuxuan Shui e142993bb5 Enable paint-on-overlay whenever possible
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-03 22:36:52 +00:00
Yuxuan Shui 50e2259404 Remove xrender-sync and xrender-sync-fence
This was a dubious "fix" for a Nvidia driver problem. The problem was
never fully understood, and the then developers took a shotgun approach
and implemented xsync fences as a fix. Which somehow fixed the problem.
Again, I don't see any indication that the developers understood why
this "fix" worked.

(for details, see chjj/compton#152 and chjj/compton#181)

The driver problem should have been fixed almost 5 years ago. So this
shouldn't be needed anymore. In addition the way compton uses xsync fences
is apparently wrong according to the xsync spec (fences are attached to
screen, but compton uses them as if they were attached to drawables).

So, I will try removing it and see if anyone will complain. If there are
real concrete reasons why fences are needed, it will be brought back.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-28 23:36:55 +00:00
Yuxuan Shui f519ee53c1 Remove support of Xdbe
--dbe does not seem to have an effect on tearing, as noted in the old
manpage, and confirmed by my own testing.

So remove it, since it complicates the logic of painting.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui df63cab39a Print messages about removed options
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-24 11:10:35 +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 cb4bab1cf6 Print deprecation warning for removed OpenGL options
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 21:07:29 +01:00
Yuxuan Shui 28a2cc62fa Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.

It is unclear to me what is the previous painting logic. But the current
one is basically this:

1. Go through all windows top to bottom, and put visible windows (not
   unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
   region of screen that is obscured by all the windows above current
   one.
3. Paint all the visible windows from bottom to top. Subtract the region
   of ignore from the painting region. If we need to paint shadow, we
   subtract the body of the window from the shadow painting region too,
   because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
   window on top moved or changed shape, when window changed between
   opaque and transparent, etc.

Notes:

It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.

It is unclear if window shape related events are handled correctly or
not. Need more testing.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:33 +01:00
Yuxuan Shui 6f59367c00 Remove the clear-shadow option
Shadows attached to ARGB/transparent windows are always cleared now.
2018-09-23 23:58:17 +01:00
Yuxuan Shui 0d6b1627f2 Make gcc happy 2018-09-10 13:46:24 +01:00
Yuxuan Shui fcef5e706d Some cleanup work
* Remove NO_C2 option
* Split configuration related functions into their own file
* Drop support for libconfig < 1.4
* Fix dependencies in Makefile
2018-09-10 13:46:05 +01:00