1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-03 15:34:54 -05:00

Move more items to keybinding system.

This commit is contained in:
Dave Davenport 2015-05-01 08:16:52 +02:00
parent 073836f142
commit e8d6e8f829
3 changed files with 24 additions and 4 deletions

View file

@ -14,6 +14,9 @@ typedef enum _KeyBindingAction
REMOVE_WORD_FORWARD, REMOVE_WORD_FORWARD,
REMOVE_CHAR_FORWARD, REMOVE_CHAR_FORWARD,
REMOVE_CHAR_BACK, REMOVE_CHAR_BACK,
ACCEPT_ENTRY,
ACCEPT_CUSTOM,
ACCEPT_ENTRY_CONTINUE,
NUM_ABE NUM_ABE
} KeyBindingAction; } KeyBindingAction;

View file

@ -31,6 +31,12 @@ const char *KeyBindingActionName[NUM_ABE] =
"move-word-back", "move-word-back",
// MOVE_WORD_FORWARD // MOVE_WORD_FORWARD
"move-word-forward", "move-word-forward",
// ACCEPT_ENTRY
"accept-entry",
// ACCEPT_CUSTOM
"accept-custom",
// ACCEPT_ENTRY_CONTINUE
"accept-entry-continue",
}; };
char *KeyBindingActionDefault[NUM_ABE] = char *KeyBindingActionDefault[NUM_ABE] =
@ -57,6 +63,13 @@ char *KeyBindingActionDefault[NUM_ABE] =
"Alt+b", "Alt+b",
// MOVE_WORD_FORWARD // MOVE_WORD_FORWARD
"Alt+f", "Alt+f",
// ACCEPT_ENTRY
// TODO: split Shift return in separate state.
"Control+j,Control+m,Return",
// ACCEPT_CUSTOM
"Control+Return",
// ACCEPT_ENTRY_CONTINUE
"Shift+Return",
}; };
void setup_abe ( void ) void setup_abe ( void )

View file

@ -582,12 +582,16 @@ int textbox_keypress ( textbox *tb, XEvent *ev )
textbox_cursor_bkspc ( tb ); textbox_cursor_bkspc ( tb );
return 1; return 1;
} }
else if ( ( ev->xkey.state & ControlMask ) && ( key == XK_Return || key == XK_KP_Enter ) ) { else if ( ( ( ev->xkey.state & ControlMask ) && ( key == XK_Return )) ||
abe_test_action ( ACCEPT_CUSTOM, ev->xkey.state, key ) ) {
return -2; return -2;
} }
else if ( key == XK_Return || key == XK_KP_Enter || else if ( abe_test_action ( ACCEPT_ENTRY_CONTINUE, ev->xkey.state, key) ) {
( ( ev->xkey.state & ControlMask ) && key == XK_j ) || return -3;
( ( ev->xkey.state & ControlMask ) && key == XK_m ) ) { }
// TODO fix keypad.
else if ( key == XK_KP_Enter ||
abe_test_action ( ACCEPT_ENTRY, ev->xkey.state, key) ) {
return -1; return -1;
} }
else if ( !iscntrl ( *pad ) ) { else if ( !iscntrl ( *pad ) ) {