Skip to content

Commit

Permalink
Small typos and naming consistency
Browse files Browse the repository at this point in the history
Signed-off-by: Abe Wieland <[email protected]>
  • Loading branch information
abewieland authored and artemsen committed Jan 4, 2025
1 parent dfe2873 commit 739cb24
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/application.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ bool app_init(struct config* cfg, const char** sources, size_t num)
ui_toggle_fullscreen();
} else if (ctx.window.width == SIZE_FROM_IMAGE ||
ctx.window.width == SIZE_FROM_PARENT) {
// fixup window size form the first image
// determine window size from the first image
const struct pixmap* pm = &first_image->frames[0].pm;
ctx.window.width = pm->width;
ctx.window.height = pm->height;
Expand Down
2 changes: 1 addition & 1 deletion src/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "memdata.h"

// font realted
// font related
#include <fontconfig/fontconfig.h>
#include <ft2build.h>
#include FT_FREETYPE_H
Expand Down
57 changes: 29 additions & 28 deletions src/gallery.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
#include <stdlib.h>

// Configuration parameters
#define CFG_SECTION "gallery"
#define CFG_SIZE "size"
#define CFG_SIZE_DEF 200
#define CFG_CACHE "cache"
#define CFG_CACHE_DEF 100
#define CFG_FILL "fill"
#define CFG_FILL_DEF true
#define CFG_WINDOW "window"
#define CFG_WINDOW_DEF ARGB(0, 0, 0, 0)
#define CFG_BACKGR "background"
#define CFG_BACKGR_DEF ARGB(0xff, 0x20, 0x20, 0x20)
#define CFG_SELECT "select"
#define CFG_SELECT_DEF ARGB(0xff, 0x40, 0x40, 0x40)
#define CFG_BORDER "border"
#define CFG_BORDER_DEF ARGB(0xff, 0, 0, 0)
#define CFG_SHADOW "shadow"
#define CFG_SHADOW_DEF ARGB(0xff, 0, 0, 0)
#define CFG_AA "antialiasing"
#define CFG_AA_DEF false
#define CFG_SECTION "gallery"
#define CFG_SIZE "size"
#define CFG_SIZE_DEF 200
#define CFG_CACHE "cache"
#define CFG_CACHE_DEF 100
#define CFG_FILL "fill"
#define CFG_FILL_DEF true
#define CFG_ANTIALIASING "antialiasing"
#define CFG_ANTIALIASING_DEF false
#define CFG_WINDOW "window"
#define CFG_WINDOW_DEF ARGB(0, 0, 0, 0)
#define CFG_BACKGROUND "background"
#define CFG_BACKGROUND_DEF ARGB(0xff, 0x20, 0x20, 0x20)
#define CFG_SELECT "select"
#define CFG_SELECT_DEF ARGB(0xff, 0x40, 0x40, 0x40)
#define CFG_BORDER "border"
#define CFG_BORDER_DEF ARGB(0xff, 0, 0, 0)
#define CFG_SHADOW "shadow"
#define CFG_SHADOW_DEF ARGB(0xff, 0, 0, 0)

// Scale for selected thumbnail
#define THUMB_SELECTED_SCALE 1.15f
Expand All @@ -49,7 +49,7 @@ struct gallery {
size_t thumb_max; ///< Max number of thumbnails in cache
struct thumbnail* thumbs; ///< List of preview images
bool thumb_fill; ///< Scale mode (fill/fit)
bool thumb_aa; ///< Use anti-aliasing for thumbnail
bool antialiasing; ///< Use anti-aliasing for thumbnails

argb_t clr_window; ///< Window background
argb_t clr_background; ///< Tile background
Expand Down Expand Up @@ -77,7 +77,7 @@ static void add_thumbnail(struct image* image)
entry->width = image->frames[0].pm.width;
entry->height = image->frames[0].pm.height;
entry->image = image;
image_thumbnail(image, ctx.thumb_size, ctx.thumb_fill, ctx.thumb_aa);
image_thumbnail(image, ctx.thumb_size, ctx.thumb_fill, ctx.antialiasing);
ctx.thumbs = list_append(ctx.thumbs, entry);
}
}
Expand Down Expand Up @@ -169,7 +169,7 @@ static void reset_loader(void)
}
}

