Commit Graph

913 Commits

Author SHA1 Message Date
Yuxuan Shui 2f0b7cd992
config_libconfig: rename xdg* functions
To fit our naming convention.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-01 13:48:04 +00:00
Yuxuan Shui 7161296872
config_libconfig: add unit tests for xdgConfigDirectories
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-01 13:46:06 +00:00
Yuxuan Shui 529edce2b9
config_libconfig: eliminate relative paths from XDG_CONFIG_DIRS
According to the XDG Base Directory Specification, relative paths in
XDG_CONFIG_DIRS are invalid, so eliminate them if found.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-01 13:35:50 +00:00
Yuxuan Shui 6b9eddae49
config_libconfig: fix xdgConfigDirectories
Fixed 2 problems:

1. Made sure the returned list is NULL terminated.
2. Allocate the duplicated string and the return list together, so the
   duplicated string will be freed as we free the list. Fixed a memory
   leak.

Fixes #324

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-01 13:15:36 +00:00
Yuxuan Shui a8e8b747fe
file_watch: don't watch special files
While /dev/null is always empty, it still generates inotify events. So
using /dev/null as config file will cause the compositor to reset itself
frequently.

Not entire sure if only allowing regular files is sufficient, but we
will be doing this until an issue comes up.

Fixes #320

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-02-26 21:11:55 +00:00
Yuxuan Shui 630d6f3a26
log: add log_error_errno
Prints error message with strerror(errno) attached, for convenience.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-02-26 20:16:55 +00:00
Dylan Araps 20226f4574 picom: Drop libxdg-basedir 2020-02-25 18:18:19 +02:00
Yuxuan Shui 499b49eb03
Fix build on clang
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-02-08 19:15:10 +00:00
Yuxuan Shui 51034249cc
win: handle shadow image errors more gracefully
Currently if the shadow image fails to bind, the entire window is marked
as having image errors. So nothing of that window will render, even if
the window image itself is fine.

The commit cause shadow to be disabled when shadow image fails, instead
of marking the window.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-02-07 21:35:34 +00:00
Yuxuan Shui 69b3eee76b
backend_common: fix handling of large shadow images
For big windows, their shadow images might exceed the maximum request
length limit of Xorg. libxcb will shutdown the connection to X server if
we try to send that image. So we have to break the image apart and send
it piecemeal.

In the future we probably should migrate to MIT-SHM.

Fixes #255 #274

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-02-07 21:27:01 +00:00
Yuxuan Shui b026708026
Partially handle _NET_WM_BYPASS_COMPOSITOR
Unredirect the screen when some window sets _NET_WM_BYPASS_COMPOSITOR
to 1, but ignore the case where some window requests the screen to be
redirected by setting _NET_WM_BYPASS_COMPOSITOR to 2.

Closes #267

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-01-18 18:02:41 +00:00
Yuxuan Shui c9417bf367
x: trivial function renames
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-01-18 17:26:53 +00:00
Bernd Busse df1a852442 Add support for documented `--blur-*` options
Handle parsing of `--blur-method`, `--blur-size` and `--blur-deviation`
in config file and as command line options as documented in the manpage.
2020-01-17 16:25:02 +01:00
yshui 3ae94de7b7
Merge pull request #288 from jbeich/dragonfly
Try to unbreak build on DragonFly
2020-01-17 14:37:04 +00:00
Michele Lambertucci 99fadd9487 Escape percentages in help strings 2020-01-02 19:26:36 +01:00
Jan Beich e54058fcc7 compiler.h: also check threads.h exists
In file included from ../src/log.h:8,
                 from ../src/backend/gl/glx.h:18,
                 from ../src/common.h:45,
                 from ../src/picom.c:32:
../src/compiler.h:98:11: fatal error: threads.h: No such file or directory
   98 | # include <threads.h>
      |           ^~~~~~~~~~~
2019-12-24 12:04:04 +00:00
Yuxuan Shui 6a3d1354be
backend: allow transparent windows to clip other windows
Transparent windows usually blends on top of other windows, this commit
adds an option to make transparent windows clip other windows like
non-transparent windows do.

Closes #265

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-30 21:29:07 +00:00
Yuxuan Shui 7040579a38
backend: clarify comments about reg_paint
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-30 21:23:22 +00:00
Yuxuan Shui d4e76b271a
win: delayed release of shadow image
Previously win_set_shadow tries to release the shadow image when turning
off shadow for a window. When shadow is turned off _immediately_ after
it's turned on, picom won't have a chance to handle the delayed creation
of the shadow before win_set_shadow tries to release the shadow image,
causing a assertion failure because win_set_shadow tried to release a
non-existing image.

This commit makes releasing the shadow image delayed as well.

In theory, we could check the STALE flag in win_set_shadow before
release the image, but that duplicates the logic that is already in
win_process_flags.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-18 22:34:05 +00:00
Yuxuan Shui 8b37fcb1d8
backend: xrender: fix array size off-by-one
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-18 21:07:02 +00:00
Yuxuan Shui 896fe20098
win: release shadow image when shadow is turned off
fix a assertion error when the shadow is turned back on after being
turned off.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-18 21:00:40 +00:00
Yuxuan Shui 9a88d971d5
win: fix assertion failure in win_release_images
The assertion check for condition that are too board.

