diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.c | 8 | ||||
-rw-r--r-- | src/commands.h | 1 | ||||
-rw-r--r-- | src/dwb.c | 30 | ||||
-rw-r--r-- | src/dwb.h | 4 | ||||
-rw-r--r-- | src/html.c | 2 | ||||
-rw-r--r-- | src/view.c | 2 |
6 files changed, 24 insertions, 23 deletions
diff --git a/src/commands.c b/src/commands.c index 5ea69402..78ea74d0 100644 --- a/src/commands.c +++ b/src/commands.c @@ -106,6 +106,11 @@ commands_add_search_field(KeyMap *km, Arg *a) { }/*}}}*/ +DwbStatus +commands_insert_mode(KeyMap *km, Arg *a) { + return dwb_insert_mode(); +} + /* commands_toggle_property {{{*/ DwbStatus commands_toggle_property(KeyMap *km, Arg *a) { @@ -877,6 +882,9 @@ commands_fullscreen(KeyMap *km, Arg *arg) { /* commands_reload_scripts {{{*/ DwbStatus commands_pass_through(KeyMap *km, Arg *arg) { + if (dwb.state.mode & INSERT_MODE) { + view_modify_style(CURRENT_VIEW(), &dwb.color.active_fg, &dwb.color.active_bg, NULL, NULL, NULL); + } dwb.state.mode |= PASS_THROUGH; dwb_set_normal_message(dwb.state.fview, false, "-- PASS THROUGH --"); return STATUS_OK; diff --git a/src/commands.h b/src/commands.h index c1a63f73..99eac3a0 100644 --- a/src/commands.h +++ b/src/commands.h @@ -89,4 +89,5 @@ DwbStatus commands_reload_scripts(KeyMap *, Arg *); DwbStatus commands_fullscreen(KeyMap *, Arg *); DwbStatus commands_pass_through(KeyMap *, Arg *); DwbStatus commands_open_editor(KeyMap *, Arg *); +DwbStatus commands_insert_mode(KeyMap *, Arg *); #endif @@ -148,7 +148,7 @@ static FunctionMap FMAP [] = { { { "increase_master", "Increase master area", }, 1, (Func)commands_resize_master, "Cannot increase further", ALWAYS_SM, { .n = -5 } }, { { "insert_mode", "Insert Mode", }, 0, - (Func)dwb_insert_mode, NULL, POST_SM, }, + (Func)commands_insert_mode, NULL, POST_SM, }, { { "load_html", "Load html", }, 1, (Func)commands_open, NULL, NEVER_SM, { .i = HTML_STRING, .n = OPEN_NORMAL, .p = NULL } }, { { "load_html_nv", "Load html new view", }, 1, @@ -514,10 +514,6 @@ static WebSettings DWB_SETTINGS[] = { SETTING_GLOBAL, COLOR_CHAR, { .p = "#00ff00" }, (S_Func) dwb_init_style, }, { { "ssl-untrusted-color", "Color for ssl-encrypted sites, untrusted certificate", }, SETTING_GLOBAL, COLOR_CHAR, { .p = "#ff0000" }, (S_Func) dwb_init_style, }, - { { "insertmode-fg-color", "Foreground color in insertmode", }, - SETTING_GLOBAL, COLOR_CHAR, { .p = "#ffffff" }, (S_Func) dwb_init_style, }, - { { "insertmode-bg-color", "Background color in insertmode", }, - SETTING_GLOBAL, COLOR_CHAR, { .p = "#303030" }, (S_Func) dwb_init_style, }, { { "error-color", "Color for error messages", }, SETTING_GLOBAL, COLOR_CHAR, { .p = "#ff0000" }, (S_Func) dwb_init_style, }, { { "status-allowed-color", "Color of allowed elements in the statusbar", }, @@ -1789,7 +1785,7 @@ dwb_update_hints(GdkEventKey *e) { dwb_normal_mode(false); } else if (!strcmp(buffer, "_dwb_input_")) { - dwb_insert_mode(NULL); + dwb_insert_mode(); } else if (!strcmp(buffer, "_dwb_click_")) { dwb.state.scriptlock = 1; @@ -2376,16 +2372,18 @@ dwb_command_mode(Arg *arg) { }/*}}}*/ /* dwb_insert_mode(Arg *arg) {{{*/ -gboolean -dwb_insert_mode(Arg *arg) { +DwbStatus +dwb_insert_mode(void) { + if (dwb.state.mode & PASS_THROUGH) + return STATUS_ERROR; if (dwb.state.mode == HINT_MODE) { dwb_set_normal_message(dwb.state.fview, true, INSERT); } - view_modify_style(CURRENT_VIEW(), &dwb.color.insert_fg, &dwb.color.insert_bg, NULL, NULL, NULL); + //view_modify_style(CURRENT_VIEW(), &dwb.color.insert_fg, &dwb.color.insert_bg, NULL, NULL, NULL); dwb_set_normal_message(dwb.state.fview, false, "-- INSERT MODE --"); dwb.state.mode = INSERT_MODE; - return true; + return STATUS_OK; }/*}}}*/ /* dwb_normal_mode() {{{*/ @@ -2396,10 +2394,10 @@ dwb_normal_mode(gboolean clean) { if (mode == HINT_MODE || mode == SEARCH_FIELD_MODE) { dwb_execute_script(MAIN_FRAME(), "DwbHintObj.clear()", false); } - else if (mode & INSERT_MODE) { - view_modify_style(CURRENT_VIEW(), &dwb.color.active_fg, &dwb.color.active_bg, NULL, NULL, NULL); - gtk_entry_set_visibility(GTK_ENTRY(dwb.gui.entry), true); - } + //else if (mode & INSERT_MODE) { + // view_modify_style(CURRENT_VIEW(), &dwb.color.active_fg, &dwb.color.active_bg, NULL, NULL, NULL); + // gtk_entry_set_visibility(GTK_ENTRY(dwb.gui.entry), true); + //} else if (mode == DOWNLOAD_GET_PATH) { completion_clean_path_completion(); } @@ -2971,10 +2969,6 @@ dwb_init_style() { DWB_COLOR_PARSE(&dwb.color.tab_normal_fg, GET_CHAR("tab-normal-fg-color")); DWB_COLOR_PARSE(&dwb.color.tab_normal_bg, GET_CHAR("tab-normal-bg-color")); - /* InsertMode */ - DWB_COLOR_PARSE(&dwb.color.insert_fg, GET_CHAR("insertmode-fg-color")); - DWB_COLOR_PARSE(&dwb.color.insert_bg, GET_CHAR("insertmode-bg-color")); - /* Downloads */ DWB_COLOR_PARSE(&dwb.color.download_fg, "#ffffff"); DWB_COLOR_PARSE(&dwb.color.download_bg, "#000000"); @@ -515,8 +515,6 @@ struct _Color { DwbColor tab_active_bg; DwbColor tab_normal_fg; DwbColor tab_normal_bg; - DwbColor insert_bg; - DwbColor insert_fg; DwbColor error; DwbColor active_c_fg; DwbColor active_c_bg; @@ -655,7 +653,7 @@ struct _Dwb { Dwb dwb; /*}}}*/ -gboolean dwb_insert_mode(Arg *); +DwbStatus dwb_insert_mode(void); void dwb_normal_mode(gboolean); void dwb_load_uri(GList *gl, Arg *); @@ -146,7 +146,7 @@ gboolean html_focus_cb(WebKitDOMElement *el, WebKitDOMEvent *ev, WebKitWebView *wv) { char *type = webkit_dom_element_get_attribute(el, "type"); if (!strcmp(type, "text")) { - dwb_insert_mode(NULL); + dwb_insert_mode(); return true; } return false; @@ -90,7 +90,7 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) { gboolean ret = false; if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) { - dwb_insert_mode(NULL); + dwb_insert_mode(); } else if (e->state & GDK_CONTROL_MASK && e->button == 1) { WebKitDOMDocument *doc = webkit_web_view_get_dom_document(web); |