// remove the furthest thumnails from the cache
// remove the furthest thumbnails from the cache
if (ctx.thumb_max != 0 && total < ctx.thumb_max) {
const size_t half = (ctx.thumb_max - total) / 2;
const size_t min_id = image_list_jump(ctx.top, half, false);
Expand All @@ -185,7 +185,7 @@ static void reset_loader(void)
}
}

/** Update thumnails layout. */
/** Update thumbnail layout. */
static void update_layout(void)
{
size_t cols, rows;
Expand Down Expand Up @@ -395,7 +395,7 @@ static void draw_thumbnail(struct pixmap* window, ssize_t x, ssize_t y,
const ssize_t thumb_h = thumb->height * THUMB_SELECTED_SCALE;
const ssize_t tx = x + thumb_size / 2 - thumb_w / 2;
const ssize_t ty = y + thumb_size / 2 - thumb_h / 2;
pixmap_scale(ctx.thumb_aa ? pixmap_bicubic : pixmap_nearest, thumb,
pixmap_scale(ctx.antialiasing ? pixmap_bicubic : pixmap_nearest, thumb,
window, tx, ty, THUMB_SELECTED_SCALE, image->alpha);
}

Expand Down Expand Up @@ -442,7 +442,7 @@ static void draw_thumbnails(struct pixmap* window)
ssize_t select_y = 0;
const struct thumbnail* select_th = NULL;

// thumbnails layout
// thumbnail layout
get_layout(&cols, &rows, &gap);
++rows;

Expand Down Expand Up @@ -509,7 +509,7 @@ static void apply_action(const struct action* action)
{
switch (action->type) {
case action_antialiasing:
ctx.thumb_aa = !ctx.thumb_aa;
ctx.antialiasing = !ctx.antialiasing;
clear_thumbnails();
reset_loader();
app_redraw();
Expand Down Expand Up @@ -581,11 +581,12 @@ void gallery_init(struct config* cfg, struct image* image)
ctx.thumb_max =
config_get_num(cfg, CFG_SECTION, CFG_CACHE, 0, 1024, CFG_CACHE_DEF);
ctx.thumb_fill = config_get_bool(cfg, CFG_SECTION, CFG_FILL, CFG_FILL_DEF);
ctx.thumb_aa = config_get_bool(cfg, CFG_SECTION, CFG_AA, CFG_AA_DEF);
ctx.antialiasing = config_get_bool(cfg, CFG_SECTION, CFG_ANTIALIASING,
CFG_ANTIALIASING_DEF);
ctx.clr_window =
config_get_color(cfg, CFG_SECTION, CFG_WINDOW, CFG_WINDOW_DEF);
ctx.clr_background =
config_get_color(cfg, CFG_SECTION, CFG_BACKGR, CFG_BACKGR_DEF);
config_get_color(cfg, CFG_SECTION, CFG_BACKGROUND, CFG_BACKGROUND_DEF);
ctx.clr_select =
config_get_color(cfg, CFG_SECTION, CFG_SELECT, CFG_SELECT_DEF);
ctx.clr_border =
Expand Down
2 changes: 1 addition & 1 deletion src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static void import_exif(const struct image* image)
struct keyval* line;
const size_t buf_size = image->num_info * sizeof(*line);

// free previuos lines
// free previous lines
for (size_t i = 0; i < ctx.exif_num; ++i) {
free(ctx.exif_lines[i].key.data);
free(ctx.exif_lines[i].value.data);
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static int parse_cmdargs(int argc, char* argv[], struct config** cfg)
case 'c':
if (!config_set_arg(cfg, optarg)) {
fprintf(stderr,
"WARNING: Invalid config agrument: \"%s\"\n",
"WARNING: Invalid config argument: \"%s\"\n",
optarg);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/memdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ char* str_append(const char* src, size_t len, char** dst);
bool str_to_num(const char* text, size_t len, ssize_t* value, int base);

/**
* Convert ansi string to wide char format.
* Convert ASCII string to wide char format.
* @param src source string to encode
* @param dst pointer to destination buffer
* @return pointer to wide string, caller must free it
Expand Down

0 comments on commit 739cb24

Please sign in to comment.