diff options
author | Quentin Glidic <sardemff7+git@sardemff7.net> | 2016-02-19 22:43:53 +0100 |
---|---|---|
committer | Quentin Glidic <sardemff7+git@sardemff7.net> | 2016-02-21 16:04:53 +0100 |
commit | fe7ca2079d97172980f0bc725f532019fc9b7eb5 (patch) | |
tree | 785e76549cb4b3973cb330efd1fc937c3d0c0f68 /source/textbox.c | |
parent | 2eb63456db92aa2014167194ed9d3768e1cd0131 (diff) |
rofi: Convert to XCB events
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'source/textbox.c')
-rw-r--r-- | source/textbox.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/source/textbox.c b/source/textbox.c index 4a456a56..bb784eb8 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -24,6 +24,7 @@ */ #include <config.h> +#include <xcb/xcb.h> #include <X11/X.h> #include <X11/Xatom.h> #include <X11/Xlib.h> @@ -532,7 +533,7 @@ static void textbox_cursor_del_word ( textbox *tb ) // 0 = unhandled // 1 = handled // -1 = handled and return pressed (finished) -int textbox_keypress ( textbox *tb, XEvent *ev, char *pad, int pad_len, KeySym key, Status stat ) +int textbox_keypress ( textbox *tb, xcb_key_press_event_t *ev, char *pad, int pad_len, KeySym key, Status stat ) { if ( !( tb->flags & TB_EDITABLE ) ) { return 0; @@ -541,67 +542,67 @@ int textbox_keypress ( textbox *tb, XEvent *ev, char *pad, int pad_len, KeySym k tb->blink = 2; if ( stat == XLookupKeySym || stat == XLookupBoth ) { // Left or Ctrl-b - if ( abe_test_action ( MOVE_CHAR_BACK, ev->xkey.state, key ) ) { + if ( abe_test_action ( MOVE_CHAR_BACK, ev->state, key ) ) { textbox_cursor_dec ( tb ); return 2; } // Right or Ctrl-F - else if ( abe_test_action ( MOVE_CHAR_FORWARD, ev->xkey.state, key ) ) { + else if ( abe_test_action ( MOVE_CHAR_FORWARD, ev->state, key ) ) { textbox_cursor_inc ( tb ); return 2; } // Ctrl-U: Kill from the beginning to the end of the line. - else if ( abe_test_action ( CLEAR_LINE, ev->xkey.state, key ) ) { + else if ( abe_test_action ( CLEAR_LINE, ev->state, key ) ) { textbox_text ( tb, "" ); return 1; } // Ctrl-A - else if ( abe_test_action ( MOVE_FRONT, ev->xkey.state, key ) ) { + else if ( abe_test_action ( MOVE_FRONT, ev->state, key ) ) { textbox_cursor ( tb, 0 ); return 2; } // Ctrl-E - else if ( abe_test_action ( MOVE_END, ev->xkey.state, key ) ) { + else if ( abe_test_action ( MOVE_END, ev->state, key ) ) { textbox_cursor_end ( tb ); return 2; } // Ctrl-Alt-h - else if ( abe_test_action ( REMOVE_WORD_BACK, ev->xkey.state, key ) ) { + else if ( abe_test_action ( REMOVE_WORD_BACK, ev->state, key ) ) { textbox_cursor_bkspc_word ( tb ); return 1; } // Ctrl-Alt-d - else if ( abe_test_action ( REMOVE_WORD_FORWARD, ev->xkey.state, key ) ) { + else if ( abe_test_action ( REMOVE_WORD_FORWARD, ev->state, key ) ) { textbox_cursor_del_word ( tb ); return 1; } // Delete or Ctrl-D - else if ( abe_test_action ( REMOVE_CHAR_FORWARD, ev->xkey.state, key ) ) { + else if ( abe_test_action ( REMOVE_CHAR_FORWARD, ev->state, key ) ) { textbox_cursor_del ( tb ); return 1; } // Alt-B - else if ( abe_test_action ( MOVE_WORD_BACK, ev->xkey.state, key ) ) { + else if ( abe_test_action ( MOVE_WORD_BACK, ev->state, key ) ) { textbox_cursor_dec_word ( tb ); return 2; } // Alt-F - else if ( abe_test_action ( MOVE_WORD_FORWARD, ev->xkey.state, key ) ) { + else if ( abe_test_action ( MOVE_WORD_FORWARD, ev->state, key ) ) { textbox_cursor_inc_word ( tb ); return 2; } // BackSpace, Ctrl-h - else if ( abe_test_action ( REMOVE_CHAR_BACK, ev->xkey.state, key ) ) { + else if ( abe_test_action ( REMOVE_CHAR_BACK, ev->state, key ) ) { textbox_cursor_bkspc ( tb ); return 1; } - else if ( abe_test_action ( ACCEPT_CUSTOM, ev->xkey.state, key ) ) { + else if ( abe_test_action ( ACCEPT_CUSTOM, ev->state, key ) ) { return -2; } - else if ( abe_test_action ( ACCEPT_ENTRY_CONTINUE, ev->xkey.state, key ) ) { + else if ( abe_test_action ( ACCEPT_ENTRY_CONTINUE, ev->state, key ) ) { return -3; } - else if ( abe_test_action ( ACCEPT_ENTRY, ev->xkey.state, key ) ) { + else if ( abe_test_action ( ACCEPT_ENTRY, ev->state, key ) ) { return -1; } } |