Skip to content

Commit db2f884

Browse files
committed
Merge branch 'next' into dccsillag-next
2 parents 51b2135 + 5ac8b7f commit db2f884

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3421
-1507
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
command: ninja -vC build test
5555
- run:
5656
name: test config file parsing
57-
command: xvfb-run -s "-screen 0 640x480x24" build/src/picom --config picom.sample.conf --no-vsync --diagnostics
57+
command: xvfb-run -s "-screen 0 640x480x24" build/src/picom --config tests/configs/parsing_test.conf --no-vsync --diagnostics
5858
- run:
5959
name: run testsuite
6060
command: tests/run_tests.sh build/src/picom

.clang-tidy

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ Checks: >
1111
misc-static-assert,
1212
-clang-analyzer-*,
1313
-readability-isolate-declaration,
14-
-readability-magic-numbers
14+
-readability-magic-numbers,
15+
-readability-identifier-length,
16+
-bugprone-easily-swappable-parameters
1517
AnalyzeTemporaryDtors: false
1618
FormatStyle: file
1719
CheckOptions:
1820
- key: readability-magic-numbers.IgnoredIntegerValues
1921
value: 4;8;16;24;32;1;2;3;4096;65536;
2022
- key: readability-magic-numbers.IgnoredFloatingPointValues
2123
value: 255.0;1.0;
24+
- key: readability-function-cognitive-complexity.IgnoreMacros
25+
value: true
26+
- key: readability-function-cognitive-complexity.DescribeBasicIncrements
27+
value: true

.github/issue_template.md

+6
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,11 @@
5353

5454
<!-- Or, you can enable core dump, and upload the core file with the corresponding executable here. -->
5555

56+
### OpenGL trace
57+
<!--
58+
If you encounter visual glitches, i.e. things don't look how they supposed to look. It might be a good idea to follow the steps here:
59+
https://github.com/yshui/picom/wiki/Reporting-issues#capture-a-trace , and upload the resulting trace here.
60+
-->
61+
5662
### Other details
5763
<!-- If your problem is visual, you are encouraged to record a short video when the problem occurs and link to it here. -->

.github/workflows/coding-style-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ jobs:
88
steps:
99
- uses: actions/checkout@v2
1010
- run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
11-
- uses: yshui/git-clang-format-lint@v1.11
11+
- uses: yshui/git-clang-format-lint@v1.13
1212
with:
1313
base: ${{ github.event.pull_request.base.sha }}

.github/workflows/coding-style.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
- uses: actions/checkout@v2
1010
with:
1111
fetch-depth: 2
12-
- uses: yshui/git-clang-format-lint@v1.12
12+
- uses: yshui/git-clang-format-lint@v1.13
1313
with:
1414
base: ${{ github.event.ref }}~1

README.md

-14
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ __picom__ is a compositor for X, and a [fork of Compton](History.md).
77

