summaryrefslogtreecommitdiff
path: root/src/keyevents.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-09-16 20:36:52 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-09-16 20:36:52 +0200
commit7eb9d73e908d3c10c06521bb211dc571cb3a8e35 (patch)
treeaaabbb7a659c62f1559bb1a1ea9f68a15ddf670b /src/keyevents.c
parenta6b5acb94f1d851c738f23a86020783d77173b4d (diff)
Add toggle_fixed_geometry ("g") keybinding to enable/disable window auto-resize
Closes #326
Diffstat (limited to 'src/keyevents.c')
-rw-r--r--src/keyevents.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/keyevents.c b/src/keyevents.c
index 14f1a14..d478a5a 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -196,6 +196,7 @@ void init_keyevents(void) {
feh_set_kb(&keys.reload_minus, 0, XK_minus, 0, 0, 0, 0);
feh_set_kb(&keys.reload_plus, 0, XK_plus, 0, 0, 0, 0);
feh_set_kb(&keys.toggle_keep_vp, 0, XK_k, 0, 0, 0, 0);
+ feh_set_kb(&keys.toggle_fixed_geometry, 0, XK_g, 0, 0, 0, 0);
home = getenv("HOME");
confhome = getenv("XDG_CONFIG_HOME");
@@ -504,6 +505,8 @@ fehkey *feh_str_to_kb(char *action)
return &keys.reload_plus;
else if (!strcmp(action, "toggle_keep_vp"))
return &keys.toggle_keep_vp;
+ else if (!strcmp(action, "toggle_fixed_geometry"))
+ return &keys.toggle_fixed_geometry;
return NULL;
}
@@ -871,5 +874,14 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy
else if (feh_is_kp(&keys.toggle_keep_vp, state, keysym, button)) {
opt.keep_zoom_vp = !opt.keep_zoom_vp;
}
+ else if (feh_is_kp(&keys.toggle_fixed_geometry, state, keysym, button)) {
+ if (opt.geom_flags & ((WidthValue | HeightValue))) {
+ opt.geom_flags &= ~(WidthValue | HeightValue);
+ } else {
+ opt.geom_flags |= (WidthValue | HeightValue);
+ opt.geom_w = winwid->w;
+ opt.geom_h = winwid->h;
+ }
+ }
return;
}