mirror of
https://github.com/davatorium/rofi.git
synced 2025-03-03 16:05:20 -05:00
Issue #268, Filter out mode switch key.
This commit is contained in:
parent
922aa5f946
commit
5f7694fc62
2 changed files with 7 additions and 1 deletions
source
|
@ -45,6 +45,7 @@
|
||||||
// Use this so we can ignore numlock mask.
|
// Use this so we can ignore numlock mask.
|
||||||
// TODO: maybe use something smarter here..
|
// TODO: maybe use something smarter here..
|
||||||
extern unsigned int NumlockMask;
|
extern unsigned int NumlockMask;
|
||||||
|
extern unsigned int ModeSwitchMask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Font + font color cache.
|
* Font + font color cache.
|
||||||
|
@ -574,7 +575,7 @@ int textbox_keypress ( textbox *tb, XIC xic, XEvent *ev )
|
||||||
}
|
}
|
||||||
// Filter When alt/ctrl/etc is pressed do not accept the character.
|
// Filter When alt/ctrl/etc is pressed do not accept the character.
|
||||||
// Ignore others (numlock, shift,..).
|
// Ignore others (numlock, shift,..).
|
||||||
else if ( !iscntrl ( *pad ) && 0 == ( ev->xkey.state & ~( NumlockMask | ( 1 << 12 ) | ( 1 << 13 ) | ShiftMask | LockMask ) ) ) {
|
else if ( !iscntrl ( *pad ) && 0 == ( ev->xkey.state & ~( ModeSwitchMask | NumlockMask | ( 1 << 12 ) | ( 1 << 13 ) | ShiftMask | LockMask ) ) ) {
|
||||||
textbox_insert ( tb, tb->cursor, pad );
|
textbox_insert ( tb, tb->cursor, pad );
|
||||||
textbox_cursor_inc ( tb );
|
textbox_cursor_inc ( tb );
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -58,6 +58,7 @@ Atom netatoms[NUM_NETATOMS];
|
||||||
const char *netatom_names[] = { EWMH_ATOMS ( ATOM_CHAR ) };
|
const char *netatom_names[] = { EWMH_ATOMS ( ATOM_CHAR ) };
|
||||||
// Mask indicating num-lock.
|
// Mask indicating num-lock.
|
||||||
unsigned int NumlockMask = 0;
|
unsigned int NumlockMask = 0;
|
||||||
|
unsigned int ModeSwitchMask = 0;
|
||||||
|
|
||||||
extern Colormap map;
|
extern Colormap map;
|
||||||
|
|
||||||
|
@ -369,11 +370,15 @@ static void x11_figure_out_numlock_mask ( Display *display )
|
||||||
{
|
{
|
||||||
XModifierKeymap *modmap = XGetModifierMapping ( display );
|
XModifierKeymap *modmap = XGetModifierMapping ( display );
|
||||||
KeyCode kc = XKeysymToKeycode ( display, XK_Num_Lock );
|
KeyCode kc = XKeysymToKeycode ( display, XK_Num_Lock );
|
||||||
|
KeyCode kc_ms = XKeysymToKeycode ( display, XK_Mode_switch);
|
||||||
for ( int i = 0; i < 8; i++ ) {
|
for ( int i = 0; i < 8; i++ ) {
|
||||||
for ( int j = 0; j < ( int ) modmap->max_keypermod; j++ ) {
|
for ( int j = 0; j < ( int ) modmap->max_keypermod; j++ ) {
|
||||||
if ( modmap->modifiermap[i * modmap->max_keypermod + j] == kc ) {
|
if ( modmap->modifiermap[i * modmap->max_keypermod + j] == kc ) {
|
||||||
NumlockMask = ( 1 << i );
|
NumlockMask = ( 1 << i );
|
||||||
}
|
}
|
||||||
|
if ( modmap->modifiermap[i * modmap->max_keypermod + j] == kc_ms ) {
|
||||||
|
ModeSwitchMask = ( 1 << i );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XFreeModifiermap ( modmap );
|
XFreeModifiermap ( modmap );
|
||||||
|
|
Loading…
Add table
Reference in a new issue