Made i(t)_toggle_alpha command work in thumbnail mode too
This commit is contained in:
parent
d585b86354
commit
26eae8be96
2
Makefile
2
Makefile
@ -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) {
|
||||
int it_toggle_alpha(arg_t a) {
|
||||
img.alpha ^= 1;
|
||||
tns.alpha = img.alpha;
|
||||
if (mode == MODE_THUMB)
|
||||
tns.dirty = 1;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
2
config.h
2
config.h
@ -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" },
|
||||
|
5
thumbs.c
5
thumbs.c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user