If we get multiple root config event in a row, then we might find
ourselves trying to release a image that was released in a previous
backend destruction and is yet to be bound (IOW, the window will have
IMAGES_NONE _and_ IMAGES_STALE set), causing the assertion to fail.

This commit relax the check, so we don't check if STALE is set when NONE
is set.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-13 21:59:26 +00:00
Yuxuan Shui 42cd5bca48
file_watch: make sure sys/types.h is included first
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-11 21:59:25 +00:00
Yuxuan Shui 5e6dacbabe
file_watch: use kqueue on *BSD platforms
Tested on FreeBSD 12

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-11 21:22:57 +00:00
Yuxuan Shui 7328b3f891
file_watch: only use inotify on linux
Fixes build on *BSD platforms.

Fixes #262, Closes #261

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-11 20:48:42 +00:00
Yuxuan Shui 2651042070
core: don't watch config file when there is none
Stop picom from complaining about "Failed to watch file", when there is
no file to watch.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 21:55:38 +00:00
Yuxuan Shui 71ac1bfd30
core: use the logging system all the way
Add a log handler early so we don't need to use fprintf for early logs.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 19:12:16 +00:00
Yuxuan Shui 87e4e10f15
core: reinitialize logging after resets
deinit then init the logging system after resets, because otherwise
duplicated log handlers will be added by session_init, and we will
see duplicated logs.

Doing this also enables us to add log handlers for early logging.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 19:10:32 +00:00
Yuxuan Shui 0e5be97f94
core: watch for configuration file changes
Automatically reset picom and reload the configuration when a change in
the configuration file is detected.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 18:58:01 +00:00
Yuxuan Shui fe9fec84dc
core: check experimental_backends before using backend_list[backend]
Fixes #258

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 18:10:43 +00:00
Yuxuan Shui 30e9e2dc9f
core: check experimental_backend before accessing backend_list
backend_list[backend] is only guaranteed to be non-NULL if experimental
backends are used.

Fixes #258

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 05:07:03 +00:00
Yuxuan Shui 44a771cf76
core: move some config validation into options.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 05:04:10 +00:00
Yuxuan Shui 2848b24a57
options: reject invalid backend earlier
Unsupported backends were rejected when we try to initialize them, now
we reject them in the option parsing phase.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 05:03:17 +00:00
Yuxuan Shui 6efd88b82f
gl_common: use Rec. 709 for luminance calculation
This is however monitor dependent. But Rec. 709 is probably close to
what most people uses.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 03:37:11 +00:00
Yuxuan Shui 7dd843fe4f
options: max-brightness only works on the new glx backend
Print warning when the requirements aren't met.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 03:00:50 +00:00
Yuxuan Shui f6a51be234
gl_common: reuse texture for brightness estimation
Instead of allocating new textures everytime gl_average_texture_color is
called, we keep two textures per gl_image and reuse those.

Doing this significantly improves CPU usage on AMDGPU driver for some
reason. But in general, less texture allocation is always better.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 02:50:14 +00:00
Yuxuan Shui b11e11e682
backend: add missing header xcb/sync.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 02:31:55 +00:00
Yuxuan Shui 6c96e1f3c6
backend: add missing header x.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-10 02:30:56 +00:00
Yuxuan Shui 2c1fdefe3b
backend: enable xsync fence for nvidia users
This was already done in the legacy backends, this commit adds the same
thing to the new backends.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-09 20:01:38 +00:00
Rytis Karpuska ec76c5f286 parameterize max brightness limit 2019-11-09 17:56:38 +02:00
Rytis Karpuska e510814b7c implement bright window dimming 2019-11-09 17:54:57 +02:00
Rytis Karpuska 310b66d519 remove dual_texture from gl_compose as it is just unconditionally set to false. 2019-11-06 01:34:41 +02:00
Yuxuan Shui a2f816acb1
rename: fix the name of the modulemap file
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-24 19:41:35 +01:00
Yuxuan Shui 35db48b68a
core: fix reg_ignore calculation for window with transparent frame
Previously window with transparent frame is mistakenly treated like a
completely transparent window.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-24 19:36:19 +01:00
Yuxuan Shui a0712274ff
win: fix transparency detection for windows without a WM frame
Ping #233

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-24 19:30:11 +01:00
Yuxuan Shui ed0e686f37
rename: update config file paths
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-23 20:24:25 +01: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 ed6a96dae9
options: add --no-vsync command line option
Otherwise there is no way to override the settings in the config file.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-23 20:23:21 +01:00
Yuxuan Shui 2d28ab6032
options: remove --respect-prop-shadow
A quick search on GitHub showing the _COMPTON_SHADOW is actively being
used (most noteably, by polybar). It is not a difficult thing to support,
and it doesn't have that much runtime overhead. So remove the option
that guards this feature, make it enabled by default.

(Side note, I saw lots of people putting this option in their config
files, but this is actually a command line only option.)

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-22 20:45:21 +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