aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-01-07 14:34:45 +0000
committerTiago Cunha <tcunha@gmx.com>2011-01-07 14:34:45 +0000
commit219442cff707a1febb6a75ba2cfe48b02ae0a22e (patch)
tree9183798a9411a3f45dc6ceb19383f51ba36135d1 /server-client.c
parent3aaf5b9b1e4b5249a86db97d67291e22b90e1fef (diff)
downloadrtmux-219442cff707a1febb6a75ba2cfe48b02ae0a22e.tar.gz
rtmux-219442cff707a1febb6a75ba2cfe48b02ae0a22e.tar.bz2
rtmux-219442cff707a1febb6a75ba2cfe48b02ae0a22e.zip
Sync OpenBSD patchset 828:
Support for UTF-8 mouse input (\033[1005h). This was added in xterm 262 and supports larger terminals than the older way. If the new mouse-utf8 option is on, UTF-8 mouse input is enabled for all UTF-8 terminals. The option defaults to on if LANG etc are set in the same manner as the utf8 option. With help and based on code from hsim at gmx.li.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/server-client.c b/server-client.c
index 046f9f51..d7d90969 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1,4 +1,4 @@
-/* $Id: server-client.c,v 1.50 2011-01-03 23:27:54 tcunha Exp $ */
+/* $Id: server-client.c,v 1.51 2011-01-07 14:34:45 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -450,6 +450,21 @@ server_client_reset_state(struct client *c)
if (TAILQ_NEXT(TAILQ_FIRST(&w->panes), entry) != NULL &&
options_get_number(oo, "mouse-select-pane"))
mode |= MODE_MOUSE_STANDARD;
+
+ /*
+ * Set UTF-8 mouse input if required. If the terminal is UTF-8, the
+ * user has set mouse-utf8 and any mouse mode is in effect, turn on
+ * UTF-8 mouse input. If the receiving terminal hasn't requested it
+ * (that is, it isn't in s->mode), then it'll be converted in
+ * input_mouse.
+ */
+ if ((c->tty.flags & TTY_UTF8) &&
+ (mode & ALL_MOUSE_MODES) && options_get_number(oo, "mouse-utf8"))
+ mode |= MODE_MOUSE_UTF8;
+ else
+ mode &= ~MODE_MOUSE_UTF8;
+
+ /* Set the terminal mode and reset attributes. */
tty_update_mode(&c->tty, mode);
tty_reset(&c->tty);
}