fix: send implicit_mod to process_bindings (#176)
* fix: send implicit_mod to process_bindings this solves the edge case where someone might have `ShiftMask + A` in their keybindings compared to a plain `A`. Closes: https://github.com/nsxiv/nsxiv/pull/166#issuecomment-978853136 * code-style: smuggle small style fix in win_draw_bar now mimics autoreload_nop.c functions
This commit is contained in:
parent
68ddbe28d8
commit
3bc7082f4e
|
@ -35,7 +35,7 @@ void arl_setup(arl_t *arl, const char *filepath)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool arl_handle(arl_t *arl)
|
bool arl_handle(arl_t *arl)
|
||||||
{
|
{
|
||||||
(void) arl;
|
(void) arl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
10
main.c
10
main.c
|
@ -605,15 +605,15 @@ end:
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool process_bindings(const keymap_t *keys, unsigned int len,
|
static bool process_bindings(const keymap_t *keys, unsigned int len, KeySym ksym_or_button,
|
||||||
KeySym ksym_or_button, unsigned int state)
|
unsigned int state, unsigned int implicit_mod)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (keys[i].ksym_or_button == ksym_or_button &&
|
if (keys[i].ksym_or_button == ksym_or_button &&
|
||||||
MODMASK(keys[i].mask) == MODMASK(state) &&
|
MODMASK(keys[i].mask | implicit_mod) == MODMASK(state) &&
|
||||||
keys[i].cmd.func &&
|
keys[i].cmd.func &&
|
||||||
(keys[i].cmd.mode == MODE_ALL || keys[i].cmd.mode == mode))
|
(keys[i].cmd.mode == MODE_ALL || keys[i].cmd.mode == mode))
|
||||||
{
|
{
|
||||||
|
@ -652,7 +652,7 @@ static void on_keypress(XKeyEvent *kev)
|
||||||
prefix = prefix * 10 + (int) (key - '0');
|
prefix = prefix * 10 + (int) (key - '0');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
dirty = process_bindings(keys, ARRLEN(keys), ksym, kev->state & ~sh);
|
dirty = process_bindings(keys, ARRLEN(keys), ksym, kev->state, sh);
|
||||||
}
|
}
|
||||||
if (dirty)
|
if (dirty)
|
||||||
redraw();
|
redraw();
|
||||||
|
@ -668,7 +668,7 @@ static void on_buttonpress(XButtonEvent *bev)
|
||||||
if (mode == MODE_IMAGE) {
|
if (mode == MODE_IMAGE) {
|
||||||
set_timeout(reset_cursor, TO_CURSOR_HIDE, true);
|
set_timeout(reset_cursor, TO_CURSOR_HIDE, true);
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
dirty = process_bindings(buttons, ARRLEN(buttons), bev->button, bev->state);
|
dirty = process_bindings(buttons, ARRLEN(buttons), bev->button, bev->state, 0);
|
||||||
if (dirty)
|
if (dirty)
|
||||||
redraw();
|
redraw();
|
||||||
} else {
|
} else {
|
||||||
|
|
5
window.c
5
window.c
|
@ -466,7 +466,10 @@ static void win_draw_bar(win_t *win)
|
||||||
XftDrawDestroy(d);
|
XftDrawDestroy(d);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void win_draw_bar(win_t *win){}
|
static void win_draw_bar(win_t *win)
|
||||||
|
{
|
||||||
|
(void) win;
|
||||||
|
}
|
||||||
#endif /* HAVE_LIBFONTS */
|
#endif /* HAVE_LIBFONTS */
|
||||||
|
|
||||||
void win_draw(win_t *win)
|
void win_draw(win_t *win)
|
||||||
|
|
Loading…
Reference in a new issue