From 8ddbebb5d12a78d7440325c2ee68c7e84759921a Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 23 Oct 2019 19:27:30 +0100 Subject: [PATCH 1/3] 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 --- .circleci/config.yml | 4 +- .github/issue_template.md | 14 +++--- bin/{compton-trans => picom-trans} | 28 ++++++----- man/meson.build | 4 +- ...rans.1.asciidoc => picom-trans.1.asciidoc} | 26 +++++------ man/{compton.1.asciidoc => picom.1.asciidoc} | 46 +++++++++---------- meson.build | 9 ++-- meson/install.sh | 11 +++++ meson_options.txt | 2 +- picom.desktop | 11 +++++ compton.sample.conf => picom.sample.conf | 0 src/backend/backend.h | 2 +- src/backend/gl/gl_common.c | 2 +- src/backend/gl/glx.c | 6 +-- src/backend/xrender/xrender.c | 2 +- src/c2.c | 2 +- src/common.h | 6 +-- src/compton.modulemap | 4 +- src/config.h | 6 +-- src/dbus.c | 2 +- src/event.c | 4 +- src/meson.build | 10 ++-- src/opengl.h | 2 +- src/options.c | 32 ++++++------- src/{compton.c => picom.c} | 38 ++++++++------- src/{compton.h => picom.h} | 6 +-- src/utils.h | 2 +- src/win.c | 6 +-- src/win.h | 2 +- src/x.c | 4 +- src/x.h | 4 +- tests/run_one_test.sh | 6 +-- tests/run_tests.sh | 8 ++-- 33 files changed, 172 insertions(+), 139 deletions(-) rename bin/{compton-trans => picom-trans} (90%) rename man/{compton-trans.1.asciidoc => picom-trans.1.asciidoc} (68%) rename man/{compton.1.asciidoc => picom.1.asciidoc} (88%) create mode 100644 meson/install.sh create mode 100644 picom.desktop rename compton.sample.conf => picom.sample.conf (100%) rename src/{compton.c => picom.c} (98%) rename src/{compton.h => picom.h} (96%) diff --git a/.circleci/config.yml b/.circleci/config.yml index a6f464c9..973a904d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,10 +54,10 @@ jobs: command: ninja -vC build test - run: name: test config file parsing - command: xvfb-run -s "-screen 0 640x480x24" build/src/compton --config compton.sample.conf --vsync=none --diagnostics + command: xvfb-run -s "-screen 0 640x480x24" build/src/picom --config picom.sample.conf --no-vsync --diagnostics - run: name: run testsuite - command: tests/run_tests.sh build/src/compton + command: tests/run_tests.sh build/src/picom - run: name: generate coverage reports command: cd build; find -name '*.gcno' -exec gcov -pb {} + diff --git a/.github/issue_template.md b/.github/issue_template.md index 40af2e86..46e2d08f 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -13,12 +13,12 @@ ### Environment -### Compton version - - +### picom version + + -### Compton configuration: +### Configuration: ``` // Paste your configuration here ``` @@ -38,12 +38,12 @@ ### Stack trace - + ### Other details diff --git a/bin/compton-trans b/bin/picom-trans similarity index 90% rename from bin/compton-trans rename to bin/picom-trans index af2d3309..6b1d1df9 100755 --- a/bin/compton-trans +++ b/bin/picom-trans @@ -1,28 +1,32 @@ #!/bin/sh # -# compton-trans +# picom-trans # transset in a bash script # Copyright (c) 2011-2012, Christopher Jeffrey # # Usage: -# $ compton-trans [options] [+|-]opacity +# $ picom-trans [options] [+|-]opacity # By window id -# $ compton-trans -w "$WINDOWID" 75 +# $ picom-trans -w "$WINDOWID" 75 # By name -# $ compton-trans -n "urxvt" 75 +# $ picom-trans -n "urxvt" 75 # By current window -# $ compton-trans -c 75 +# $ picom-trans -c 75 # By selection -# $ compton-trans 75 -# $ compton-trans -s 75 +# $ picom-trans 75 +# $ picom-trans -s 75 # Increment current window 5% -# $ compton-trans -c +5 +# $ picom-trans -c +5 # Delete current window's opacity -# $ compton-trans -c --delete +# $ picom-trans -c --delete # Reset all windows -# $ compton-trans --reset +# $ picom-trans --reset + +case "$0" in + *compton-trans*) echo "Warning: compton has been renamed, please use picom-trans instead" >& 2;; +esac # "command" is a shell built-in, faster than "which" if test -z "$(command -v xprop)" -o -z "$(command -v xwininfo)"; then @@ -51,8 +55,8 @@ done # This takes into account the fact that getopts stops on # any argument it doesn't recognize or errors on. This -# allows for things like `compton-trans -5` as well -# as `compton-trans -c +5 -s` (contrived example). +# allows for things like `picom-trans -5` as well +# as `picom-trans -c +5 -s` (contrived example). while test $# -gt 0; do # Reset option index OPTIND=1 diff --git a/man/meson.build b/man/meson.build index 816bb419..7d00274c 100644 --- a/man/meson.build +++ b/man/meson.build @@ -1,10 +1,10 @@ -mans = ['compton.1', 'compton-trans.1'] +mans = ['picom.1', 'picom-trans.1'] if get_option('with_docs') a2x = find_program('a2x') foreach m : mans custom_target(m, output: [m], input: [m+'.asciidoc'], command: [a2x, '-a', - 'compton-version='+version, + 'picom-version='+version, '--format', 'manpage', '@INPUT@', '-D', meson.current_build_dir()], install: true, install_dir: 'share/man/man1/') diff --git a/man/compton-trans.1.asciidoc b/man/picom-trans.1.asciidoc similarity index 68% rename from man/compton-trans.1.asciidoc rename to man/picom-trans.1.asciidoc index 0582af04..23b91045 100644 --- a/man/compton-trans.1.asciidoc +++ b/man/picom-trans.1.asciidoc @@ -1,23 +1,23 @@ -compton-trans(1) +picom-trans(1) ================ :doctype: manpage -:man source: compton -:man version: {compton-version} +:man source: picom +:man version: {picom-version} :man manual: User Commands NAME ---- -compton-trans - an opacity setter tool +picom-trans - an opacity setter tool SYNOPSIS -------- -*compton-trans* [-w 'WINDOW_ID'] [-n 'WINDOW_NAME'] [-c] [-s] 'OPACITY' +*picom-trans* [-w 'WINDOW_ID'] [-n 'WINDOW_NAME'] [-c] [-s] 'OPACITY' DESCRIPTION ----------- -*compton-trans* is a bash script that sets '_NET_WM_WINDOW_OPACITY' attribute of a window using standard X11 command-line utilities, including *xprop*(1) and *xwininfo*(1). It is similar to *transset*(1) or *transset-df*(1). +*picom-trans* is a bash script that sets '_NET_WM_WINDOW_OPACITY' attribute of a window using standard X11 command-line utilities, including *xprop*(1) and *xwininfo*(1). It is similar to *transset*(1) or *transset-df*(1). OPTIONS ------- @@ -42,37 +42,37 @@ EXAMPLES * Set the opacity of the window with specific window ID to 75%: + ------------ -compton-trans -w "$WINDOWID" 75 +picom-trans -w "$WINDOWID" 75 ------------ * Set the opacity of the window with the name "urxvt" to 75%: + ------------ -compton-trans -n "urxvt" 75 +picom-trans -n "urxvt" 75 ------------ * Set current window to opacity of 75%: + ------------ -compton-trans -c 75 +picom-trans -c 75 ------------ * Select target window and set opacity to 75%: + ------------ -compton-trans -s 75 +picom-trans -s 75 ------------ * Increment opacity of current active window by 5%: + ------------ -compton-trans -c +5 +picom-trans -c +5 ------------ * Decrement opacity of current active window by 5%: + ------------ -compton-trans -c -- -5 +picom-trans -c -- -5 ------------ BUGS @@ -81,4 +81,4 @@ Please submit bug reports to . SEE ALSO -------- -link:compton.1.html[*compton*(1)], *xprop*(1), *xwininfo*(1) +link:picom.1.html[*picom*(1)], *xprop*(1), *xwininfo*(1) diff --git a/man/compton.1.asciidoc b/man/picom.1.asciidoc similarity index 88% rename from man/compton.1.asciidoc rename to man/picom.1.asciidoc index 7e0d9d9b..221c5952 100644 --- a/man/compton.1.asciidoc +++ b/man/picom.1.asciidoc @@ -1,21 +1,21 @@ -compton(1) +picom(1) ========== :doctype: manpage -:man source: compton -:man version: {compton-version} +:man source: picom +:man version: {picom-version} :man manual: User Commands NAME ---- -compton - a compositor for X11 +picom - a compositor for X11 SYNOPSIS -------- -*compton* ['OPTIONS'] +*picom* ['OPTIONS'] DESCRIPTION ----------- -compton is a compositor based on Dana Jansens' version of xcompmgr (which itself was written by Keith Packard). It includes some improvements over the original xcompmgr, like window frame opacity and inactive window transparency. +picom is a compositor based on Dana Jansens' version of xcompmgr (which itself was written by Keith Packard). It includes some improvements over the original xcompmgr, like window frame opacity and inactive window transparency. OPTIONS ------- @@ -83,7 +83,7 @@ OPTIONS Show all X errors (for debugging). *--config* 'PATH':: - Look for configuration file at the path. See *CONFIGURATION FILES* section below for where compton looks for a configuration file by default. Use `/dev/null` to avoid loading configuration file. + Look for configuration file at the path. See *CONFIGURATION FILES* section below for where picom looks for a configuration file by default. Use `/dev/null` to avoid loading configuration file. *--write-pid-path* 'PATH':: Write process ID to a file. @@ -128,13 +128,13 @@ OPTIONS Detect '_NET_WM_OPACITY' on client windows, useful for window managers not passing '_NET_WM_OPACITY' of client windows to frame windows. *--refresh-rate* 'REFRESH_RATE':: - Specify refresh rate of the screen. If not specified or 0, compton will try detecting this with X RandR extension. + Specify refresh rate of the screen. If not specified or 0, picom will try detecting this with X RandR extension. *--vsync*, *--no-vsync*:: Enable/disable VSync. *--sw-opti*:: - Limit compton to repaint at most once every 1 / 'refresh_rate' second to boost performance. This should not be used with *--vsync* drm/opengl/opengl-oml as they essentially does *--sw-opti*'s job already, unless you wish to specify a lower refresh rate than the actual value. + Limit picom to repaint at most once every 1 / 'refresh_rate' second to boost performance. This should not be used with *--vsync* drm/opengl/opengl-oml as they essentially does *--sw-opti*'s job already, unless you wish to specify a lower refresh rate than the actual value. *--use-ewmh-active-win*:: Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, provided that the WM supports it. @@ -209,7 +209,7 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box Specify a list of conditions of windows that should be painted with inverted color. Resource-hogging, and is not well tested. *--opacity-rule* 'OPACITY':'CONDITION':: - Specify a list of opacity rules, in the format `PERCENT:PATTERN`, like `50:name *= "Firefox"`. compton-trans is recommended over this. Note we don't make any guarantee about possible conflicts with other programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. + Specify a list of opacity rules, in the format `PERCENT:PATTERN`, like `50:name *= "Firefox"`. picom-trans is recommended over this. Note we don't make any guarantee about possible conflicts with other programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. *--shadow-exclude-reg* 'GEOMETRY':: Specify a X geometry that describes the region in which shadow should not be painted in, such as a dock window region. Use `--shadow-exclude-reg x10+0-0`, for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. @@ -236,7 +236,7 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box Disable the use of damage information. This cause the whole screen to be redrawn everytime, instead of the part of the screen has actually changed. Potentially degrades the performance, but might fix some artifacts. *--xrender-sync-fence*:: - Use X Sync fence to sync clients' draw calls, to make sure all draw calls are finished before compton starts drawing. Needed on nvidia-drivers with GLX backend for some users. + 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. *--glx-fshader-win* 'SHADER':: 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. @@ -342,9 +342,9 @@ This is the old condition format we once used. Support of this format might be r CONFIGURATION FILES ------------------- -compton could read from a configuration file if libconfig support is compiled in. If *--config* is not used, compton will seek for a configuration file in `$XDG_CONFIG_HOME/compton.conf` (`~/.config/compton.conf`, usually), then `~/.compton.conf`, then `compton.conf` under `$XDG_CONFIG_DIRS` (often `/etc/xdg/compton.conf`). +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/compton.conf` (`~/.config/compton.conf`, usually), then `~/.compton.conf`, then `compton.conf` under `$XDG_CONFIG_DIRS` (often `/etc/xdg/compton.conf`). -compton uses general libconfig configuration file format. A sample configuration file is available as `compton.sample.conf` in the source tree. Most of commandline switches can be used as options in configuration file as well. For example, *--vsync* option documented above can be set in the configuration file using `vsync = `. Command line options will always overwrite the settings in the configuration file. +picom uses general libconfig configuration file format. A sample configuration file is available as `compton.sample.conf` in the source tree. Most of commandline switches can be used as options in configuration file as well. For example, *--vsync* option documented above can be set in the configuration file using `vsync = `. Command line options will always overwrite the settings in the configuration file. Window-type-specific settings are exposed only in configuration file and has the following format: @@ -406,12 +406,12 @@ Available options of the 'blur' section are: :: SIGNALS ------- -* compton reinitializes itself upon receiving `SIGUSR1`. +* picom reinitializes itself upon receiving `SIGUSR1`. D-BUS API --------- -It's possible to control compton via D-Bus messages, by running compton with *--dbus* and send messages to `com.github.chjj.compton.`. `` is the display used by compton, with all non-alphanumeric characters transformed to underscores. For `DISPLAY=:0.0` you should use `com.github.chjj.compton._0_0`, for example. +It's possible to control picom via D-Bus messages, by running picom with *--dbus* and send messages to `com.github.chjj.compton.`. `` is the display used by picom, with all non-alphanumeric characters transformed to underscores. For `DISPLAY=:0.0` you should use `com.github.chjj.compton._0_0`, for example. The D-Bus methods and signals are not yet stable, thus undocumented right now. @@ -421,37 +421,37 @@ EXAMPLES * Disable configuration file parsing: + ------------ -$ compton --config /dev/null +$ picom --config /dev/null ------------ -* Run compton with client-side shadow and fading, disable shadow on dock windows and drag-and-drop windows: +* Run picom with client-side shadow and fading, disable shadow on dock windows and drag-and-drop windows: + ------------ -$ compton -cCGf +$ picom -cCGf ------------ * Same thing as above, plus making inactive windows 80% transparent, making frame 80% transparent, don't fade on window open/close, enable software optimization, and fork to background: + ------------ -$ compton -bcCGf -i 0.8 -e 0.8 --no-fading-openclose --sw-opti +$ picom -bcCGf -i 0.8 -e 0.8 --no-fading-openclose --sw-opti ------------ * Draw white shadows: + ------------ -$ compton -c --shadow-red 1 --shadow-green 1 --shadow-blue 1 +$ picom -c --shadow-red 1 --shadow-green 1 --shadow-blue 1 ------------ * Avoid drawing shadows on wbar window: + ------------ -$ compton -c --shadow-exclude 'class_g = "wbar"' +$ picom -c --shadow-exclude 'class_g = "wbar"' ------------ * Enable VSync with GLX backend: + ------------ -$ compton --backend glx --vsync +$ picom --backend glx --vsync ------------ BUGS @@ -466,4 +466,4 @@ Homepage: SEE ALSO -------- -*xcompmgr*(1), link:compton-trans.html[*compton-trans*(1)] +*xcompmgr*(1), link:picom-trans.html[*picom-trans*(1)] diff --git a/meson.build b/meson.build index d2fb9323..9e63e132 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('compton', 'c', version: '7', +project('picom', 'c', version: '7', default_options: ['c_std=c11']) cc = meson.get_compiler('c') @@ -43,7 +43,7 @@ if get_option('modularize') add_global_arguments(['-fmodules', '-fmodule-map-file='+ meson.current_source_dir()+ - '/src/compton.modulemap'], + '/src/picom.modulemap'], language: 'c') endif @@ -69,9 +69,12 @@ test_h_dep = subproject('test.h').get_variable('test_h_dep') subdir('src') subdir('man') -install_data('bin/compton-trans', install_dir: get_option('bindir')) +install_data('bin/picom-trans', install_dir: get_option('bindir')) install_data('compton.desktop', install_dir: 'share/applications') +install_data('picom.desktop', install_dir: 'share/applications') install_data('media/icons/48x48/compton.png', install_dir: 'share/icons/hicolor/48x48/apps') install_data('media/compton.svg', install_dir: 'share/icons/hicolor/scalable/apps') + +meson.add_install_script('meson/install.sh') diff --git a/meson/install.sh b/meson/install.sh new file mode 100644 index 00000000..a591c399 --- /dev/null +++ b/meson/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ ! -e "${MESON_INSTALL_DESTDIR_PREFIX}/bin/compton" ]; then + echo "Linking picom to ${MESON_INSTALL_DESTDIR_PREFIX}/bin/compton" + ln -s picom "${MESON_INSTALL_DESTDIR_PREFIX}/bin/compton" +fi + +if [ ! -e "${MESON_INSTALL_DESTDIR_PREFIX}/bin/compton-trans" ]; then + echo "Linking picom-trans to ${MESON_INSTALL_DESTDIR_PREFIX}/bin/compton-trans" + ln -s picom-trans "${MESON_INSTALL_DESTDIR_PREFIX}/bin/compton-trans" +fi diff --git a/meson_options.txt b/meson_options.txt index d0790a3e..a53e35a2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ -option('sanitize', type: 'boolean', value: false, description: 'Compile compton with sanitizers') +option('sanitize', type: 'boolean', value: false, description: 'Build with sanitizers enabled (deprecated)') option('config_file', type: 'boolean', value: true, description: 'Enable config file support') option('regex', type: 'boolean', value: true, description: 'Enable regex support in window conditions') diff --git a/picom.desktop b/picom.desktop new file mode 100644 index 00000000..f3f9c262 --- /dev/null +++ b/picom.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=picom +GenericName=X compositor +Comment=A X compositor +Categories=Utility; +Keywords=compositor;composite manager;window effects;transparency;opacity; +TryExec=picom +Exec=picom +# Thanks to quequotion for providing this file! diff --git a/compton.sample.conf b/picom.sample.conf similarity index 100% rename from compton.sample.conf rename to picom.sample.conf diff --git a/src/backend/backend.h b/src/backend/backend.h index 4e690703..baa9c770 100644 --- a/src/backend/backend.h +++ b/src/backend/backend.h @@ -220,7 +220,7 @@ struct backend_operations { /// Let the backend hook into the event handling queue /// Not implemented yet void (*set_ready_callback)(backend_t *, backend_ready_callback_t cb); - /// Called right after compton has handled its events. + /// Called right after the core has handled its events. /// Not implemented yet void (*handle_events)(backend_t *); // =========== Misc ============ diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index 7a0bdfdb..cfb04652 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -50,7 +50,7 @@ struct gl_blur_context { static GLint glGetUniformLocationChecked(GLuint p, const char *name) { auto ret = glGetUniformLocation(p, name); if (ret < 0) { - log_error("Failed to get location of uniform '%s'. compton might not " + log_error("Failed to get location of uniform '%s'. the compositor might not " "work correctly.", name); } diff --git a/src/backend/gl/glx.c b/src/backend/gl/glx.c index d02d4a55..c2e30236 100644 --- a/src/backend/gl/glx.c +++ b/src/backend/gl/glx.c @@ -26,7 +26,7 @@ #include "backend/gl/glx.h" #include "common.h" #include "compiler.h" -#include "compton.h" +#include "picom.h" #include "config.h" #include "log.h" #include "region.h" @@ -109,7 +109,7 @@ struct glx_fbconfig_info *glx_find_fbconfig(Display *dpy, int screen, struct xvi glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_BIND_TO_TEXTURE_RGB_EXT, &rgb); glXGetFBConfigAttribChecked(dpy, cfg[i], GLX_BIND_TO_TEXTURE_RGBA_EXT, &rgba); if (!rgb && !rgba) { - log_info("FBConfig is neither RGBA nor RGB, compton cannot " + log_info("FBConfig is neither RGBA nor RGB, we cannot " "handle this setup."); continue; } @@ -466,7 +466,7 @@ static void glx_present(backend_t *base, const region_t *region attr_unused) { struct _glx_data *gd = (void *)base; gl_present(base, region); glXSwapBuffers(gd->display, gd->target_win); - // XXX there should be no need to block compton will wait for render to finish + // XXX there should be no need to block, the core should wait for render to finish if (!gd->gl.is_nvidia) { glFinish(); } diff --git a/src/backend/xrender/xrender.c b/src/backend/xrender/xrender.c index 33b9ce88..8e7f9921 100644 --- a/src/backend/xrender/xrender.c +++ b/src/backend/xrender/xrender.c @@ -14,7 +14,7 @@ #include "backend/backend.h" #include "backend/backend_common.h" #include "common.h" -#include "compton.h" +#include "picom.h" #include "config.h" #include "kernel.h" #include "log.h" diff --git a/src/c2.c b/src/c2.c index 457ee3de..af29520b 100644 --- a/src/c2.c +++ b/src/c2.c @@ -1028,7 +1028,7 @@ static bool c2_l_postprocess(session_t *ps, c2_l_t *pleaf) { } } - // Enable specific tracking options in compton if needed by the condition + // Enable specific tracking options, if needed by the condition // TODO: Add track_leader switch (pleaf->predef) { // case C2_L_PROUNDED: ps->o.detect_rounded_corners = true; break; diff --git a/src/common.h b/src/common.h index 78db46c4..e5ebd475 100644 --- a/src/common.h +++ b/src/common.h @@ -125,7 +125,7 @@ typedef struct _latom { struct _latom *next; } latom_t; -/// Structure containing all necessary data for a compton session. +/// Structure containing all necessary data for a session. typedef struct session { // === Event handlers === /// ev_io for X connection @@ -184,7 +184,7 @@ typedef struct session { xcb_window_t overlay; /// The target window for debug mode xcb_window_t debug_window; - /// Whether the root tile is filled by compton. + /// Whether the root tile is filled by us. bool root_tile_fill; /// Picture of the root window background. paint_t root_tile_paint; @@ -241,7 +241,7 @@ typedef struct session { ignore_t **ignore_tail; // Cached blur convolution kernels. struct x_convolution_kernel **blur_kerns_cache; - /// If compton should quit + /// If we should quit bool quit:1; /// Whether there are pending updates, like window creation, etc. /// TODO use separate flags for dfferent kinds of updates so we don't diff --git a/src/compton.modulemap b/src/compton.modulemap index bd75c82a..787c4fff 100644 --- a/src/compton.modulemap +++ b/src/compton.modulemap @@ -20,8 +20,8 @@ module utils { module region { header "region.h" } -module compton { - header "compton.h" +module picom { + header "picom.h" } module types { header "types.h" diff --git a/src/config.h b/src/config.h index eb294373..a6a9f616 100644 --- a/src/config.h +++ b/src/config.h @@ -28,7 +28,7 @@ typedef struct session session_t; -/// @brief Possible backends of compton. +/// @brief Possible backends enum backend { BKEND_XRENDER, BKEND_GLX, @@ -226,9 +226,9 @@ typedef struct options { bool detect_client_leader; // === Calculated === - /// Whether compton needs to track window name and class. + /// Whether we need to track window name and class. bool track_wdata; - /// Whether compton needs to track window leaders. + /// Whether we need to track window leaders. bool track_leader; // Don't use EWMH to detect fullscreen applications diff --git a/src/dbus.c b/src/dbus.c index 4df9f336..3161dbeb 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -1228,7 +1228,7 @@ cdbus_process(DBusConnection *c attr_unused, DBusMessage *msg, void *ud) { dbus_message_is_method_call(msg, CDBUS_INTERFACE_NAME, method) if (cdbus_m_ismethod("reset")) { - log_info("compton is resetting..."); + log_info("picom is resetting..."); ev_break(ps->loop, EVBREAK_ALL); if (!dbus_message_get_no_reply(msg)) cdbus_reply_bool(ps, msg, true); diff --git a/src/event.c b/src/event.c index b5cbf640..921a3c73 100644 --- a/src/event.c +++ b/src/event.c @@ -11,7 +11,7 @@ #include "atom.h" #include "common.h" #include "compiler.h" -#include "compton.h" +#include "picom.h" #include "config.h" #include "event.h" #include "log.h" @@ -633,7 +633,7 @@ ev_selection_clear(session_t *ps, xcb_selection_clear_event_t attr_unused *ev) { // If we lose that one, we should exit. log_fatal("Another composite manager started and took the _NET_WM_CM_Sn " "selection."); - quit_compton(ps); + quit(ps); } void ev_handle(session_t *ps, xcb_generic_event_t *ev) { diff --git a/src/meson.build b/src/meson.build index 62553e10..de3aff20 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,10 +7,10 @@ base_deps = [ libev ] -srcs = [ files('compton.c', 'win.c', 'c2.c', 'x.c', 'config.c', 'vsync.c', 'utils.c', +srcs = [ files('picom.c', 'win.c', 'c2.c', 'x.c', 'config.c', 'vsync.c', 'utils.c', 'diagnostic.c', 'string_utils.c', 'render.c', 'kernel.c', 'log.c', 'options.c', 'event.c', 'cache.c', 'atom.c') ] -compton_inc = include_directories('.') +picom_inc = include_directories('.') cflags = [] @@ -80,10 +80,10 @@ endif subdir('backend') -compton = executable('compton', srcs, c_args: cflags, +picom = executable('picom', srcs, c_args: cflags, dependencies: [ base_deps, deps, test_h_dep ], - install: true, include_directories: compton_inc) + install: true, include_directories: picom_inc) if get_option('unittest') - test('compton unittest', compton, args: [ '--unittest' ]) + test('picom unittest', picom, args: [ '--unittest' ]) endif diff --git a/src/opengl.h b/src/opengl.h index 5ef58c4d..033cf16e 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -40,7 +40,7 @@ typedef struct { GLint unifm_factor_center; } glx_blur_pass_t; -/// Structure containing GLX-dependent data for a compton session. +/// Structure containing GLX-dependent data for a session. typedef struct glx_session { // === OpenGL related === /// GLX context. diff --git a/src/options.c b/src/options.c index 192933f2..c66fbfc0 100644 --- a/src/options.c +++ b/src/options.c @@ -22,13 +22,12 @@ /** * Print usage text. */ -static void usage(int ret) { +static void usage(const char *argv0, int ret) { #define WARNING_DISABLED " (DISABLED AT COMPILE TIME)" static const char *usage_text = - "compton (" COMPTON_VERSION ")\n" - "This is the maintenance fork of compton, please report\n" - "bugs to https://github.com/yshui/compton\n\n" - "usage: compton [options]\n" + "picom (" COMPTON_VERSION ")\n" + "Please report bugs to https://github.com/yshui/picom\n\n" + "usage: %s [options]\n" "Options:\n" "\n" "-r radius\n" @@ -151,7 +150,7 @@ static void usage(int ret) { " windows.\n" "\n" "--refresh-rate val\n" - " Specify refresh rate of the screen. If not specified or 0, compton\n" + " Specify refresh rate of the screen. If not specified or 0, we\n" " will try detecting this with X RandR extension.\n" "\n" "--vsync\n" @@ -161,8 +160,7 @@ static void usage(int ret) { " Painting on X Composite overlay window.\n" "\n" "--sw-opti\n" - " Limit compton to repaint at most once every 1 / refresh_rate\n" - " second to boost performance.\n" + " Limit repaint to at most once every 1 / refresh_rate second.\n" "\n" "--use-ewmh-active-win\n" " Use _NET_WM_ACTIVE_WINDOW on the root window to determine which\n" @@ -246,7 +244,7 @@ static void usage(int ret) { "\n" "--opacity-rule opacity:condition\n" " Specify a list of opacity rules, in the format \"PERCENT:PATTERN\",\n" - " like \'50:name *= \"Firefox\"'. compton-trans is recommended over\n" + " like \'50:name *= \"Firefox\"'. picom-trans is recommended over\n" " this. Note we do not distinguish 100% and unset, and we don't make\n" " any guarantee about possible conflicts with other programs that set\n" " _NET_WM_WINDOW_OPACITY on frame or client windows.\n" @@ -313,13 +311,13 @@ static void usage(int ret) { "\n" "--debug-mode\n" " Render into a separate window, and don't take over the screen. Useful\n" - " when you want to attach a debugger to compton\n" + " when you want to attach a debugger to picom\n" "\n" "--no-ewmh-fullscreen\n" " Do not use EWMH to detect fullscreen windows. Reverts to checking\n" " if a window is fullscreen based only on its size and coordinates.\n"; FILE *f = (ret ? stderr : stdout); - fputs(usage_text, f); + fprintf(f, usage_text, argv0); #undef WARNING_DISABLED } @@ -438,7 +436,7 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all if (o == 256) { *config_file = strdup(optarg); } else if (o == 'h') { - usage(0); + usage(argv[0], 0); return true; } else if (o == 'b') { @@ -456,7 +454,7 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all } else if (o == 320) { log_warn("--no-name-pixmap will be ignored"); } else if (o == '?' || o == ':') { - usage(1); + usage(argv[0], 1); *exit_code = 1; return true; } @@ -465,7 +463,7 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all // Check for abundant positional arguments if (optind < argc) { // log is not initialized here yet - fprintf(stderr, "compton doesn't accept positional arguments.\n"); + fprintf(stderr, "picom doesn't accept positional arguments.\n"); *exit_code = 1; return true; } @@ -516,7 +514,7 @@ void get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, // Short options case 318: case 'h': - // These options should cause compton to exit early, + // These options should cause us to exit early, // so assert(false) here assert(false); break; @@ -617,7 +615,7 @@ void get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, break; case 271: // --alpha-step - log_warn("--alpha-step has been removed, compton now tries to " + log_warn("--alpha-step has been removed, we now tries to " "make use of all alpha values"); break; case 272: log_warn("use of --dbe is deprecated"); break; @@ -798,7 +796,7 @@ void get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, case 801: opt->print_diagnostics = true; break; P_CASEBOOL(802, debug_mode); P_CASEBOOL(803, no_ewmh_fullscreen); - default: usage(1); break; + default: usage(argv[0], 1); break; #undef P_CASEBOOL } // clang-format on diff --git a/src/compton.c b/src/picom.c similarity index 98% rename from src/compton.c rename to src/picom.c index 6832377a..8b5e41ba 100644 --- a/src/compton.c +++ b/src/picom.c @@ -31,10 +31,10 @@ #include "common.h" #include "compiler.h" -#include "compton.h" #include "config.h" #include "err.h" #include "kernel.h" +#include "picom.h" #ifdef CONFIG_OPENGL #include "opengl.h" #endif @@ -98,7 +98,7 @@ void set_root_flags(session_t *ps, uint64_t flags) { ps->root_flags |= flags; } -void quit_compton(session_t *ps) { +void quit(session_t *ps) { ps->quit = true; ev_break(ps->loop, EVBREAK_ALL); } @@ -731,7 +731,7 @@ static bool initialize_backend(session_t *ps) { } if (!ps->backend_data) { log_fatal("Failed to initialize backend, aborting..."); - quit_compton(ps); + quit(ps); return false; } ps->backend_data->ops = backend_list[ps->o.backend]; @@ -740,7 +740,7 @@ static bool initialize_backend(session_t *ps) { log_fatal("Failed to prepare for background blur, aborting..."); ps->backend_data->ops->deinit(ps->backend_data); ps->backend_data = NULL; - quit_compton(ps); + quit(ps); return false; } @@ -937,10 +937,10 @@ static bool register_cm(session_t *ps) { { XClassHint *h = XAllocClassHint(); if (h) { - h->res_name = "compton"; - h->res_class = "compton"; + h->res_name = "picom"; + h->res_class = "picom"; } - Xutf8SetWMProperties(ps->dpy, ps->reg_win, "compton", "compton", NULL, 0, + Xutf8SetWMProperties(ps->dpy, ps->reg_win, "picom", "picom", NULL, 0, NULL, NULL, h); XFree(h); } @@ -1334,7 +1334,7 @@ static void handle_pending_updates(EV_P_ struct session *ps) { log_fatal("failed to grab x server"); x_print_error(e->full_sequence, e->major_code, e->minor_code, e->error_code); - return quit_compton(ps); + return quit(ps); } ps->server_grabbed = true; @@ -1349,7 +1349,8 @@ static void handle_pending_updates(EV_P_ struct session *ps) { refresh_windows(ps); { - auto r = xcb_get_input_focus_reply(ps->c, xcb_get_input_focus(ps->c), NULL); + auto r = xcb_get_input_focus_reply( + ps->c, xcb_get_input_focus(ps->c), NULL); if (!ps->active_win || (r && r->focus != ps->active_win->base.id)) { recheck_focus(ps); } @@ -1367,7 +1368,7 @@ static void handle_pending_updates(EV_P_ struct session *ps) { log_fatal("failed to ungrab x server"); x_print_error(e->full_sequence, e->major_code, e->minor_code, e->error_code); - return quit_compton(ps); + return quit(ps); } ps->server_grabbed = false; @@ -1521,17 +1522,17 @@ static void x_event_callback(EV_P attr_unused, ev_io *w, int revents attr_unused /** * Turn on the program reset flag. * - * This will result in compton resetting itself after next paint. + * This will result in the compostior resetting itself after next paint. */ static void reset_enable(EV_P_ ev_signal *w attr_unused, int revents attr_unused) { - log_info("compton is resetting..."); + log_info("picom is resetting..."); ev_break(EV_A_ EVBREAK_ALL); } static void exit_enable(EV_P attr_unused, ev_signal *w, int revents attr_unused) { session_t *ps = session_ptr(w, int_signal); - log_info("compton is quitting..."); - quit_compton(ps); + log_info("picom is quitting..."); + quit(ps); } /** @@ -1708,7 +1709,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, if (!reply || (reply->major_version == 0 && reply->minor_version < 2)) { log_fatal("Your X server doesn't have Composite >= 0.2 support, " - "compton cannot run."); + "we cannot proceed."); exit(1); } free(reply); @@ -1766,6 +1767,11 @@ static session_t *session_init(int argc, char **argv, Display *dpy, } } + if (strstr(argv[0], "compton")) { + log_warn("This compositor has been renamed to \"picom\", the \"compton\" " + "binary will not be installed in the future."); + } + if (ps->o.debug_mode && !ps->o.experimental_backends) { log_fatal("Debug mode only works with the experimental backends."); return NULL; @@ -2322,7 +2328,7 @@ int main(int argc, char **argv) { XSetEventQueueOwner(dpy, XCBOwnsEventQueue); ps_g = session_init(argc, argv, dpy, config_file, all_xerrors, need_fork); if (!ps_g) { - log_fatal("Failed to create new compton session."); + log_fatal("Failed to create new session."); return 1; } if (need_fork) { diff --git a/src/compton.h b/src/picom.h similarity index 96% rename from src/compton.h rename to src/picom.h index 121a2f2e..7152d37e 100644 --- a/src/compton.h +++ b/src/picom.h @@ -28,8 +28,8 @@ enum root_flags { ROOT_FLAGS_SCREEN_CHANGE = 1 }; // == Functions == -// TODO move static inline functions that are only used in compton.c, into -// compton.c +// TODO move static inline functions that are only used in picom.c, into +// picom.c // inline functions must be made static to compile correctly under clang: // http://clang.llvm.org/compatibility.html#inline @@ -57,7 +57,7 @@ void discard_ignore(session_t *ps, unsigned long sequence); void set_root_flags(session_t *ps, uint64_t flags); -void quit_compton(session_t *ps); +void quit(session_t *ps); xcb_window_t session_get_target_window(session_t *); diff --git a/src/utils.h b/src/utils.h index e6feaace..1a6bc808 100644 --- a/src/utils.h +++ b/src/utils.h @@ -78,7 +78,7 @@ safe_isnan(double a) { // Some macros for checked cast // Note these macros are not complete, as in, they won't work for every integer types. But -// they are good enough for compton. +// they are good enough for our use cases. #define to_int_checked(val) \ ({ \ diff --git a/src/win.c b/src/win.c index 7f52cdee..e65c0a0b 100644 --- a/src/win.c +++ b/src/win.c @@ -20,7 +20,7 @@ #include "c2.h" #include "common.h" #include "compiler.h" -#include "compton.h" +#include "picom.h" #include "config.h" #include "list.h" #include "log.h" @@ -2053,7 +2053,7 @@ void map_win_start(session_t *ps, struct managed_win *w) { ps->c, w->base.id, XCB_CW_EVENT_MASK, (const uint32_t[]){determine_evmask(ps, w->base.id, WIN_EVMODE_FRAME)}); - // Notify compton when the shape of a window changes + // Get notification when the shape of a window changes if (ps->shape_exists) { xcb_shape_select_input(ps->c, w->base.id, 1); } @@ -2193,7 +2193,7 @@ struct managed_win *find_toplevel2(session_t *ps, xcb_window_t wid) { // Using find_win here because if we found a unmanaged window we know about, we // can stop early. while (wid && wid != ps->root && !(w = find_win(ps, wid))) { - // xcb_query_tree probably fails if you run compton when X is somehow + // xcb_query_tree probably fails if you run picom when X is somehow // initializing (like add it in .xinitrc). In this case // just leave it alone. auto reply = xcb_query_tree_reply(ps->c, xcb_query_tree(ps->c, wid), NULL); diff --git a/src/win.h b/src/win.h index 6a492ec8..90c2b68c 100644 --- a/src/win.h +++ b/src/win.h @@ -73,7 +73,7 @@ struct window_stack_entry { * considered part of the window. */ -/// Structure representing a top-level window compton manages. +/// Structure representing a top-level managed window. typedef struct win win; struct win { UT_hash_handle hh; diff --git a/src/x.c b/src/x.c index 2f802f1e..b22ba69f 100644 --- a/src/x.c +++ b/src/x.c @@ -111,7 +111,7 @@ bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop, char ** } // A cache of pict formats. We assume they don't change during the lifetime -// of compton +// of this program static thread_local xcb_render_query_pict_formats_reply_t *g_pictfmts = NULL; static inline void x_get_server_pictfmts(xcb_connection_t *c) { @@ -576,7 +576,7 @@ struct xvisual_info x_get_visual_info(xcb_connection_t *c, xcb_visualid_t visual return (struct xvisual_info){-1, -1, -1, -1, -1, 0}; } if (pictfmt->type != XCB_RENDER_PICT_TYPE_DIRECT) { - log_error("compton cannot handle non-DirectColor visuals. Report an " + log_error("We cannot handle non-DirectColor visuals. Report an " "issue if you see this error message."); return (struct xvisual_info){-1, -1, -1, -1, -1, 0}; } diff --git a/src/x.h b/src/x.h index 9d41a389..49cbff72 100644 --- a/src/x.h +++ b/src/x.h @@ -78,8 +78,8 @@ static inline uint32_t x_new_id(xcb_connection_t *c) { auto ret = xcb_generate_id(c); if (ret == (uint32_t)-1) { log_fatal("We seems to have run of XIDs. This is either a bug in the X " - "server, or a resource leakage in compton. Please open an " - "issue about this problem. compton will die."); + "server, or a resource leakage in the compositor. Please open an " + "issue about this problem. The compositor will die."); abort(); } return ret; diff --git a/tests/run_one_test.sh b/tests/run_one_test.sh index a03810b1..13da3df1 100755 --- a/tests/run_one_test.sh +++ b/tests/run_one_test.sh @@ -8,12 +8,12 @@ echo "Running test $2" # TODO keep the log file, and parse it to see if test is successful ($1 --experimental-backends --backend dummy --log-level=debug --log-file=$PWD/log --config=$2) & -compton_pid=$! +main_pid=$! $3 -kill -INT $compton_pid || true +kill -INT $main_pid || true cat log rm log -wait $compton_pid +wait $main_pid diff --git a/tests/run_tests.sh b/tests/run_tests.sh index ca8f4163..0becc68f 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -1,8 +1,8 @@ #!/bin/sh set -e -compton=$(realpath $1) +exe=$(realpath $1) cd $(dirname $0) -./run_one_test.sh $compton configs/empty.conf testcases/basic.py -./run_one_test.sh $compton configs/issue239.conf testcases/issue239.py -./run_one_test.sh $compton configs/issue239_2.conf testcases/issue239_2.py +./run_one_test.sh $exe configs/empty.conf testcases/basic.py +./run_one_test.sh $exe configs/issue239.conf testcases/issue239.py +./run_one_test.sh $exe configs/issue239_2.conf testcases/issue239_2.py From ed0e686f371f8528ae5cb878c13ee8eac64be752 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 23 Oct 2019 19:54:16 +0100 Subject: [PATCH 2/3] rename: update config file paths Signed-off-by: Yuxuan Shui --- src/config_libconfig.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config_libconfig.c b/src/config_libconfig.c index 0083ab5e..902ed91f 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -39,7 +39,8 @@ static inline int lcfg_lookup_bool(const config_t *config, const char *path, boo /// Search for config file under a base directory FILE *open_config_file_at(const char *base, char **out_path) { - static const char *config_paths[] = {"/compton.conf", "/compton/compton.conf"}; + static const char *config_paths[] = {"/picom.conf", "/picom/picom.conf", + "/compton.conf", "/compton/compton.conf"}; for (size_t i = 0; i < ARR_SIZE(config_paths); i++) { char *path = mstrjoin(base, config_paths[i]); FILE *ret = fopen(path, "r"); @@ -49,6 +50,12 @@ FILE *open_config_file_at(const char *base, char **out_path) { free(path); } if (ret) { + if (strstr(config_paths[i], "compton")) { + log_warn("This compositor has been renamed to \"picom\", " + "the old config file paths is deprecated. " + "Please replace the \"compton\"s in the path " + "with \"picom\""); + } return ret; } } From 902ad5ddf9b5ecb660dc9640d1b24c3b6d232752 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 23 Oct 2019 19:59:07 +0100 Subject: [PATCH 3/3] rename: documentation changes Update names in COPYING, LICENSE.spdx. Document information regarding the rename in README.md Signed-off-by: Yuxuan Shui --- COPYING | 4 ++-- LICENSE.spdx | 2 +- README.md | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/COPYING b/COPYING index 03496a75..f13a75ba 100644 --- a/COPYING +++ b/COPYING @@ -1,11 +1,11 @@ -compton - a compositor for X11 +picom - a compositor for X11 Based on xcompmgr, originally written by Keith Packard, with modifications from several contributors (according to the xcompmgr man page): Matthew Allum, Eric Anholt, Dan Doel, Thomas Luebking, Matthew Hawn, Ely Levy, Phil Blundell, and Carl Worth. Menu transparency was implemented by Dana Jansens. -Numerous contributions to compton from Richard Grenville. +Numerous contributions to picom from Richard Grenville. See the CONTRIBUTORS file for a complete list of contributors diff --git a/LICENSE.spdx b/LICENSE.spdx index f0aa2e9e..83aa2daf 100644 --- a/LICENSE.spdx +++ b/LICENSE.spdx @@ -1,4 +1,4 @@ SPDXVersion: SPDX-2.1 DataLicense: CC0-1.0 -PackageName: compton +PackageName: picom PackageLicenseDeclared: MPL-2.0 AND MIT diff --git a/README.md b/README.md index 030ca23a..3a0954be 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,36 @@ To test the new backends, add the `--experimental-backends` flag to the command To report issues with the new backends, please state explicitly you are using the new backends in your report. +## Rename + +### Rational + +Since the inception of this fork, the existence of two compton repositories has caused some number of confusions. Mainly, people will report issues of this fork to the original compton, or report issues of the original compton here. Later, when distros started packaging this fork of compton, some wanted to differentiate the newer compton from the older version. They found themselves having no choice but to invent a name for this fork. This is less than ideal since this has the potential to cause more confusions among users. + +Therefore, we decided to move this fork to a new name. Personally, I consider this more than justified since this version of compton has gone through significant changes since it was forked. + +### The name + +The criteria for a good name were + +0. Being short, so it's easy to remember. +1. Pronounceability, again, helps memorability +2. Searchability, so when people searches the name, it's easy for them to find this repository. + +Of course, choosing a name is never easy, and there is no apparent way to objectively evaluate the names. Yet, we have to solve aforementioned problems as soon as possible. + +In the end, we picked `picom` (a portmanteau of `pico` and `composite`) as our new name. This name might not be perfect, but is what we will move forward with unless there's a compelling reason not to. + +### Migration + +Following the [deprecation process](https://github.com/yshui/compton/issues/114), migration to the new name will be broken into 3 steps: + +1. All mentions to `compton` will be updated to `picom` in the code base. `compton` will still be installed, but only as a symlink to `picom`. When `picom` is launched via the symlink, a warning message is printed, alerting the user to migrate. Similarly, the old configuration file names and dbus interface names will still be accepted but warned. +2. 3 major releases after step 1, the warning messages will be prompted to error messages and `picom` will not start when launched via the symlink. +3. 3 major releases after step 2, the symlink will be removed. + +The dbus interface and service names are unchanged, so no migration needed for that. + ## Change Log See [Releases](https://github.com/yshui/compton/releases)