From 9c92de858484b6bbe90252955bef5f77a80f3c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Wed, 23 Jul 2014 23:41:23 +0200 Subject: Added support for multiple commands per key/button mapping; elegant fix for issue #150 --- main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 86b97b0..6db8a44 100644 --- a/main.c +++ b/main.c @@ -541,6 +541,7 @@ void on_keypress(XKeyEvent *kev) unsigned int sh; KeySym ksym, shksym; char key; + bool dirty = false; if (kev == NULL) return; @@ -571,16 +572,18 @@ void on_keypress(XKeyEvent *kev) (cmds[keys[i].cmd].mode < 0 || cmds[keys[i].cmd].mode == mode)) { if (cmds[keys[i].cmd].func(keys[i].arg)) - redraw(); - break; + dirty = true; } } + if (dirty) + redraw(); prefix = 0; } void on_buttonpress(XButtonEvent *bev) { int i, sel; + bool dirty = false; static Time firstclick; if (bev == NULL) @@ -597,10 +600,11 @@ void on_buttonpress(XButtonEvent *bev) (cmds[buttons[i].cmd].mode < 0 || cmds[buttons[i].cmd].mode == mode)) { if (cmds[buttons[i].cmd].func(buttons[i].arg)) - redraw(); - break; + dirty = true; } } + if (dirty) + redraw(); } else { /* thumbnail mode (hard-coded) */ switch (bev->button) { -- cgit v1.2.3