コード例 #1
0
ファイル: dom.c プロジェクト: uggedal/vimb
void dom_check_auto_insert(WebKitWebView *view)
{
    Document *doc   = webkit_web_view_get_dom_document(view);
    Element *active = get_active_element(doc);

    if (vb.config.strict_focus || !auto_insert(active)) {
        /* if the strict-focus is on also blur the possible active element */
        if (vb.config.strict_focus) {
            dom_clear_focus(view);
        }
        /* the focus was not set automatically - add event listener to track
         * focus events on the document */
        HtmlElement *element = webkit_dom_document_get_body(doc);
        if (!element) {
            element = WEBKIT_DOM_HTML_ELEMENT(webkit_dom_document_get_document_element(doc));
        }
        webkit_dom_event_target_add_event_listener(
            WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(editable_focus_cb), false, NULL
        );
    }
}
コード例 #2
0
ファイル: ex.c プロジェクト: dreamsxin/vimb
/**
 * Function called when vimb enters the command mode.
 */
void ex_enter(void)
{
    gtk_widget_grab_focus(GTK_WIDGET(vb.gui.input));
    dom_clear_focus(vb.gui.webview);
}