88
You can leave your feedback or thoughts in the [discussion tab](https://github.com/yshui/picom/discussions).
99

10-
## Call for testers
11-
12-
### `--experimental-backends`
13-
14-
This flag enables the refactored/partially rewritten backends.
15-
16-
Currently, new backends feature better vsync with the xrender backend and improved input lag with the glx backend (for non-NVIDIA users). The performance should be on par with the old backends.
17-
18-
New backend features will only be implemented on the new backends from now on, and the old backends will eventually be phased out after the new backends stabilize.
19-
20-
To test the new backends, add the `--experimental-backends` flag to the command you use to run picom. This flag is not available from the configuration file.
21-
22-
To report issues with the new backends, please state explicitly you are using the new backends in your report.
23-
2410
## Change Log
2511

2612
See [Releases](https://github.com/yshui/picom/releases)

man/picom.1.asciidoc

+68-9
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ OPTIONS
8989
*--log-file*::
9090
Set the log file. If *--log-file* is never specified, logs will be written to stderr. Otherwise, logs will to written to the given file, though some of the early logs might still be written to the stderr. When setting this option from the config file, it is recommended to use an absolute path.
9191

92-
*--experimental-backends*::
93-
Use the new, reimplemented version of the backends. The new backends are HIGHLY UNSTABLE at this point, you have been warned. This option is not available in the config file.
92+
*--legacy-backends*::
93+
Use the old version of the backends. This option can not be set from the config file.
9494

9595
*--show-all-xerrors*::
9696
Show all X errors (for debugging).
@@ -216,7 +216,7 @@ A 7x7 Gaussian blur kernel (sigma = 0.84089642) looks like:
216216
--blur-kern '7,7,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003'
217217
----
218218
+
219-
May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box`, `3x3gaussian`, `5x5gaussian`, `7x7gaussian`, `9x9gaussian`, `11x11gaussian`. All Gaussian kernels are generated with sigma = 0.84089642 . If you find yourself needing to generate custom blur kernels, you might want to try the new blur configuration supported by the experimental backends (See *BLUR* and *--experimental-backends*).
219+
May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box`, `3x3gaussian`, `5x5gaussian`, `7x7gaussian`, `9x9gaussian`, `11x11gaussian`. All Gaussian kernels are generated with sigma = 0.84089642 . If you find yourself needing to generate custom blur kernels, you might want to try the new blur configuration (See *BLUR*).
220220

221221
*--blur-background-exclude* 'CONDITION'::
222222
Exclude conditions for background blur.
@@ -258,7 +258,7 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box
258258
Use X Sync fence to sync clients' draw calls, to make sure all draw calls are finished before picom starts drawing. Needed on nvidia-drivers with GLX backend for some users.
259259

260260
*--glx-fshader-win* 'SHADER'::
261-
GLX backend: Use specified GLSL fragment shader for rendering window contents. See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` in the source tree for examples.
261+
GLX backend: Use specified GLSL fragment shader for rendering window contents. See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` in the source tree for examples. Only works with *--legacy-backends* enabled.
262262

263263
*--force-win-blend*::
264264
Force all windows to be painted with blending. Useful if you have a *--glx-fshader-win* that could turn opaque pixels transparent.
@@ -281,6 +281,12 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box
281281
*--transparent-clipping*::
282282
Make transparent windows clip other windows like non-transparent windows do, instead of blending on top of them.
283283

284+
*--window-shader-fg* 'SHADER'::
285+
Specify GLSL fragment shader path for rendering window contents. Does not work when *--legacy-backends* is enabled. Shader is searched first relative to the directory the configuration file is in, then in the usual places for a configuration file. See section *SHADER INTERFACE* below for more details on the interface.
286+
287+
*--window-shader-fg-rule* 'SHADER':'CONDITION'::
288+
Specify GLSL fragment shader path for rendering window contents using patterns. Similar to *--opacity-rule*, arguments should be in the format of 'SHADER:CONDITION', e.g. "shader.frag:name = \'window\'". Leading and trailing whitespaces in 'SHADER' will be trimmed. If 'SHADER' is "default", then the default shader will be used for the matching windows. (This also unfortunately means you can't use a shader file named "default"). Does not work when *--legacy-backends* is enabled.
289+
284290
FORMAT OF CONDITIONS
285291
--------------------
286292
Some options accept a condition string to match certain windows. A condition string is formed by one or more conditions, joined by logical operators.
@@ -351,8 +357,6 @@ Examples:
351357
_NET_FRAME_EXTENTS@[2]:32c < 20 || !_NET_FRAME_EXTENTS@:32c
352358
# The pattern here will be parsed as "dd4"
353359
name = "\x64\x64\o64"
354-
# The pattern here will be parsed as "\x64\x64\x64"
355-
name = r"\x64\x64\o64"
356360
357361
358362
LEGACY FORMAT OF CONDITIONS
@@ -370,6 +374,61 @@ This is the old condition format we once used. Support of this format might be r
370374

371375
'PATTERN' is the actual pattern string.
372376

377+
SHADER INTERFACE
378+
----------------
379+
380+
This secion describes the interface of a custom shader, how it is used by picom, and what parameters are passed by picom to the shader. This does not apply to the legacy backends.
381+
382+
A custom shader is a GLSL fragment shader program, which can be used to override the default way of how a window is rendered. If a custom shader is used, the default picom effects (e.g. dimming, color inversion, etc.) will no longer be automatically applied. It would be the custom shader's responsibility to apply these effects.
383+
384+
The interface between picom and a custom shader is dependent on which backend is being used. The xrender backend doesn't support shader at all. Here we descibe the interface provided by the glx backend.
385+
386+
The shader must define a function, 'vec4 window_shader()', which would be the entry point of the shader. The returned 'vec4' will be used to set 'gl_FragColor'. A function, 'vec4 default_post_processing(vec4 c)', is provided for applying the default picom effects to input color 'c'.
387+
388+
The following uniform/input variables are made available to the shader:
389+
390+
[source,glsl]
391+
----
392+
in vec2 texcoord; // texture coordinate of the fragment
393+
394+
uniform float opacity; // opacity of the window (0.0 - 1.0)
395+
uniform float dim; // dimming factor of the window (0.0 - 1.0, higher means more dim)
396+
uniform float corner_radius; // corner radius of the window (pixels)
397+
uniform float border_width; // estimated border width of the window (pixels)
398+
uniform bool invert_color; // whether to invert the color of the window
399+
uniform sampler2D tex; // texture of the window
400+
uniform sampler2D brightness; // estimated brightness of the window, 1x1 texture
401+
uniform float max_brightness; // configured maximum brightness of the window (0.0 - 1.0)
402+
uniform float time; // time in milliseconds, counting from an unspecified starting point
403+
----
404+
405+
The default behavior of picom window rendering can be replicated by the following shader:
406+
407+
[source,glsl]
408+
----
409+
#version 330
410+
in vec2 texcoord; // texture coordinate of the fragment
411+
412+
uniform sampler2D tex; // texture of the window
413+
414+
// Default window post-processing:
415+
// 1) invert color
416+
// 2) opacity / transparency
417+
// 3) max-brightness clamping
418+
// 4) rounded corners
419+
vec4 default_post_processing(vec4 c);
420+
421+
// Default window shader:
422+
// 1) fetch the specified pixel
423+
// 2) apply default post-processing
424+
vec4 window_shader() {
425+
vec4 c = texelFetch(tex, ivec2(texcoord), 0);
426+
return default_post_processing(c);
427+
}
428+
----
429+
430+
The interface is expected to be mostly stable.
431+
373432
CONFIGURATION FILES
374433
-------------------
375434
picom could read from a configuration file if libconfig support is compiled in. If *--config* is not used, picom will seek for a configuration file in `$XDG_CONFIG_HOME/picom.conf` (`~/.config/picom.conf`, usually), then `$XDG_CONFIG_HOME/picom/picom.conf`, then `$XDG_CONFIG_DIRS/picom.conf` (often `/etc/xdg/picom.conf`), then `$XDG_CONFIG_DIRS/picom/picom.conf`.
@@ -399,13 +458,13 @@ Following per window-type options are available: ::
399458
Controls whether the window of this type is to be always considered focused. (By default, all window types except "normal" and "dialog" has this on.)
400459

401460
blur-background:::
402-
Controls wether the window of this type will have its transparent background blurred.
461+
Controls whether the window of this type will have its transparent background blurred.
403462

404463
full-shadow:::
405464
Controls whether shadow is drawn under the parts of the window that you normally won't be able to see. Useful when the window has parts of it transparent, and you want shadows in those areas.
406465

407466
clip-shadow-above:::
408-
Controls wether shadows that would have been drawn above the window should be clipped. Useful for dock windows that should have no shadow painted on top.
467+
Controls whether shadows that would have been drawn above the window should be clipped. Useful for dock windows that should have no shadow painted on top.
409468

410469
redir-ignore:::
411470
Controls whether this type of windows should cause screen to become redirected again after been unredirected. If you have *--unredir-if-possible* set, and doesn't want certain window to cause unnecessary screen redirection, you can set this to `true`.
@@ -428,7 +487,7 @@ Available options of the 'blur' section are: ::
428487
*method*:::
429488
A string. Controls the blur method. Corresponds to the *--blur-method* command line option. Available choices are:
430489
'none' to disable blurring; 'gaussian' for gaussian blur; 'box' for box blur; 'kernel' for convolution blur with a custom kernel; 'dual_kawase' for dual-filter kawase blur.
431-
Note: 'gaussian', 'box' and 'dual_kawase' blur methods are only supported by the experimental backends.
490+
Note: 'gaussian', 'box' and 'dual_kawase' blur methods are not supported by the legacy backends.
432491
(default: none)
433492
434493
*size*:::

meson.build

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('picom', 'c', version: '9',
2-
default_options: ['c_std=c11'])
2+
default_options: ['c_std=c11', 'warning_level=1'])
33

44
cc = meson.get_compiler('c')
55

@@ -9,7 +9,7 @@ version = 'v'+meson.project_version()
99
# use git describe if that's available
1010
git = find_program('git', required: false)
1111
if git.found()
12-
gitv = run_command('git', 'rev-parse', '--short=5', 'HEAD')
12+
gitv = run_command('git', 'rev-parse', '--short=5', 'HEAD', check: false)
1313
if gitv.returncode() == 0
1414
version = 'vgit-'+gitv.stdout().strip()
1515
endif
@@ -53,16 +53,18 @@ if cc.has_header('stdc-predef.h')
5353
add_global_arguments('-DHAS_STDC_PREDEF_H', language: 'c')
5454
endif
5555

56-
warns = [ 'all', 'cast-function-type', 'ignored-qualifiers', 'missing-parameter-type',
57-
'nonnull', 'shadow', 'no-type-limits', 'old-style-declaration', 'override-init',
58-
'sign-compare', 'type-limits', 'uninitialized', 'shift-negative-value',
59-
'unused-but-set-parameter', 'unused-parameter', 'implicit-fallthrough',
60-
'no-unknown-warning-option', 'no-missing-braces', 'conversion', 'empty-body' ]
61-
foreach w : warns
62-
if cc.has_argument('-W'+w)
63-
add_global_arguments('-W'+w, language: 'c')
64-
endif
65-
endforeach
56+
if get_option('warning_level') != '0'
57+
warns = [ 'cast-function-type', 'ignored-qualifiers', 'missing-parameter-type',
58+
'nonnull', 'shadow', 'no-type-limits', 'old-style-declaration', 'override-init',
59+
'sign-compare', 'type-limits', 'uninitialized', 'shift-negative-value',
60+
'unused-but-set-parameter', 'unused-parameter', 'implicit-fallthrough',
61+
'no-unknown-warning-option', 'no-missing-braces', 'conversion', 'empty-body' ]
62+
foreach w : warns
63+
if cc.has_argument('-W'+w)
64+
add_global_arguments('-W'+w, language: 'c')
65+
endif
66+
endforeach
67+
endif
6668

6769
test_h_dep = subproject('test.h').get_variable('test_h_dep')
6870

@@ -71,6 +73,7 @@ subdir('man')
7173

7274
install_data('bin/picom-trans', install_dir: get_option('bindir'))
7375
install_data('picom.desktop', install_dir: 'share/applications')
76+
install_data('picom.desktop', install_dir: get_option('sysconfdir') / 'xdg' / 'autostart')
7477

7578
if get_option('compton')
7679
install_data('compton.desktop', install_dir: 'share/applications')

picom.desktop

+2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ Categories=Utility;
99
Keywords=compositor;composite manager;window effects;transparency;opacity;
1010
TryExec=picom
1111
Exec=picom
12+
StartupNotify=false
13+
Terminal=false
1214
# Thanks to quequotion for providing this file!
1315
Icon=picom

picom.sample.conf

+10-4
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,17 @@ use-damage = true;
321321
#
322322
# xrender-sync-fence = false
323323

324-
# GLX backend: Use specified GLSL fragment shader for rendering window contents.
325-
# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl`
326-
# in the source tree for examples.
324+
# GLX backend: Use specified GLSL fragment shader for rendering window
325+
# contents. Read the man page for a detailed explanation of the interface.
327326
#
328-
# glx-fshader-win = ""
327+
# window-shader-fg = "default"
328+
329+
# Use rules to set per-window shaders. Syntax is SHADER_PATH:PATTERN, similar
330+
# to opacity-rule. SHADER_PATH can be "default". This overrides window-shader-fg.
331+
#
332+
# window-shader-fg-rule = [
333+
# "my_shader.frag:window_type != 'dock'"
334+
# ]
329335

330336
# Force all windows to be painted with blending. Useful if you
331337
# have a glx-fshader-win that could turn opaque pixels transparent.

0 commit comments

Comments
 (0)