Krolyxon
Commit c666d30

Branches

Refs →

nsxivc666d30

Added it_toggle_bar command; default mapping: XK_b

Author
Bert Münnich
Date
2012-02-15 22:33 +0100
Parent
011dac9
Commit
c666d30eeacd6faf41dce50b301ad2fe3195fdb8

+30 −0

7 files changed

  1. M README.md +1 −0
  2. M commands.c +10 −0
  3. M commands.h +1 −0
  4. M config.def.h +1 −0
  5. M sxiv.1 +3 −0
  6. M window.c +13 −0
  7. M window.h +1 −0
M README.md View
@@ -88,6 +88,7 @@ The following general key commands are available:
8888
8989 f Toggle fullscreen mode (requires an EWMH/NetWM compliant
9090 window manager)
91+ b Toggle visibility of info bar on bottom of window
9192 A Toggle visibility of alpha-channel, i.e. transparency
9293
9394 r Reload image
M commands.c View
@@ -76,6 +76,7 @@ bool it_switch_mode(arg_t a) {
7676
7777 bool it_toggle_fullscreen(arg_t a) {
7878 win_toggle_fullscreen(&win);
79+ /* redraw after next ConfigureNotify event */
7980 set_timeout(redraw, TO_REDRAW_RESIZE, false);
8081 if (mode == MODE_IMAGE)
8182 img.checkpan = true;
@@ -84,6 +85,15 @@ bool it_toggle_fullscreen(arg_t a) {
8485 return false;
8586 }
8687
88+bool it_toggle_bar(arg_t a) {
89+ win_toggle_bar(&win);
90+ if (mode == MODE_IMAGE)
91+ img.checkpan = img.dirty = true;
92+ else
93+ tns.dirty = true;
94+ return true;
95+}
96+
8797 bool it_reload_image(arg_t a) {
8898 if (mode == MODE_IMAGE) {
8999 load_image(fileidx);
M commands.h View
@@ -44,6 +44,7 @@ typedef struct {
4444 bool it_quit(arg_t);
4545 bool it_switch_mode(arg_t);
4646 bool it_toggle_fullscreen(arg_t);
47+bool it_toggle_bar(arg_t);
4748 bool it_reload_image(arg_t);
4849 bool it_remove_image(arg_t);
4950 bool i_navigate(arg_t);
M config.def.h View
@@ -60,6 +60,7 @@ static const keymap_t keys[] = {
6060 { false, XK_q, it_quit, (arg_t) None },
6161 { false, XK_Return, it_switch_mode, (arg_t) None },
6262 { false, XK_f, it_toggle_fullscreen, (arg_t) None },
63+ { false, XK_b, it_toggle_bar, (arg_t) None },
6364
6465 { false, XK_r, it_reload_image, (arg_t) None },
6566 { false, XK_D, it_remove_image, (arg_t) None },
M sxiv.1 View
@@ -105,6 +105,9 @@ Go to the last image, or image number
105105 .B f
106106 Toggle fullscreen mode.
107107 .TP
108+.B b
109+Toggle visibility of info bar on bottom of window.
110+.TP
108111 .B A
109112 Toggle visibility of alpha-channel, i.e. image transparency.
110113 .TP
M window.c View
@@ -306,6 +306,19 @@ void win_toggle_fullscreen(win_t *win) {
306306 SubstructureNotifyMask | SubstructureRedirectMask, &ev);
307307 }
308308
309+void win_toggle_bar(win_t *win) {
310+ if (win == NULL || win->xwin == None)
311+ return;
312+
313+ if (win->barh != 0) {
314+ win->h += win->barh;
315+ win->barh = 0;
316+ } else {
317+ win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD;
318+ win->h -= win->barh;
319+ }
320+}
321+
309322 void win_clear(win_t *win) {
310323 win_env_t *e;
311324
M window.h View
@@ -69,6 +69,7 @@ bool win_configure(win_t*, XConfigureEvent*);
6969 bool win_moveresize(win_t*, int, int, unsigned int, unsigned int);
7070
7171 void win_toggle_fullscreen(win_t*);
72+void win_toggle_bar(win_t*);
7273
7374 void win_clear(win_t*);
7475 void win_draw(win_t*);