From: Benjamin Petrenko Date: Mon, 20 Jul 2015 17:55:00 +0000 (+0300) Subject: give the focus to the text box after it's closed in an external editor X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=3758486bd5677b767fa431eaf1db5ce9da97856e;p=vimb.git give the focus to the text box after it's closed in an external editor --- diff --git a/src/dom.c b/src/dom.c index 3e86e81..4ca0a73 100644 --- a/src/dom.c +++ b/src/dom.c @@ -77,6 +77,14 @@ void dom_clear_focus(WebKitWebView *view) } } +/** + * Give the focus to element. + */ +void dom_give_focus(Element *element) +{ + webkit_dom_element_focus(element); +} + /** * Find the first editable element and set the focus on it and enter input * mode. diff --git a/src/dom.h b/src/dom.h index 892a2d8..03eaf37 100644 --- a/src/dom.h +++ b/src/dom.h @@ -35,6 +35,7 @@ void dom_install_focus_blur_callbacks(Document *doc); void dom_check_auto_insert(Document *doc); void dom_clear_focus(WebKitWebView *view); +void dom_give_focus(Element *element); gboolean dom_focus_input(Document *doc); gboolean dom_is_editable(Element *element); Element *dom_get_active_element(WebKitWebView *view); diff --git a/src/input.c b/src/input.c index 00ca557..5292b4e 100644 --- a/src/input.c +++ b/src/input.c @@ -155,7 +155,6 @@ VbResult input_open_editor(void) /* disable the active element */ dom_editable_element_set_disable(active, true); - dom_clear_focus(vb.gui.webview); EditorData *data = g_slice_new0(EditorData); data->file = file_path; @@ -177,6 +176,7 @@ static void resume_editor(GPid pid, int status, EditorData *data) g_free(text); } dom_editable_element_set_disable(data->element, false); + dom_give_focus(data->element); g_unlink(data->file); g_free(data->file);