From 0fda08693f89e9bceda414154be9f4cb667b5e29 Mon Sep 17 00:00:00 2001 From: Stephane Fontaine Date: Sat, 23 Feb 2019 13:48:43 +0400 Subject: [PATCH] Return early in process key event --- src/xwindows/keyboard.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/xwindows/keyboard.rs b/src/xwindows/keyboard.rs index 0bff54fd7..6e901f0a0 100644 --- a/src/xwindows/keyboard.rs +++ b/src/xwindows/keyboard.rs @@ -102,15 +102,16 @@ impl Keyboard { &self, xcb_ev: &xcb::KeyPressEvent, ) -> Option<(KeyCode, KeyModifiers)> { - let xcode = xcb_ev.detail() as xkb::Keycode; - let xsym = self.state.borrow().key_get_one_sym(xcode); let pressed = (xcb_ev.response_type() & !0x80) == xcb::KEY_PRESS; - if pressed { - self.compose_state.borrow_mut().feed(xsym); - } else { + + if ! pressed { return None; } + let xcode = xcb_ev.detail() as xkb::Keycode; + let xsym = self.state.borrow().key_get_one_sym(xcode); + self.compose_state.borrow_mut().feed(xsym); + let cstate = self.compose_state.borrow().status().clone(); let ksym = match cstate { ComposeStatus::Composing => {