Krolyxon
Commit 3672c0b

Branches

Refs →

nsxiv3672c0b

Toggle image transparency with A-key

Author
Bert
Date
2011-03-10 11:41 +0100
Parent
d982b06
Commit
3672c0bc636aa82f8fc38aa75f226915686d0bd3

+8 −2

4 files changed

  1. M Makefile +1 −1
  2. M image.c +2 −1
  3. M image.h +1 −0
  4. M main.c +4 −0
M Makefile View
@@ -1,6 +1,6 @@
11 all: sxiv
22
3−VERSION=git-20110309
3+VERSION=git-20110310
44
55 CC?=gcc
66 PREFIX?=/usr/local
M image.c View
@@ -43,6 +43,7 @@ void img_init(img_t *img, win_t *win) {
4343 img->zoom = MAX(img->zoom, zoom_min);
4444 img->zoom = MIN(img->zoom, zoom_max);
4545 img->aa = options->aa;
46+ img->alpha = 1;
4647 }
4748
4849 if (win) {
@@ -211,7 +212,7 @@ void img_render(img_t *img, win_t *win) {
211212 else
212213 imlib_context_set_image(im_broken);
213214
214− if (imlib_image_has_alpha())
215+ if (imlib_image_has_alpha() && !img->alpha)
215216 win_draw_rect(win, win->pm, dx, dy, dw, dh, True, 0, win->white);
216217
217218 imlib_context_set_drawable(win->pm);
M image.h View
@@ -45,6 +45,7 @@ typedef struct {
4545 unsigned char re;
4646 unsigned char checkpan;
4747 unsigned char aa;
48+ unsigned char alpha;
4849
4950 int x;
5051 int y;
M main.c View
@@ -496,6 +496,10 @@ void on_keypress(XKeyEvent *kev) {
496496 img_toggle_antialias(&img);
497497 changed = 1;
498498 break;
499+ case XK_A:
500+ img.alpha ^= 1;
501+ changed = 1;
502+ break;
499503 case XK_r:
500504 changed = load_image(fileidx);
501505 break;