Don't switch from pass through mode to input mode (#95).
authorDaniel Carl <danielcarl@gmx.de>
Thu, 31 Jul 2014 23:50:00 +0000 (01:50 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 1 Aug 2014 00:34:55 +0000 (02:34 +0200)
Don't switch from pass through by click into input field nor by a reload of the
page with a focused input field.

src/dom.c
src/main.c

index 9668a26..49c3d91 100644 (file)
--- a/src/dom.c
+++ b/src/dom.c
@@ -198,7 +198,8 @@ static gboolean element_is_visible(WebKitDOMDOMWindow* win, WebKitDOMElement* el
 
 static gboolean auto_insert(Element *element)
 {
-    if (dom_is_editable(element)) {
+    /* don't change mode if we are in pass through mode */
+    if (vb.mode->id != 'p' && dom_is_editable(element)) {
         mode_enter('i');
 
         return true;
index 78a20c6..481244c 100644 (file)
@@ -529,7 +529,7 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec)
                 js_eval_file(ctx, vb.files[FILES_SCRIPT]);
             }
 
-            /* if we load a page from a submitted form, leafe the insert mode */
+            /* if we load a page from a submitted form, leave the insert mode */
             if (vb.mode->id == 'i') {
                 mode_enter('n');
             }
@@ -1078,7 +1078,9 @@ static gboolean button_relase_cb(WebKitWebView *webview, GdkEventButton *event)
 
             propagate = true;
         }
-    } else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
+    } else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE && vb.mode->id != 'p') {
+        /* don't switch back to input mode if we are currently in pass through
+         * mode when the user clicks into a form field */
         mode_enter('i');
         propagate = true;
     }