diff options
author | portix <portix@gmx.net> | 2011-09-05 23:43:20 +0200 |
---|---|---|
committer | portix <portix@gmx.net> | 2011-09-05 23:43:20 +0200 |
commit | eab55463fe3a03490d02e75bf07db66f887dc752 (patch) | |
tree | 2125e87e2b90022625a5e045751e701aeb76ec8e /src/html.c | |
parent | 3f2a0a7168b7b221dcf9f6efbb56f3d8cb6981a1 (diff) | |
download | dwb-eab55463fe3a03490d02e75bf07db66f887dc752.zip |
Change settings/keys also on blur event, leading space in settings
Diffstat (limited to 'src/html.c')
-rw-r--r-- | src/html.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -100,6 +100,11 @@ dwb_html_settings_changed_cb(WebKitDOMElement *el, WebKitDOMEvent *ev, WebKitWeb dwb_set_setting(id, value); return true; } +gboolean +dwb_html_focus_cb(WebKitDOMElement *el, WebKitDOMEvent *ev, WebKitWebView *wv) { + dwb_insert_mode(NULL); + return true; +} void dwb_html_settings_fill(char *key, WebSettings *s, WebKitWebView *wv) { char *value = dwb_util_arg_to_char(&s->arg, s->type); @@ -113,6 +118,8 @@ dwb_html_settings_fill(char *key, WebSettings *s, WebKitWebView *wv) { g_free(value); } webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(e), "change", G_CALLBACK(dwb_html_settings_changed_cb), false, wv); + webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(e), "blur", G_CALLBACK(dwb_html_settings_changed_cb), false, wv); + webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(e), "focus", G_CALLBACK(dwb_html_focus_cb), false, wv); } void dwb_html_settings_load_cb(WebKitWebView *wv, GParamSpec *p, HtmlTable *table) { @@ -155,9 +162,11 @@ dwb_html_keys_load_cb(WebKitWebView *wv, GParamSpec *p, HtmlTable *table) { input = webkit_dom_document_get_element_by_id(doc, n.first); if (input != NULL) { mod = dwb_modmask_to_string(km->mod); - value = g_strdup_printf("%s %s", mod, km->key ? km->key : ""); + value = g_strdup_printf("%s%s%s", mod, strlen(mod) > 0 ? " " : "", km->key ? km->key : ""); webkit_dom_html_input_element_set_value(WEBKIT_DOM_HTML_INPUT_ELEMENT(input), value); webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(input), "change", G_CALLBACK(dwb_html_key_changed_cb), false, wv); + webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(input), "blur", G_CALLBACK(dwb_html_key_changed_cb), false, wv); + webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(input), "focus", G_CALLBACK(dwb_html_focus_cb), false, wv); FREE(mod); g_free(value); } |