Added it_toggle_bar command; default mapping: XK_b

This commit is contained in:
Bert Münnich 2012-02-15 22:33:39 +01:00
parent 011dac90c8
commit c666d30eea
7 changed files with 30 additions and 0 deletions

View File

@ -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 File

@ -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 File

@ -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 File

@ -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 },

3
sxiv.1
View File

@ -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 File

@ -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 File

@ -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*);