Commit Graph

898 Commits

Author SHA1 Message Date
Michele Lambertucci 99fadd9487 Escape percentages in help strings 2020-01-02 19:26:36 +01: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
Jan Beich bd5a5fb568 Unbreak -Dopengl=false clean build
In file included from ../src/x.c:17:
../src/backend/gl/glx.h:10:10: fatal error: 'GL/glx.h' file not found
 #include <GL/glx.h>
         ^~~~~~~~~~
2019-10-12 13:29:10 +00:00
Yuxuan Shui 945dc179f5
meson.build: make sure xcb packages are recent enough
Fixes #248

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-11 18:11:45 +01:00
Yuxuan Shui 1ca01ec456
Make sure window cannot enter fading when unredirected
Firstly, this breaks the assumption that when we redirect the screen,
all window is either mapped or unmapped, causing a assertion failure.

Secondly, if transition window into fading when the screen is not
redirected, the fading will not progress until the screen is redirected,
probably not the desired result.

Fixes #246

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-11 18:01:13 +01:00
Yuxuan Shui 93f0d80572
options: enable use-damage by default
Since user reports indicate it has real performance benefits.

Also add a command line flag for turning use-damage off.

Fixes #242

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:52:07 +01:00
Yuxuan Shui a69ed89114
Treat first frame after redirection differently
Because first frame no window has their pixmap bound, which doesn't
happen in frames after the first. If a window is unmapped in that frame,
the compositor will try to render a window with no pixmap bound if
fading is enabled.

Now we keep track if we are in the first frame, and if that's the case
we skip fading in unmap/destroy.

Fixes #239, bug number 2

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:40:09 +01:00
Yuxuan Shui f493447b33
win: clear PIXMAP_STALE in {unmap,destroy}_win_start
Also make sure unmapped/destroyed windows don't have PIXMAP_STALE flag
set.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:09:40 +01:00
Yuxuan Shui 0fc6f9aee2
core: bind shadow immediate in initialize_backend
This simplifies the logic a bit since we know a shadow is always bound
(if needed) when the screen is redirected.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:04:09 +01:00
Yuxuan Shui d5e8cf655c
core: rename some functions for clarity
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-28 23:43:36 +01:00
Yuxuan Shui 0c7a19fda6
backend: glx: add support for setting vsync
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-25 23:20:48 +01:00
Jerónimo Navarro 94c8927d7b win_defs.h: fix #240 2019-09-25 09:47:36 -03:00
Yuxuan Shui 33a106e254
win: don't ignore SHADOW_STALE flag on unmapped windows
Previously all image stale flags are ignored when processing an unmapped
window. If a window gains a shadow during its fading out transition, the
shadow flag will be set, but shadow won't actually be generated, causing
a NULL pointer dereference during render.

Fixes #239

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:52:26 +01:00
Yuxuan Shui c85c9ef1cc
win: set session::pending_updates in win_set_shadow
Otherwise shadow won't get generated in next critical section, causing
NULL pointer dereference or assertion failure in next render.

Partially fixes #239

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:52:11 +01:00
Yuxuan Shui 8628e498c5
win: rename win_get_name to win_update_name
Make explicit the fact that it modifies the win struct.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:22:17 +01:00
Yuxuan Shui 1a1540a5a6
events: don't call win_get_name for logging
win_get_name _updates_ the name of the window by querying the X server,
thus potentially changes the behaviour of the compositor when logging is
turned on (e.g. we could fail to detect window name changes, because the
name was blindly updated in a logging call without handling the name change).

We shouldn't do that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:21:07 +01:00
Yuxuan Shui 73ea5d2bfb
backend: dummy: add more sanity checks
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:19:28 +01:00