wio

a wayland wm stylised after plan9 rio - forked from git.sr.ht/~srcmpwn/wio
git clone git://src.gearsix.net/wio
Log | Files | Refs | Atom | Submodules | README | LICENSE

commit 8ecffded9bf606e80ce8b2ad3d2ed929aea4f374
parent 960ffdf57dbd67d563b56fce86bdbbd7c20f4326
Author: Leon Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
Date:   Sat, 15 Jun 2019 04:20:24 +0200

`Esc` stops current action / event

Diffstat:
Minput.c | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/input.c b/input.c @@ -23,6 +23,7 @@ static void keyboard_handle_modifiers( &keyboard->device->keyboard->modifiers); } +static void view_end_interactive(struct wio_server *server); static void keyboard_handle_key( struct wl_listener *listener, void *data) { struct wio_keyboard *keyboard = @@ -30,6 +31,25 @@ static void keyboard_handle_key( struct wio_server *server = keyboard->server; struct wlr_event_keyboard_key *event = data; struct wlr_seat *seat = server->seat; + xkb_keycode_t keycode = event->keycode + 8; + const xkb_keysym_t *syms; + int nsyms = xkb_state_key_get_syms( + keyboard->device->keyboard->xkb_state, + keycode, &syms); + + for (int i = 0; i < nsyms; i++) { + if (syms[i] == XKB_KEY_Escape) { + switch (server->input_state) { + case INPUT_STATE_NONE: + case INPUT_STATE_MENU: + break; + default: + view_end_interactive(server); + return; + } + } + } + wlr_seat_set_keyboard(seat, keyboard->device); wlr_seat_keyboard_notify_key(seat, event->time_msec, event->keycode, event->state);