diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | commands.c | 13 | ||||
-rw-r--r-- | commands.h | 2 | ||||
-rw-r--r-- | config.h | 2 | ||||
-rw-r--r-- | thumbs.c | 5 | ||||
-rw-r--r-- | thumbs.h | 1 |
6 files changed, 15 insertions, 10 deletions
@@ -1,6 +1,6 @@ all: sxiv -VERSION = git-20110903 +VERSION = git-20110904 CC = gcc DESTDIR = @@ -327,13 +327,12 @@ int i_toggle_antialias(arg_t a) { } } -int i_toggle_alpha(arg_t a) { - if (mode == MODE_IMAGE) { - img.alpha ^= 1; - return 1; - } else { - return 0; - } +int it_toggle_alpha(arg_t a) { + img.alpha ^= 1; + tns.alpha = img.alpha; + if (mode == MODE_THUMB) + tns.dirty = 1; + return 1; } int it_open_with(arg_t a) { @@ -58,7 +58,7 @@ int i_fit_to_win(arg_t); int i_fit_to_img(arg_t); int i_rotate(arg_t); int i_toggle_antialias(arg_t); -int i_toggle_alpha(arg_t); +int it_toggle_alpha(arg_t); int it_open_with(arg_t); int it_shell_cmd(arg_t); @@ -105,7 +105,7 @@ static const keymap_t keys[] = { { False, XK_greater, i_rotate, (arg_t) DIR_RIGHT }, { False, XK_a, i_toggle_antialias, (arg_t) None }, - { False, XK_A, i_toggle_alpha, (arg_t) None }, + { False, XK_A, it_toggle_alpha, (arg_t) None }, /* open current image with given program: */ { True, XK_g, it_open_with, (arg_t) "gimp" }, @@ -176,6 +176,7 @@ void tns_init(tns_t *tns, int cnt) { tns->cnt = tns->first = tns->sel = 0; tns->cap = cnt; + tns->alpha = 1; tns->dirty = 0; if ((homedir = getenv("HOME"))) { @@ -335,6 +336,10 @@ void tns_render(tns_t *tns, win_t *win) { t->x = x + (THUMB_SIZE - t->w) / 2; t->y = y + (THUMB_SIZE - t->h) / 2; imlib_context_set_image(t->im); + + if (imlib_image_has_alpha() && !tns->alpha) + win_draw_rect(win, win->pm, t->x, t->y, t->w, t->h, True, 0, win->white); + imlib_render_image_part_on_drawable_at_size(0, 0, t->w, t->h, t->x, t->y, t->w, t->h); if ((i + 1) % tns->cols == 0) { @@ -44,6 +44,7 @@ typedef struct { int rows; int first; int sel; + unsigned char alpha; unsigned char dirty; } tns_t; |