viscal

cairo/gtk vi-like timeblocking calendar
git clone git://jb55.com/viscal
Log | Files | Refs | README | LICENSE

commit 776a77dde8eb5e41820272f789ea780017edf0a7
parent 0e09674f0edb62b5802707814bfa129af14a36fb
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 11 Oct 2018 21:41:19 -0700

set_chord

Diffstat:
Mviscal.c | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/viscal.c b/viscal.c @@ -1271,6 +1271,12 @@ static chord_cmd *get_chord_cmd(char current_chord, char key) { return NULL; } +static void set_chord(struct cal *cal, char c) +{ + assert(cal->chord == 0); + cal->chord = c; +} + static gboolean on_keypress (GtkWidget *widget, GdkEvent *event, gpointer user_data) { struct extra_data *data = (struct extra_data*)user_data; @@ -1334,8 +1340,7 @@ static gboolean on_keypress (GtkWidget *widget, GdkEvent *event, gpointer user_ break; case 'd': - assert(cal->chord == 0); - cal->chord = 'd'; + set_chord(cal, 'd'); break; case 'S': @@ -1357,8 +1362,7 @@ static gboolean on_keypress (GtkWidget *widget, GdkEvent *event, gpointer user_ break; case 'g': - assert(cal->chord == 0); - cal->chord = 'g'; + set_chord(cal, 'g'); break; case 'K': @@ -1378,8 +1382,7 @@ static gboolean on_keypress (GtkWidget *widget, GdkEvent *event, gpointer user_ break; case 'z': - assert(cal->chord == 0); - cal->chord = 'z'; + set_chord(cal, 'z'); break; case 'v':