static Element* dom_get_active_element(Document* doc);
-void dom_check_auto_insert()
+void dom_check_auto_insert(void)
{
Document* doc = webkit_web_view_get_dom_document(vb.gui.webview);
Element* active = dom_get_active_element(doc);
+
+ /* the focus was not set automatically - add event listener to track focus
+ * events on the document */
if (!dom_auto_insert(active)) {
HtmlElement* element = webkit_dom_document_get_body(doc);
if (!element) {
}
}
+/**
+ * Remove focus from active and editable elements.
+ */
+void dom_clear_focus(void)
+{
+ Document* doc = webkit_web_view_get_dom_document(vb.gui.webview);
+ Element* active = dom_get_active_element(doc);
+
+ if (active) {
+ webkit_dom_element_blur(active);
+ }
+}
+
/**
* Indicates if the given dom element is an editable element like text input,
* password or textarea.
gulong bottom;
} DomBoundingRect;
-void dom_check_auto_insert();
+void dom_check_auto_insert(void);
+void dom_clear_focus(void);
gboolean dom_is_editable(Element* element);
#endif /* end of include guard: _DOM_H */
} else if (current_mode == VB_MODE_INSERT) {
/* clean the input if current mode is insert to remove -- INPUT -- */
clean = TRUE;
+ dom_clear_focus();
} else if (current_mode == VB_MODE_SEARCH) {
/* cleaup previous search */
command_search(&((Arg){VB_SEARCH_OFF}));