From c769b81f93869cb0dd9b588af9c6eb7cdb1b7a0c Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Mon, 12 Dec 2005 17:11:28 +0100 Subject: [PATCH] send_event(): initialize @doc_view only when needed, and prevent a useless test for mouse event when event is of keyboard type. --- src/viewer/text/view.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index a32c3eab4..ca7c8d505 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -1185,22 +1185,23 @@ quit: void send_event(struct session *ses, struct term_event *ev) { - struct document_view *doc_view; - assert(ses && ev); if_assert_failed return; - doc_view = current_frame(ses); if (ev->ev == EVENT_KBD) { + struct document_view *doc_view = current_frame(ses); + ses = send_kbd_event(ses, doc_view, ev); } #ifdef CONFIG_MOUSE - if (ev->ev == EVENT_MOUSE) { + else if (ev->ev == EVENT_MOUSE) { + struct document_view *doc_view = current_frame(ses); + ses = send_mouse_event(ses, doc_view, ev); } #endif /* CONFIG_MOUSE */ - /* ses may disappear ie. in close_tab() */ + /* @ses may disappear ie. in close_tab() */ if (ses) ses->kbdprefix.repeat_count = 0; }