diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-05-18 20:30:14 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-05-18 20:30:14 +0000 |
commit | 4efd45628d28e41a1d84091b4b6091484586ca28 (patch) | |
tree | 4b2bb97c5f9a940ac7bda656164163c559f7dc93 /server-client.c | |
parent | 4fcbf4b872bb2b30a34edaf7e0b95a01c17a8aa7 (diff) | |
download | rtmux-4efd45628d28e41a1d84091b4b6091484586ca28.tar.gz rtmux-4efd45628d28e41a1d84091b4b6091484586ca28.tar.bz2 rtmux-4efd45628d28e41a1d84091b4b6091484586ca28.zip |
Sync OpenBSD patchset 905:
Add a new option, mouse-resize-pane. When on, panes may be resized by
dragging their borders. From hsim at gmx.li.
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c index 8e54fd33..826529be 100644 --- a/server-client.c +++ b/server-client.c @@ -1,4 +1,4 @@ -/* $Id: server-client.c,v 1.59 2011-05-05 10:12:33 tcunha Exp $ */ +/* $Id: server-client.c,v 1.60 2011-05-18 20:30:14 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -88,6 +88,9 @@ server_client_create(int fd) c->prompt_buffer = NULL; c->prompt_index = 0; + c->last_mouse.b = MOUSE_UP; + c->last_mouse.x = c->last_mouse.y = -1; + evtimer_set(&c->repeat_timer, server_client_repeat_timer, c); for (i = 0; i < ARRAY_LENGTH(&clients); i++) { @@ -343,6 +346,9 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data) return; } } + if (options_get_number(oo, "mouse-resize-pane")) + layout_resize_pane_mouse(c, mouse); + memcpy(&c->last_mouse, mouse, sizeof c->last_mouse); window_pane_mouse(wp, c->session, mouse); return; } @@ -475,14 +481,24 @@ server_client_reset_state(struct client *c) tty_cursor(&c->tty, wp->xoff + s->cx, wp->yoff + s->cy); /* + * Resizing panes with the mouse requires at least button mode to give + * a smooth appearance. + */ + mode = s->mode; + if ((c->last_mouse.b & MOUSE_RESIZE_PANE) && + !(mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ANY))) + mode |= MODE_MOUSE_BUTTON; + + /* * Any mode will do for mouse-select-pane, but set standard mode if * none. */ - mode = s->mode; if ((mode & ALL_MOUSE_MODES) == 0) { if (TAILQ_NEXT(TAILQ_FIRST(&w->panes), entry) != NULL && options_get_number(oo, "mouse-select-pane")) mode |= MODE_MOUSE_STANDARD; + else if (options_get_number(oo, "mouse-resize-pane")) + mode |= MODE_MOUSE_STANDARD; else if (options_get_number(oo, "mouse-select-window")) mode |= MODE_MOUSE_STANDARD; else if (options_get_number(wo, "mode-mouse")) |