summaryrefslogtreecommitdiff
path: root/src/view.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2013-03-20 21:14:37 +0100
committerportix <portix@gmx.net>2013-03-20 21:14:37 +0100
commitdec5ff68cf266708f0a71aea55cf0b516ccdd37b (patch)
tree6a71646e6b0d9f2653241c0cffc1b4910f20dc4e /src/view.c
parent137e78b1c6ecf8323ca7122861244f2702411a62 (diff)
downloaddwb-dec5ff68cf266708f0a71aea55cf0b516ccdd37b.zip
New option 'passthrough-keys'
Diffstat (limited to 'src/view.c')
-rw-r--r--src/view.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/view.c b/src/view.c
index fd157f8f..ae39706e 100644
--- a/src/view.c
+++ b/src/view.c
@@ -1337,6 +1337,50 @@ view_init_settings(GList *gl)
static gboolean
view_key_ignore_cb(WebKitWebView *wv, GdkEventKey *e, GList *gl)
{
+ // passthrough none
+ if (dwb.misc.passthrough == PASSTHROUGH_NONE)
+ return !(dwb.state.mode & INSERT_MODE);
+ // passthrough all
+ else if (dwb.misc.passthrough == PASSTHROUGH_ALL)
+ return false;
+
+ if (e->state == GDK_CONTROL_MASK)
+ {
+ switch (e->keyval)
+ {
+ case GDK_KEY_c:
+ case GDK_KEY_x:
+ case GDK_KEY_v:
+ case GDK_KEY_a:
+ return false;
+ }
+ }
+ else if (e->state == GDK_SHIFT_MASK)
+ {
+ switch (e->keyval)
+ {
+ case GDK_KEY_ISO_Left_Tab:
+ case GDK_KEY_space:
+ return false;
+ }
+ }
+ else
+ {
+ switch (e->keyval)
+ {
+ case GDK_KEY_Tab:
+ case GDK_KEY_Return:
+ case GDK_KEY_Escape:
+ case GDK_KEY_Up:
+ case GDK_KEY_Down:
+ case GDK_KEY_Left:
+ case GDK_KEY_Right:
+ case GDK_KEY_Page_Up:
+ case GDK_KEY_Page_Down:
+ case GDK_KEY_space:
+ return false;
+ }
+ }
return !(dwb.state.mode & INSERT_MODE);
}