aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-02-17 20:59:26 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-02-18 16:50:40 +0100
commit44ff1f95ecc14521fb2a1cec67a628140fc46598 (patch)
tree61e5439273640ebd33747637d6e8359a1dee056b /vis.c
parent58df45177a7db63223c8459be7aef727a0cc22f7 (diff)
downloadvis-44ff1f95ecc14521fb2a1cec67a628140fc46598.tar.gz
vis-44ff1f95ecc14521fb2a1cec67a628140fc46598.tar.xz
Add infrastructure to add custom motion functions
A motion function can be registered with vis_motion_register(...) the returned id (if non negative) can then be used as an argument to vis_motion(...)
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index 35516de..ccea1f1 100644
--- a/vis.c
+++ b/vis.c
@@ -377,6 +377,7 @@ void vis_free(Vis *vis) {
buffer_release(&vis->input_queue);
for (int i = 0; i < VIS_MODE_INVALID; i++)
map_free(vis_modes[i].bindings);
+ array_release_full(&vis->motions);
free(vis);
}
@@ -488,6 +489,8 @@ void action_do(Vis *vis, Action *a) {
pos = a->movement->view(vis, view);
else if (a->movement->win)
pos = a->movement->win(vis, win, pos);
+ else if (a->movement->user)
+ pos = a->movement->user(vis, win, a->movement->data, pos);
if (pos == EPOS || a->movement->type & IDEMPOTENT)
break;
}