Possible fix for issue #265. Check mask when accepting textbox input.

This commit is contained in:
Qball Cow 2015-11-12 15:42:00 +01:00
parent fa567e29ba
commit e6ca8acba9
2 changed files with 8 additions and 2 deletions

View file

@ -142,7 +142,7 @@ int abe_test_action ( KeyBindingAction action, unsigned int mask, KeySym key )
if ( kb->keysym == key ) {
// Bits 13 and 14 of the modifiers together are the group number, and
// should be ignored when looking up key bindings
if ( ( mask & ~( NumlockMask | ( 1 << 13 ) | ( 1 << 14 ) ) ) == kb->modmask ) {
if ( ( mask & ~( LockMask | NumlockMask | ( 1 << 13 ) | ( 1 << 14 ) ) ) == kb->modmask ) {
return TRUE;
}
}

View file

@ -42,6 +42,10 @@
#define SIDE_MARGIN 1
// Use this so we can ignore numlock mask.
// TODO: maybe use something smarter here..
extern unsigned int NumlockMask;
/**
* Font + font color cache.
* Avoid re-loading font on every change on every textbox.
@ -568,7 +572,9 @@ int textbox_keypress ( textbox *tb, XIC xic, XEvent *ev )
else if ( abe_test_action ( ACCEPT_ENTRY, ev->xkey.state, key ) ) {
return -1;
}
else if ( !iscntrl ( *pad ) ) {
// Filter When alt/ctrl/etc is pressed do not accept the character.
// Ignore others (numlock, shift,..).
else if ( !iscntrl ( *pad ) && 0 == ( ev->xkey.state & ~( NumlockMask | ( 1 << 12 ) | ( 1 << 13 ) | ShiftMask | LockMask ) ) ) {
textbox_insert ( tb, tb->cursor, pad );
textbox_cursor_inc ( tb );
return 1;