/** * Remove focus from active and editable elements. */ void dom_clear_focus(WebKitWebView *view) { Element *active = dom_get_active_element(view); if (active) { webkit_dom_element_blur(active); } }
void input_focus_blur(struct tab *t, void *active) { /* active is (WebKitDOMElement*) */ if (active) webkit_dom_element_blur(active); }
int command_mode(struct tab *t, struct karg *args) { WebKitDOMElement *active = NULL; if (args->i == XT_MODE_COMMAND) { if (dom_is_input(t, &active)) if (active) webkit_dom_element_blur(active); set_mode(t, XT_MODE_COMMAND); } else { if (focus_input(t)) set_mode(t, XT_MODE_INSERT); } return (XT_CB_HANDLED); }
void dom_check_auto_insert(Document *doc) { Element *active = webkit_dom_html_document_get_active_element(WEBKIT_DOM_HTML_DOCUMENT(doc)); if (active) { if (!vb.config.strict_focus) { auto_insert(active); } else if (vb.mode->id != 'i') { /* If strict-focus is enabled and the editable element becomes * focus, we explicitely remove the focus. But only if vimb isn't * in input mode at the time. This prevents from leaving input * mode that was started by user interaction like click to * editable element, or the 'gi' normal mode command. */ webkit_dom_element_blur(active); } } dom_install_focus_blur_callbacks(doc); }
void input_autofocus(struct tab *t) { WebKitDOMElement *active = NULL; if (autofocus_onload && t->tab_id == gtk_notebook_get_current_page(notebook)) { if (focus_input(t)) set_mode(t, XT_MODE_INSERT); else set_mode(t, XT_MODE_COMMAND); } else { if (dom_is_input(t, &active)) if (active) webkit_dom_element_blur(active); set_mode(t, XT_MODE_COMMAND); } }