mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 22:43:58 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@ -30,7 +30,6 @@
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
void server_client_key_table(struct client *, const char *);
|
||||
void server_client_free(int, short, void *);
|
||||
void server_client_check_focus(struct window_pane *);
|
||||
void server_client_check_resize(struct window_pane *);
|
||||
@ -70,13 +69,32 @@ server_client_check_nested(struct client *c)
|
||||
|
||||
/* Set client key table. */
|
||||
void
|
||||
server_client_key_table(struct client *c, const char *name)
|
||||
server_client_set_key_table(struct client *c, const char *name)
|
||||
{
|
||||
if (name == NULL)
|
||||
name = server_client_get_key_table(c);
|
||||
|
||||
key_bindings_unref_table(c->keytable);
|
||||
c->keytable = key_bindings_get_table(name, 1);
|
||||
c->keytable->references++;
|
||||
}
|
||||
|
||||
/* Get default key table. */
|
||||
const char *
|
||||
server_client_get_key_table(struct client *c)
|
||||
{
|
||||
struct session *s = c->session;
|
||||
const char *name;
|
||||
|
||||
if (s == NULL)
|
||||
return ("root");
|
||||
|
||||
name = options_get_string(s->options, "key-table");
|
||||
if (*name == '\0')
|
||||
return ("root");
|
||||
return (name);
|
||||
}
|
||||
|
||||
/* Create a new client. */
|
||||
void
|
||||
server_client_create(int fd)
|
||||
@ -307,7 +325,7 @@ server_client_check_mouse(struct client *c)
|
||||
log_debug("down at %u,%u", x, y);
|
||||
}
|
||||
if (type == NOTYPE)
|
||||
return (KEYC_NONE);
|
||||
return (KEYC_UNKNOWN);
|
||||
|
||||
/* Always save the session. */
|
||||
m->s = s->id;
|
||||
@ -317,7 +335,7 @@ server_client_check_mouse(struct client *c)
|
||||
if (m->statusat != -1 && y == (u_int)m->statusat) {
|
||||
w = status_get_window_at(c, x);
|
||||
if (w == NULL)
|
||||
return (KEYC_NONE);
|
||||
return (KEYC_UNKNOWN);
|
||||
m->w = w->id;
|
||||
where = STATUS;
|
||||
} else
|
||||
@ -350,7 +368,7 @@ server_client_check_mouse(struct client *c)
|
||||
}
|
||||
}
|
||||
if (where == NOWHERE)
|
||||
return (KEYC_NONE);
|
||||
return (KEYC_UNKNOWN);
|
||||
m->wp = wp->id;
|
||||
m->w = wp->window->id;
|
||||
} else
|
||||
@ -369,7 +387,7 @@ server_client_check_mouse(struct client *c)
|
||||
}
|
||||
|
||||
/* Convert to a key binding. */
|
||||
key = KEYC_NONE;
|
||||
key = KEYC_UNKNOWN;
|
||||
switch (type) {
|
||||
case NOTYPE:
|
||||
break;
|
||||
@ -481,8 +499,8 @@ server_client_check_mouse(struct client *c)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (key == KEYC_NONE)
|
||||
return (KEYC_NONE);
|
||||
if (key == KEYC_UNKNOWN)
|
||||
return (KEYC_UNKNOWN);
|
||||
|
||||
/* Apply modifiers if any. */
|
||||
if (b & MOUSE_MASK_META)
|
||||
@ -570,7 +588,7 @@ server_client_handle_key(struct client *c, key_code key)
|
||||
if (c->flags & CLIENT_READONLY)
|
||||
return;
|
||||
key = server_client_check_mouse(c);
|
||||
if (key == KEYC_NONE)
|
||||
if (key == KEYC_UNKNOWN)
|
||||
return;
|
||||
|
||||
m->valid = 1;
|
||||
@ -596,7 +614,7 @@ retry:
|
||||
* again in the root table.
|
||||
*/
|
||||
if ((c->flags & CLIENT_REPEAT) && !bd->can_repeat) {
|
||||
server_client_key_table(c, "root");
|
||||
server_client_set_key_table(c, NULL);
|
||||
c->flags &= ~CLIENT_REPEAT;
|
||||
server_status_client(c);
|
||||
goto retry;
|
||||
@ -623,7 +641,7 @@ retry:
|
||||
evtimer_add(&c->repeat_timer, &tv);
|
||||
} else {
|
||||
c->flags &= ~CLIENT_REPEAT;
|
||||
server_client_key_table(c, "root");
|
||||
server_client_set_key_table(c, NULL);
|
||||
}
|
||||
server_status_client(c);
|
||||
|
||||
@ -638,15 +656,15 @@ retry:
|
||||
* root table and try again.
|
||||
*/
|
||||
if (c->flags & CLIENT_REPEAT) {
|
||||
server_client_key_table(c, "root");
|
||||
server_client_set_key_table(c, NULL);
|
||||
c->flags &= ~CLIENT_REPEAT;
|
||||
server_status_client(c);
|
||||
goto retry;
|
||||
}
|
||||
|
||||
/* If no match and we're not in the root table, that's it. */
|
||||
if (strcmp(c->keytable->name, "root") != 0) {
|
||||
server_client_key_table(c, "root");
|
||||
if (strcmp(c->keytable->name, server_client_get_key_table(c)) != 0) {
|
||||
server_client_set_key_table(c, NULL);
|
||||
server_status_client(c);
|
||||
return;
|
||||
}
|
||||
@ -657,7 +675,7 @@ retry:
|
||||
*/
|
||||
if (key == (key_code)options_get_number(s->options, "prefix") ||
|
||||
key == (key_code)options_get_number(s->options, "prefix2")) {
|
||||
server_client_key_table(c, "prefix");
|
||||
server_client_set_key_table(c, "prefix");
|
||||
server_status_client(c);
|
||||
return;
|
||||
}
|
||||
@ -842,7 +860,7 @@ server_client_repeat_timer(__unused int fd, __unused short events, void *data)
|
||||
struct client *c = data;
|
||||
|
||||
if (c->flags & CLIENT_REPEAT) {
|
||||
server_client_key_table(c, "root");
|
||||
server_client_set_key_table(c, NULL);
|
||||
c->flags &= ~CLIENT_REPEAT;
|
||||
server_status_client(c);
|
||||
}
|
||||
|
Reference in New Issue
Block a user