Revision: 2807
          http://tmux.svn.sourceforge.net/tmux/?rev=2807&view=rev
Author:   tcunha
Date:     2012-05-22 21:05:30 +0000 (Tue, 22 May 2012)
Log Message:
-----------
Sync OpenBSD patchset 1121:

Store client in tty struct directly instead of using a callback function
pointer.

Modified Paths:
--------------
    trunk/server-client.c
    trunk/tmux.h
    trunk/tty-keys.c
    trunk/tty.c

Modified: trunk/server-client.c
===================================================================
--- trunk/server-client.c       2012-05-22 21:04:25 UTC (rev 2806)
+++ trunk/server-client.c       2012-05-22 21:05:30 UTC (rev 2807)
@@ -26,9 +26,8 @@
 
 #include "tmux.h"
 
-void   server_client_check_mouse(struct client *c,
-           struct window_pane *wp, struct mouse_event *mouse);
-void   server_client_handle_key(int, struct mouse_event *, void *);
+void   server_client_check_mouse(struct client *, struct window_pane *,
+           struct mouse_event *);
 void   server_client_repeat_timer(int, short, void *);
 void   server_client_check_exit(struct client *);
 void   server_client_check_redraw(struct client *);
@@ -337,9 +336,8 @@
 
 /* Handle data key input from client. */
 void
-server_client_handle_key(int key, struct mouse_event *mouse, void *data)
+server_client_handle_key(struct client *c, int key)
 {
-       struct client           *c = data;
        struct session          *s;
        struct window           *w;
        struct window_pane      *wp;
@@ -390,7 +388,7 @@
        if (key == KEYC_MOUSE) {
                if (c->flags & CLIENT_READONLY)
                        return;
-               server_client_check_mouse(c, wp, mouse);
+               server_client_check_mouse(c, wp, &c->tty.mouse);
                return;
        }
 
@@ -898,15 +896,13 @@
        if (!isatty(fd))
            return;
        data->term[(sizeof data->term) - 1] = '\0';
-       tty_init(&c->tty, fd, data->term);
+       tty_init(&c->tty, c, fd, data->term);
        if (data->flags & IDENTIFY_UTF8)
                c->tty.flags |= TTY_UTF8;
        if (data->flags & IDENTIFY_256COLOURS)
                c->tty.term_flags |= TERM_256COLOURS;
        else if (data->flags & IDENTIFY_88COLOURS)
                c->tty.term_flags |= TERM_88COLOURS;
-       c->tty.key_callback = server_client_handle_key;
-       c->tty.key_data = c;
 
        tty_resize(&c->tty);
 

Modified: trunk/tmux.h
===================================================================
--- trunk/tmux.h        2012-05-22 21:04:25 UTC (rev 2806)
+++ trunk/tmux.h        2012-05-22 21:05:30 UTC (rev 2807)
@@ -1096,6 +1096,8 @@
 LIST_HEAD(tty_terms, tty_term);
 
 struct tty {
+       struct client   *client;
+
        char            *path;
        u_int            xterm_version;
 
@@ -1134,9 +1136,8 @@
 
        int              term_flags;
 
-       struct mouse_event mouse_event;
-       void             (*key_callback)(int, struct mouse_event *, void *);
-       void            *key_data;
+       struct mouse_event mouse;
+
        struct event     key_timer;
        struct tty_key  *key_tree;
 };
@@ -1529,7 +1530,7 @@
 void   tty_puts(struct tty *, const char *);
 void   tty_putc(struct tty *, u_char);
 void   tty_pututf8(struct tty *, const struct grid_utf8 *);
-void   tty_init(struct tty *, int, char *);
+void   tty_init(struct tty *, struct client *, int, char *);
 int    tty_resize(struct tty *);
 int    tty_set_size(struct tty *, u_int, u_int);
 void   tty_start_tty(struct tty *);
@@ -1760,6 +1761,7 @@
 void    server_add_accept(int);
 
 /* server-client.c */
+void    server_client_handle_key(struct client *, int);
 void    server_client_create(int);
 int      server_client_open(struct client *, struct session *, char **);
 void    server_client_lost(struct client *);

Modified: trunk/tty-keys.c
===================================================================
--- trunk/tty-keys.c    2012-05-22 21:04:25 UTC (rev 2806)
+++ trunk/tty-keys.c    2012-05-22 21:05:30 UTC (rev 2807)
@@ -580,7 +580,7 @@
                evtimer_del(&tty->key_timer);
 
        if (key != KEYC_NONE)
-               tty->key_callback(key, &tty->mouse_event, tty->key_data);
+               server_client_handle_key(tty->client, key);
 
        tty->flags &= ~TTY_ESCAPE;
        return (1);
@@ -607,7 +607,7 @@
 int
 tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
 {
-       struct mouse_event      *m = &tty->mouse_event;
+       struct mouse_event      *m = &tty->mouse;
        struct utf8_data         utf8data;
        u_int                    i, value;
 

Modified: trunk/tty.c
===================================================================
--- trunk/tty.c 2012-05-22 21:04:25 UTC (rev 2806)
+++ trunk/tty.c 2012-05-22 21:05:30 UTC (rev 2807)
@@ -64,7 +64,7 @@
        ((ctx)->xoff == 0 && screen_size_x((ctx)->wp->screen) >= (tty)->sx)
 
 void
-tty_init(struct tty *tty, int fd, char *term)
+tty_init(struct tty *tty, struct client *c, int fd, char *term)
 {
        char    *path;
 
@@ -76,6 +76,7 @@
        else
                tty->termname = xstrdup(term);
        tty->fd = fd;
+       tty->client = c;
 
        if ((path = ttyname(fd)) == NULL)
                fatalx("ttyname failed");

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to