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>
This commit is contained in:
Yuxuan Shui
2019-10-23 19:27:30 +01:00
parent ed6a96dae9
commit 8ddbebb5d1
33 changed files with 172 additions and 139 deletions

View File

@@ -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 ============

View File

@@ -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);
}

View File

@@ -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();
}

View File

@@ -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"

View File

@@ -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;

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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) {

View File

@@ -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 *);

View File

@@ -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) \
({ \

View File

@@ -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);

View File

@@ -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;

View File

@@ -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};
}

View File

@@ -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;