From 0281f732aba0f4633deb676babef4d60024f998a Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 10 Dec 2005 03:48:42 +0100 Subject: [PATCH] Fix broken onClick on checkboxes etc. onClick on checkbox would get triggered before actually ticking the checkbox, which is not the expected behaviour (apparently). This change makes sure that we call the onClick event handler only after actually doing our work with the checkbox/select widget (for the other widgets, things should stay the same). --- src/viewer/text/link.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index 821de035..2321b49a 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -900,12 +900,12 @@ enter(struct session *ses, struct document_view *doc_view, int do_reload) link = get_current_link(doc_view); if (!link) return FRAME_EVENT_REFRESH; - if (!current_link_evhook(doc_view, SEVHOOK_ONCLICK)) - return FRAME_EVENT_REFRESH; - if (!link_is_form(link) || link_is_textinput(link) || link->type == LINK_BUTTON) { + if (!current_link_evhook(doc_view, SEVHOOK_ONCLICK)) + return FRAME_EVENT_REFRESH; + if (goto_current_link(ses, doc_view, do_reload)) return FRAME_EVENT_OK; @@ -959,6 +959,9 @@ enter(struct session *ses, struct document_view *doc_view, int do_reload) INTERNAL("bad link type %d", link->type); } + if (!current_link_evhook(doc_view, SEVHOOK_ONCLICK)) + return FRAME_EVENT_REFRESH; + return FRAME_EVENT_REFRESH; }