Added support for multiple commands per key/button mapping; elegant fix for issue #150

This commit is contained in:
Bert Münnich
2014-07-23 23:41:23 +02:00
parent 06164c29b7
commit 9c92de8584
4 changed files with 22 additions and 22 deletions

12
main.c
View File

@ -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) {