aboutsummaryrefslogtreecommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-05-08 21:02:25 +0100
committerThomas Adam <thomas@xteddy.org>2019-05-08 21:02:25 +0100
commit4bc45fc95aa1a7af5bf97b4c1f66ccbc70790c31 (patch)
treee7b208da1146e64e5f91d978375478d0f3fb792b /cmd.c
parentb24d7d9c95c2083f14715f95a5a96fcb5204eca0 (diff)
parentf9682d2e558c58117f23f302ce35d9b319151189 (diff)
downloadrtmux-4bc45fc95aa1a7af5bf97b4c1f66ccbc70790c31.tar.gz
rtmux-4bc45fc95aa1a7af5bf97b4c1f66ccbc70790c31.tar.bz2
rtmux-4bc45fc95aa1a7af5bf97b4c1f66ccbc70790c31.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/cmd.c b/cmd.c
index 1d52da65..3e35ef3c 100644
--- a/cmd.c
+++ b/cmd.c
@@ -509,17 +509,22 @@ cmd_mouse_window(struct mouse_event *m, struct session **sp)
{
struct session *s;
struct window *w;
+ struct winlink *wl;
- if (!m->valid || m->s == -1 || m->w == -1)
+ if (!m->valid)
return (NULL);
- if ((s = session_find_by_id(m->s)) == NULL)
+ if (m->s == -1 || (s = session_find_by_id(m->s)) == NULL)
return (NULL);
- if ((w = window_find_by_id(m->w)) == NULL)
- return (NULL);
-
+ if (m->w == -1)
+ wl = s->curw;
+ else {
+ if ((w = window_find_by_id(m->w)) == NULL)
+ return (NULL);
+ wl = winlink_find_by_window(&s->windows, w);
+ }
if (sp != NULL)
*sp = s;
- return (winlink_find_by_window(&s->windows, w));
+ return (wl);
}
/* Get current mouse pane if any. */