fix a bunch of typos in comments

This commit is contained in:
Maxim Solovyov 2024-01-31 06:09:28 +03:00
parent c1b4ede06e
commit 90f5f4ca29
No known key found for this signature in database
21 changed files with 48 additions and 52 deletions

View File

@ -204,7 +204,7 @@ struct backend_operations {
* @param backend_data backend data
* @param pixmap X pixmap to bind
* @param fmt information of the pixmap's visual
* @param owned whether the ownership of the pixmap is transfered to the backend
* @param owned whether the ownership of the pixmap is transferred to the backend
* @return backend internal data structure bound with this pixmap
*/
void *(*bind_pixmap)(backend_t *backend_data, xcb_pixmap_t pixmap,
@ -220,7 +220,7 @@ struct backend_operations {
struct backend_shadow_context *ctx);
/// Create a shadow image based on the parameters. Resulting image should have a
/// size of `width + radisu * 2` x `height + radius * 2`. Radius is set when the
/// size of `width + radius * 2` x `height + radius * 2`. Radius is set when the
/// shadow context is created.
/// Default implementation: default_render_shadow
///
@ -279,9 +279,9 @@ struct backend_operations {
bool (*is_image_transparent)(backend_t *backend_data, void *image_data)
attr_nonnull(1, 2);
/// Get the age of the buffer content we are currently rendering ontop
/// Get the age of the buffer content we are currently rendering on top
/// of. The buffer that has just been `present`ed has a buffer age of 1.
/// Everytime `present` is called, buffers get older. Return -1 if the
/// Every time `present` is called, buffers get older. Return -1 if the
/// buffer is empty.
///
/// Optional
@ -290,7 +290,7 @@ struct backend_operations {
/// Get the render time of the last frame. If the render is still in progress,
/// returns false. The time is returned in `ts`. Frames are delimited by the
/// present() calls. i.e. after a present() call, last_render_time() should start
/// reporting the time of the just presen1ted frame.
/// reporting the time of the just presented frame.
///
/// Optional, if not available, the most conservative estimation will be used.
bool (*last_render_time)(backend_t *backend_data, struct timespec *ts);

View File

@ -185,7 +185,7 @@ void gl_destroy_window_shader(backend_t *backend_data attr_unused, void *shader)
* @note In order to reduce number of textures which needs to be
* allocated and deleted during this recursive render
* we reuse the same two textures for render source and
* destination simply by alterating between them.
* destination simply by alternating between them.
* Unfortunately on first iteration source_texture might
* be read-only. In this case we will select auxiliary_texture as
* destination_texture in order not to touch that read-only source
@ -253,7 +253,7 @@ _gl_average_texture_color(backend_t *base, GLuint source_texture, GLuint destina
/*
* @brief Builds a 1x1 texture which has color corresponding to the average of all
* pixels of img by recursively rendering into texture of quorter the size (half
* pixels of img by recursively rendering into texture of quarter the size (half
* width and half height).
* Returned texture must not be deleted, since it's owned by the gl_image. It will be
* deleted when the gl_image is released.

View File

@ -78,7 +78,7 @@ typedef struct {
GLint color_loc;
} gl_fill_shader_t;
/// @brief Wrapper of a binded GL texture.
/// @brief Wrapper of a bound GL texture.
struct gl_texture {
int refcount;
bool has_alpha;

View File

@ -240,8 +240,8 @@ typedef struct session {
/// Either the backend is currently rendering a frame, or a frame has been
/// rendered but has yet to be presented. In either case, we should not start
/// another render right now. As if we start issuing rendering commands now, we
/// will have to wait for either the the current render to finish, or the current
/// back buffer to be become available again. In either case, we will be wasting
/// will have to wait for either the current render to finish, or the current
/// back buffer to become available again. In either case, we will be wasting
/// time.
bool backend_busy;
/// Whether a render is queued. This generally means there are pending updates
@ -268,7 +268,7 @@ typedef struct session {
struct x_convolution_kernel **blur_kerns_cache;
/// If we should quit
bool quit : 1;
// TODO(yshui) use separate flags for dfferent kinds of updates so we don't
// TODO(yshui) use separate flags for different kinds of updates so we don't
// waste our time.
/// Whether there are pending updates, like window creation, etc.
bool pending_updates : 1;

View File

@ -52,7 +52,7 @@
#else
# define attr_warn_unused_result
#endif
// An alias for conveninence
// An alias for convenience
#define must_use attr_warn_unused_result
#if __has_attribute(nonnull)

View File

@ -563,7 +563,7 @@ static char *locate_auxiliary_file_at(const char *base, const char *scope, const
}
/**
* Get a path of an auxiliary file to read, could be a shader file, or any supplimenrary
* Get a path of an auxiliary file to read, could be a shader file, or any supplementary
* file.
*
* Follows the XDG specification to search for the shader file in configuration locations.

View File

@ -311,7 +311,7 @@ char **xdg_config_dirs(void);
/// Parse a configuration file
/// Returns the actually config_file name used, allocated on heap
/// Outputs:
/// shadow_enable = whether shaodw is enabled globally
/// shadow_enable = whether shadow is enabled globally
/// fading_enable = whether fading is enabled globally
/// win_option_mask = whether option overrides for specific window type is set for given
/// options

View File

@ -29,7 +29,7 @@
/// made the query when those events were already in the queue. so the reply you got is
/// more up-to-date than the events). Also, handling events when other client are making
/// concurrent requests is not good. Because the server states are changing without you
/// knowning them. This is super racy, and can cause lots of potential problems.
/// knowing them. This is super racy, and can cause lots of potential problems.
///
/// All of above mandates we do these things:
/// 1. Grab server when handling events
@ -324,7 +324,7 @@ static inline void ev_reparent_notify(session_t *ps, xcb_reparent_notify_event_t
}
if (ev->parent == ps->c.screen_info->root) {
// X will generate reparent notifiy even if the parent didn't actually
// X will generate reparent notify even if the parent didn't actually
// change (i.e. reparent again to current parent). So we check if that's
// the case
auto w = find_win(ps, ev->window);
@ -465,7 +465,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
}
}
// Unconcerned about any other proprties on root window
// Unconcerned about any other properties on root window
return;
}
@ -499,7 +499,7 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
}
if (ev->atom == ps->atoms->a_NET_WM_BYPASS_COMPOSITOR) {
// Unnecessay until we remove the queue_redraw in ev_handle
// Unnecessary until we remove the queue_redraw in ev_handle
queue_redraw(ps);
}

View File

@ -158,7 +158,7 @@ bool file_watch_add(void *_fwr, const char *filename, file_watch_cb_t cb, void *
fflags |= NOTE_CLOSE_WRITE;
#else
// NOTE_WRITE will receive notification more frequent than necessary, so is less
// preferrable
// preferable
fflags |= NOTE_WRITE;
#endif
struct kevent ev = {

View File

@ -96,7 +96,7 @@ static inline double estimate_first_row_sum(double size, double r) {
// `a` is gaussian at (size, 0)
double a = exp(-0.5 * size * size / (r * r)) / sqrt(2 * M_PI) / r;
// The sum of the whole kernel is normalized to 1, i.e. each element is divided by
// factor sqaured. So the sum of the first row is a * factor / factor^2 = a /
// factor squared. So the sum of the first row is a * factor / factor^2 = a /
// factor
return a / factor;
}

View File

@ -1129,7 +1129,7 @@ glx_blur_dst_end:
// TODO(bhagwan) this is a mess and needs a more consistent way of getting the border
// pixel I tried looking for a notify event for XCB_CW_BORDER_PIXEL (in
// xcb_create_window()) or a way to get the pixels from xcb_render_picture_t but the
// documentation for the xcb_xrender extension is literaly non existent...
// documentation for the xcb_xrender extension is literally non existent...
//
// NOTE(yshui) There is no consistent way to get the "border" color of a X window. From
// the WM's perspective there are multiple ways to implement window borders. Using

View File

@ -75,7 +75,7 @@ typedef struct glx_session {
glx_round_pass_t *round_passes;
} glx_session_t;
/// @brief Wrapper of a binded GLX texture.
/// @brief Wrapper of a bound GLX texture.
typedef struct _glx_texture {
GLuint texture;
GLXPixmap glpixmap;
@ -121,9 +121,9 @@ bool glx_bind_texture(session_t *ps, glx_texture_t **pptex, int x, int y, int wi
void glx_paint_pre(session_t *ps, region_t *preg) attr_nonnull(1, 2);
/**
* Check if a texture is binded, or is binded to the given pixmap.
* Check if a texture is bound, or is bound to the given pixmap.
*/
static inline bool glx_tex_binded(const glx_texture_t *ptex, xcb_pixmap_t pixmap) {
static inline bool glx_tex_bound(const glx_texture_t *ptex, xcb_pixmap_t pixmap) {
return ptex && ptex->glpixmap && ptex->texture && (!pixmap || pixmap == ptex->pixmap);
}

View File

@ -316,9 +316,9 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
int o = 0, longopt_idx = -1;
// Pre-parse the commandline arguments to check for --config and invalid
// Pre-parse the command line arguments to check for --config and invalid
// switches
// Must reset optind to 0 here in case we reread the commandline
// Must reset optind to 0 here in case we reread the command line
// arguments
optind = 1;
*config_file = NULL;
@ -370,7 +370,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
// instead of commas in atof().
setlocale(LC_NUMERIC, "C");
// Parse commandline arguments. Range checking will be done later.
// Parse command line arguments. Range checking will be done later.
bool failed = false;
const char *deprecation_message attr_unused =
@ -722,7 +722,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
opt->blur_strength = atoi(optarg);
break;
case 333:
// --cornor-radius
// --corner-radius
opt->corner_radius = atoi(optarg);
break;
case 334:

View File

@ -270,7 +270,7 @@ enum vblank_callback_action reschedule_render_at_vblank(struct vblank_event *e,
/// is no render currently scheduled. i.e. render_queued == false.
/// 2. then, we need to figure out the best time to start rendering. we need to
/// at least know when the next vblank will start, as we can't start render
/// before the current rendered frame is diplayed on screen. we have this
/// before the current rendered frame is displayed on screen. we have this
/// information from the vblank scheduler, it will notify us when that happens.
/// we might also want to delay the rendering even further to reduce latency,
/// this is discussed below, in FUTURE WORKS.
@ -1869,7 +1869,7 @@ 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 the compostior resetting itself after next paint.
* This will result in the compositor resetting itself after next paint.
*/
static void reset_enable(EV_P_ ev_signal *w attr_unused, int revents attr_unused) {
log_info("picom is resetting...");
@ -1946,11 +1946,11 @@ static bool load_shader_source_for_condition(const c2_lptr_t *cond, void *data)
/**
* Initialize a session.
*
* @param argc number of commandline arguments
* @param argv commandline arguments
* @param argc number of command line arguments
* @param argv command line arguments
* @param dpy the X Display
* @param config_file the path to the config file
* @param all_xerros whether we should report all X errors
* @param all_xerrors whether we should report all X errors
* @param fork whether we will fork after initialization
*/
static session_t *session_init(int argc, char **argv, Display *dpy,
@ -2496,7 +2496,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
ps->server_grabbed = true;
// We are going to pull latest information from X server now, events sent by X
// earlier is irrelavant at this point.
// earlier is irrelevant at this point.
// A better solution is probably grabbing the server from the very start. But I
// think there still could be race condition that mandates discarding the events.
x_discard_events(&ps->c);

View File

@ -89,7 +89,7 @@ static inline bool paint_bind_tex(session_t *ps, paint_t *ppaint, int wid, int h
fbcfg = ppaint->fbcfg;
}
if (force || !glx_tex_binded(ppaint->ptex, ppaint->pixmap)) {
if (force || !glx_tex_bound(ppaint->ptex, ppaint->pixmap)) {
return glx_bind_pixmap(ps, &ppaint->ptex, ppaint->pixmap, wid, hei,
repeat, fbcfg);
}
@ -378,7 +378,7 @@ static inline bool paint_isvalid(session_t *ps, const paint_t *ppaint) {
}
#ifdef CONFIG_OPENGL
if (BKEND_GLX == ps->o.backend && !glx_tex_binded(ppaint->ptex, XCB_NONE)) {
if (BKEND_GLX == ps->o.backend && !glx_tex_bound(ppaint->ptex, XCB_NONE)) {
return false;
}
#endif

View File

@ -51,10 +51,6 @@ void render_statistics_add_render_time_sample(struct render_statistics *rs, int
}
/// How much time budget we should give to the backend for rendering, in microseconds.
///
/// A `divisor` is also returned, indicating the target framerate. The divisor is
/// the number of vblanks we should wait between each frame. A divisor of 1 means
/// full framerate, 2 means half framerate, etc.
unsigned int render_statistics_get_budget(struct render_statistics *rs) {
if (rs->render_times.nelem < rs->render_times.window_size) {
// No valid render time estimates yet. Assume maximum budget.

View File

@ -141,10 +141,10 @@ void rolling_max_pop_front(struct rolling_max *rm, int front) {
}
void rolling_max_push_back(struct rolling_max *rm, int val) {
// Update the prority queue.
// Update the priority queue.
// Remove all elements smaller than the new element from the queue. Because
// the new element will become the maximum element before them, and since they
// come b1efore the new element, they will have been popped before the new
// come before the new element, they will have been popped before the new
// element, so they will never become the maximum element.
while (rm->np) {
int p_tail = IDX(rm->p_head + rm->np - 1);

View File

@ -222,7 +222,7 @@ allocchk_(const char *func_name, const char *file, unsigned int line, void *ptr)
((type *)allocchk(calloc((size_t)tmp, sizeof(type)))); \
})
/// @brief Wrapper of ealloc().
/// @brief Wrapper of realloc().
#define crealloc(ptr, nmemb) \
({ \
auto tmp = (nmemb); \

View File

@ -954,7 +954,7 @@ static void win_set_shadow(session_t *ps, struct managed_win *w, bool shadow_new
// Delayed update of shadow image
// By setting WIN_FLAGS_SHADOW_STALE, we ask win_process_flags to
// re-create or release the shaodw in based on whether w->shadow
// re-create or release the shadow in based on whether w->shadow
// is set.
win_set_flags(w, WIN_FLAGS_SHADOW_STALE);
@ -1985,7 +1985,7 @@ void win_update_bounding_shape(session_t *ps, struct managed_win *w) {
// Add border width because we are using a different origin.
// X thinks the top left of the inner window is the origin
// (for the bounding shape, althought xcb_get_geometry thinks
// (for the bounding shape, although xcb_get_geometry thinks
// the outer top left (outer means outside of the window
// border) is the origin),
// We think the top left of the border is the origin
@ -2314,7 +2314,7 @@ bool destroy_win_start(session_t *ps, struct win *w) {
HASH_DEL(ps->windows, w);
if (!w->managed || mw->state == WSTATE_UNMAPPED) {
// Window is already unmapped, or is an unmanged window, just
// Window is already unmapped, or is an unmanaged window, just
// destroy it
destroy_win_finish(ps, w);
return true;
@ -2717,7 +2717,7 @@ static inline bool rect_is_fullscreen(const session_t *ps, int x, int y, int wid
}
/**
* Check if a window is fulscreen using EWMH
* Check if a window is full-screen using EWMH
*
* TODO(yshui) cache this property
*/

View File

@ -244,13 +244,13 @@ struct managed_win {
switch_t shadow_force;
/// Opacity of the shadow. Affected by window opacity and frame opacity.
double shadow_opacity;
/// X offset of shadow. Affected by commandline argument.
/// X offset of shadow. Affected by command line argument.
int shadow_dx;
/// Y offset of shadow. Affected by commandline argument.
/// Y offset of shadow. Affected by command line argument.
int shadow_dy;
/// Width of shadow. Affected by window size and commandline argument.
/// Width of shadow. Affected by window size and command line argument.
int shadow_width;
/// Height of shadow. Affected by window size and commandline argument.
/// Height of shadow. Affected by window size and command line argument.
int shadow_height;
/// Picture to render shadow. Affected by window size.
paint_t shadow_paint;

View File

@ -68,7 +68,7 @@ typedef enum {
} winstate_t;
enum win_flags {
// Note: *_NONE flags are mostly redudant and meant for detecting logical errors
// Note: *_NONE flags are mostly redundant and meant for detecting logical errors
// in the code
/// pixmap is out of date, will be update in win_process_flags