mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Store a key event not a mouse event in the shared data.
This commit is contained in:
parent
53d6b94e8a
commit
77d5b0cc53
@ -70,7 +70,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
|
||||
}
|
||||
|
||||
if (args_has(args, 'M')) {
|
||||
if ((wp = cmd_mouse_pane(&shared->mouse, &s, NULL)) == NULL)
|
||||
if ((wp = cmd_mouse_pane(&shared->event.m, &s, NULL)) == NULL)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
if (c == NULL || c->session != s)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
@ -87,7 +87,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
|
||||
swp = wp;
|
||||
if (!window_pane_set_mode(wp, swp, &window_copy_mode, NULL, args)) {
|
||||
if (args_has(args, 'M'))
|
||||
window_copy_start_drag(c, &shared->mouse);
|
||||
window_copy_start_drag(c, &shared->event.m);
|
||||
}
|
||||
if (args_has(args, 'u'))
|
||||
window_copy_pageup(wp, 0);
|
||||
|
@ -99,9 +99,9 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
|
||||
*px = wp->xoff - ox;
|
||||
else
|
||||
*px = 0;
|
||||
} else if (strcmp(xp, "M") == 0 && shared->mouse.valid) {
|
||||
if (shared->mouse.x > w / 2)
|
||||
*px = shared->mouse.x - w / 2;
|
||||
} else if (strcmp(xp, "M") == 0) {
|
||||
if (shared->event.m.valid && shared->event.m.x > w / 2)
|
||||
*px = shared->event.m.x - w / 2;
|
||||
else
|
||||
*px = 0;
|
||||
} else if (strcmp(xp, "W") == 0) {
|
||||
@ -133,9 +133,12 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
|
||||
*py = wp->yoff + wp->sy - oy;
|
||||
else
|
||||
*py = 0;
|
||||
} else if (strcmp(yp, "M") == 0 && shared->mouse.valid)
|
||||
*py = shared->mouse.y + h;
|
||||
else if (strcmp(yp, "S") == 0) {
|
||||
} else if (strcmp(yp, "M") == 0) {
|
||||
if (shared->event.m.valid)
|
||||
*py = shared->event.m.y + h;
|
||||
else
|
||||
*py = 0;
|
||||
} else if (strcmp(yp, "S") == 0) {
|
||||
if (options_get_number(s->options, "status-position") == 0) {
|
||||
if (lines != 0)
|
||||
*py = lines + h;
|
||||
@ -147,8 +150,7 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
|
||||
else
|
||||
*py = c->tty.sy;
|
||||
}
|
||||
}
|
||||
else if (strcmp(yp, "W") == 0) {
|
||||
} else if (strcmp(yp, "W") == 0) {
|
||||
if (options_get_number(s->options, "status-position") == 0) {
|
||||
if (lines != 0)
|
||||
*py = line + 1 + h;
|
||||
@ -228,7 +230,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cmd_display_menu_get_position(c, item, args, &px, &py, menu->width + 4,
|
||||
menu->count + 2);
|
||||
|
||||
if (!shared->mouse.valid)
|
||||
if (!shared->event.m.valid)
|
||||
flags |= MENU_NOMOUSE;
|
||||
if (menu_display(menu, flags, item, px, py, c, target, NULL, NULL) != 0)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
|
@ -982,7 +982,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
|
||||
|
||||
/* Mouse target is a plain = or {mouse}. */
|
||||
if (strcmp(target, "=") == 0 || strcmp(target, "{mouse}") == 0) {
|
||||
m = &cmdq_get_shared(item)->mouse;
|
||||
m = &cmdq_get_shared(item)->event.m;
|
||||
switch (type) {
|
||||
case CMD_FIND_PANE:
|
||||
fs->wp = cmd_mouse_pane(m, &fs->s, &fs->wl);
|
||||
|
@ -65,7 +65,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
|
||||
struct args *args = cmd_get_args(self);
|
||||
struct cmdq_shared *shared = cmdq_get_shared(item);
|
||||
struct cmd_find_state *target = cmdq_get_target(item);
|
||||
struct mouse_event *m = &shared->mouse;
|
||||
struct mouse_event *m = &shared->event.m;
|
||||
struct cmd_if_shell_data *cdata;
|
||||
char *shellcmd, *cmd;
|
||||
const char *file;
|
||||
|
@ -333,8 +333,11 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
|
||||
cmd_find_copy_state(&shared->current, current);
|
||||
else
|
||||
cmd_find_clear_state(&shared->current, 0);
|
||||
if (m != NULL)
|
||||
memcpy(&shared->mouse, m, sizeof shared->mouse);
|
||||
if (m != NULL) {
|
||||
shared->event.key = KEYC_NONE;
|
||||
memcpy(&shared->event.m, m,
|
||||
sizeof shared->event.m);
|
||||
}
|
||||
shared->flags = flags;
|
||||
last_group = group;
|
||||
}
|
||||
|
@ -76,12 +76,12 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
}
|
||||
|
||||
if (args_has(args, 'M')) {
|
||||
if (cmd_mouse_window(&shared->mouse, &s) == NULL)
|
||||
if (cmd_mouse_window(&shared->event.m, &s) == NULL)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
if (c == NULL || c->session != s)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update;
|
||||
cmd_resize_pane_mouse_update(c, &shared->mouse);
|
||||
cmd_resize_pane_mouse_update(c, &shared->event.m);
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
struct window_pane *wp = target->wp;
|
||||
struct session *s = target->s;
|
||||
struct winlink *wl = target->wl;
|
||||
struct mouse_event *m = &shared->mouse;
|
||||
struct mouse_event *m = &shared->event.m;
|
||||
struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes);
|
||||
int i;
|
||||
key_code key;
|
||||
|
2
format.c
2
format.c
@ -1133,7 +1133,7 @@ format_create_add_item(struct format_tree *ft, struct cmdq_item *item)
|
||||
|
||||
if (shared == NULL)
|
||||
return;
|
||||
m = &shared->mouse;
|
||||
m = &shared->event.m;
|
||||
if (m->valid && ((wp = cmd_mouse_pane(m, NULL, NULL)) != NULL)) {
|
||||
format_add(ft, "mouse_pane", "%%%u", wp->id);
|
||||
if (cmd_mouse_at(wp, m, &x, &y, 0) == 0) {
|
||||
|
2
menu.c
2
menu.c
@ -282,7 +282,7 @@ chosen:
|
||||
break;
|
||||
case CMD_PARSE_SUCCESS:
|
||||
if (md->item != NULL)
|
||||
m = &cmdq_get_shared(md->item)->mouse;
|
||||
m = &cmdq_get_shared(md->item)->event.m;
|
||||
else
|
||||
m = NULL;
|
||||
new_item = cmdq_get_command(pr->cmdlist, &md->fs, m, 0);
|
||||
|
2
popup.c
2
popup.c
@ -305,7 +305,7 @@ popup_key_cb(struct client *c, struct key_event *event)
|
||||
break;
|
||||
case CMD_PARSE_SUCCESS:
|
||||
if (pd->item != NULL)
|
||||
m = &cmdq_get_shared(pd->item)->mouse;
|
||||
m = &cmdq_get_shared(pd->item)->event.m;
|
||||
else
|
||||
m = NULL;
|
||||
new_item = cmdq_get_command(pr->cmdlist, fs, m, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user