Permalink
Browse files

Added it_toggle_bar command; default mapping: XK_b

  • Loading branch information...
1 parent 011dac9 commit c666d30eeacd6faf41dce50b301ad2fe3195fdb8 @muennich committed Feb 15, 2012
Showing with 30 additions and 0 deletions.
  1. +1 −0 README.md
  2. +10 −0 commands.c
  3. +1 −0 commands.h
  4. +1 −0 config.def.h
  5. +3 −0 sxiv.1
  6. +13 −0 window.c
  7. +1 −0 window.h
View
@@ -88,6 +88,7 @@ The following general key commands are available:
f Toggle fullscreen mode (requires an EWMH/NetWM compliant
window manager)
+ b Toggle visibility of info bar on bottom of window
A Toggle visibility of alpha-channel, i.e. transparency
r Reload image
View
@@ -76,6 +76,7 @@ bool it_switch_mode(arg_t a) {
bool it_toggle_fullscreen(arg_t a) {
win_toggle_fullscreen(&win);
+ /* redraw after next ConfigureNotify event */
set_timeout(redraw, TO_REDRAW_RESIZE, false);
if (mode == MODE_IMAGE)
img.checkpan = true;
@@ -84,6 +85,15 @@ bool it_toggle_fullscreen(arg_t a) {
return false;
}
+bool it_toggle_bar(arg_t a) {
+ win_toggle_bar(&win);
+ if (mode == MODE_IMAGE)
+ img.checkpan = img.dirty = true;
+ else
+ tns.dirty = true;
+ return true;
+}
+
bool it_reload_image(arg_t a) {
if (mode == MODE_IMAGE) {
load_image(fileidx);
View
@@ -44,6 +44,7 @@ typedef struct {
bool it_quit(arg_t);
bool it_switch_mode(arg_t);
bool it_toggle_fullscreen(arg_t);
+bool it_toggle_bar(arg_t);
bool it_reload_image(arg_t);
bool it_remove_image(arg_t);
bool i_navigate(arg_t);
View
@@ -60,6 +60,7 @@ static const keymap_t keys[] = {
{ false, XK_q, it_quit, (arg_t) None },
{ false, XK_Return, it_switch_mode, (arg_t) None },
{ false, XK_f, it_toggle_fullscreen, (arg_t) None },
+ { false, XK_b, it_toggle_bar, (arg_t) None },
{ false, XK_r, it_reload_image, (arg_t) None },
{ false, XK_D, it_remove_image, (arg_t) None },
View
3 sxiv.1
@@ -105,6 +105,9 @@ Go to the last image, or image number
.B f
Toggle fullscreen mode.
.TP
+.B b
+Toggle visibility of info bar on bottom of window.
+.TP
.B A
Toggle visibility of alpha-channel, i.e. image transparency.
.TP
View
@@ -306,6 +306,19 @@ void win_toggle_fullscreen(win_t *win) {
SubstructureNotifyMask | SubstructureRedirectMask, &ev);
}
+void win_toggle_bar(win_t *win) {
+ if (win == NULL || win->xwin == None)
+ return;
+
+ if (win->barh != 0) {
+ win->h += win->barh;
+ win->barh = 0;
+ } else {
+ win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD;
+ win->h -= win->barh;
+ }
+}
+
void win_clear(win_t *win) {
win_env_t *e;
View
@@ -69,6 +69,7 @@ bool win_configure(win_t*, XConfigureEvent*);
bool win_moveresize(win_t*, int, int, unsigned int, unsigned int);
void win_toggle_fullscreen(win_t*);
+void win_toggle_bar(win_t*);
void win_clear(win_t*);
void win_draw(win_t*);

0 comments on commit c666d30

Please sign in to comment.