1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

send_event(): initialize @doc_view only when needed, and prevent a

useless test for mouse event when event is of keyboard type.
This commit is contained in:
Laurent MONIN 2005-12-12 17:11:28 +01:00 committed by Laurent MONIN
parent 59c8dcc473
commit c769b81f93

View File

@ -1185,22 +1185,23 @@ quit:
void void
send_event(struct session *ses, struct term_event *ev) send_event(struct session *ses, struct term_event *ev)
{ {
struct document_view *doc_view;
assert(ses && ev); assert(ses && ev);
if_assert_failed return; if_assert_failed return;
doc_view = current_frame(ses);
if (ev->ev == EVENT_KBD) { if (ev->ev == EVENT_KBD) {
struct document_view *doc_view = current_frame(ses);
ses = send_kbd_event(ses, doc_view, ev); ses = send_kbd_event(ses, doc_view, ev);
} }
#ifdef CONFIG_MOUSE #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); ses = send_mouse_event(ses, doc_view, ev);
} }
#endif /* CONFIG_MOUSE */ #endif /* CONFIG_MOUSE */
/* ses may disappear ie. in close_tab() */ /* @ses may disappear ie. in close_tab() */
if (ses) ses->kbdprefix.repeat_count = 0; if (ses) ses->kbdprefix.repeat_count = 0;
} }