struct command comm;
};
-static int key_prefix(struct cmd_info *ci)
+static int key_prefix(const struct cmd_info *ci)
{
struct modmap *m = container_of(ci->comm, struct modmap, comm);
return NULL;
}
-int key_lookup(struct map *m, struct cmd_info *ci)
+int key_lookup(struct map *m, const struct cmd_info *ci)
{
int pos = key_find(m, ci->key);
struct command *comm;
comm = GETCOMM(m->comms[pos-1]);
} else
return 0;
- ci->comm = comm;
+ ((struct cmd_info*)ci)->comm = comm;
return comm->func(ci);
}
-int key_lookup_cmd_func(struct cmd_info *ci)
+int key_lookup_cmd_func(const struct cmd_info *ci)
{
struct lookup_cmd *l = container_of(ci->comm, struct lookup_cmd, c);
return key_lookup(*l->m, ci);
}
-int key_handle(struct cmd_info *ci)
+int key_handle(const struct cmd_info *ci)
{
+ struct cmd_info *vci = (struct cmd_info*)ci;
struct pane *p = ci->focus;
int ret = 0;
if (ci->comm)
return ci->comm->func(ci);
- ci->hx = ci->x;
- ci->hy = ci->y;
+ vci->hx = ci->x;
+ vci->hy = ci->y;
while (ret == 0 && p) {
if (p->handle) {
- ci->home = p;
- ci->comm = p->handle;
+ vci->home = p;
+ vci->comm = p->handle;
ret = p->handle->func(ci);
}
if (ret)
/* 'p' might have been destroyed */
break;
if (ci->hx >= 0) {
- ci->hx += p->x;
- ci->hy += p->y;
+ vci->hx += p->x;
+ vci->hy += p->y;
}
p = p->parent;
}
};
struct command {
- int (*func)(struct cmd_info *ci);
+ int (*func)(const struct cmd_info *ci);
};
/* this is ->data for a document pane. Only core-doc and
#define CMD(_name) {_name ## _func }
#define DEF_CMD(_name) \
- static int _name ## _func(struct cmd_info *ci); \
+ static int _name ## _func(const struct cmd_info *ci); \
static struct command _name = CMD(_name); \
- static int _name ## _func(struct cmd_info *ci)
+ static int _name ## _func(const struct cmd_info *ci)
#define REDEF_CMD(_name) \
- static int _name ## _func(struct cmd_info *ci)
+ static int _name ## _func(const struct cmd_info *ci)
#define DEF_LOOKUP_CMD(_name, _map) \
static struct lookup_cmd _name = { { key_lookup_cmd_func }, &_map };
-int key_lookup_cmd_func(struct cmd_info *ci);
+int key_lookup_cmd_func(const struct cmd_info *ci);
#define ARRAY_SIZE(ra) (sizeof(ra) / sizeof(ra[0]))
struct map *key_alloc(void);
void key_free(struct map *m);
-int key_handle(struct cmd_info *ci);
+int key_handle(const struct cmd_info *ci);
int key_handle_focus(struct cmd_info *ci);
int key_handle_xy(struct cmd_info *ci);
int key_handle_focus_point(struct cmd_info *ci);
int key_handle_xy_point(struct cmd_info *ci);
-int key_lookup(struct map *m, struct cmd_info *ci);
+int key_lookup(struct map *m, const const struct cmd_info *ci);
struct command *key_lookup_cmd(struct map *m, char *c);
void key_add(struct map *map, char *k, struct command *comm);
void key_add_range(struct map *map, char *first, char *last,
ci2.focus = p;
keymap_attach_func(&ci2);
pane_attach(p, "local-keymap", NULL, NULL);
- return key_handle_focus(ci);
+ return key_handle_focus((struct cmd_info*)ci);
}
}
if (kd->global && strncmp(ci->key, "global-set-key", 14) == 0) {
for (i = 0; i < kd->cmdcount; i++) {
int ret;
- ci->comm = kd->cmds[i];
+ ((struct cmd_info*)ci)->comm = kd->cmds[i];
ret = kd->cmds[i]->func(ci);
if (ret)
return ret;
static struct map *view_map;
static struct pane *do_view_attach(struct pane *par, int border);
-static int view_refresh(struct cmd_info *ci)
+static int view_refresh(const struct cmd_info *ci)
{
struct pane *p = ci->home;
struct view_data *vd = p->data;