Browse Source

Made i(t)_toggle_alpha command work in thumbnail mode too

master
Bert 14 years ago
parent
commit
26eae8be96
6 changed files with 15 additions and 10 deletions
  1. +1
    -1
      Makefile
  2. +6
    -7
      commands.c
  3. +1
    -1
      commands.h
  4. +1
    -1
      config.h
  5. +5
    -0
      thumbs.c
  6. +1
    -0
      thumbs.h

+ 1
- 1
Makefile View File

@@ -1,6 +1,6 @@
all: sxiv all: sxiv


VERSION = git-20110903 VERSION = git-20110904


CC = gcc CC = gcc
DESTDIR = DESTDIR =


+ 6
- 7
commands.c View File

@@ -327,13 +327,12 @@ int i_toggle_antialias(arg_t a) {
} }
} }


int i_toggle_alpha(arg_t a) { int it_toggle_alpha(arg_t a) {
if (mode == MODE_IMAGE) { img.alpha ^= 1;
img.alpha ^= 1; tns.alpha = img.alpha;
return 1; if (mode == MODE_THUMB)
} else { tns.dirty = 1;
return 0; return 1;
}
} }


int it_open_with(arg_t a) { int it_open_with(arg_t a) {


+ 1
- 1
commands.h View File

@@ -58,7 +58,7 @@ int i_fit_to_win(arg_t);
int i_fit_to_img(arg_t); int i_fit_to_img(arg_t);
int i_rotate(arg_t); int i_rotate(arg_t);
int i_toggle_antialias(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_open_with(arg_t);
int it_shell_cmd(arg_t); int it_shell_cmd(arg_t);




+ 1
- 1
config.h View File

@@ -105,7 +105,7 @@ static const keymap_t keys[] = {
{ False, XK_greater, i_rotate, (arg_t) DIR_RIGHT }, { False, XK_greater, i_rotate, (arg_t) DIR_RIGHT },


{ False, XK_a, i_toggle_antialias, (arg_t) None }, { 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: */ /* open current image with given program: */
{ True, XK_g, it_open_with, (arg_t) "gimp" }, { True, XK_g, it_open_with, (arg_t) "gimp" },


+ 5
- 0
thumbs.c View File

@@ -176,6 +176,7 @@ void tns_init(tns_t *tns, int cnt) {


tns->cnt = tns->first = tns->sel = 0; tns->cnt = tns->first = tns->sel = 0;
tns->cap = cnt; tns->cap = cnt;
tns->alpha = 1;
tns->dirty = 0; tns->dirty = 0;


if ((homedir = getenv("HOME"))) { 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->x = x + (THUMB_SIZE - t->w) / 2;
t->y = y + (THUMB_SIZE - t->h) / 2; t->y = y + (THUMB_SIZE - t->h) / 2;
imlib_context_set_image(t->im); 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, imlib_render_image_part_on_drawable_at_size(0, 0, t->w, t->h,
t->x, t->y, t->w, t->h); t->x, t->y, t->w, t->h);
if ((i + 1) % tns->cols == 0) { if ((i + 1) % tns->cols == 0) {


+ 1
- 0
thumbs.h View File

@@ -44,6 +44,7 @@ typedef struct {
int rows; int rows;
int first; int first;
int sel; int sel;
unsigned char alpha;
unsigned char dirty; unsigned char dirty;
} tns_t; } tns_t;




||||||
x
 
000:0
Loading…
Cancel
Save