diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-06-13 12:01:20 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-06-13 12:01:20 +0100 |
commit | 824efe7be47ff534d57da1ab66c3d0dfde86992d (patch) | |
tree | 064e4d8e67292d6b2eaf0797c67b046da031068b /window.c | |
parent | 4000052d92395a41cdaa79cfc1df38fc89858cf4 (diff) | |
parent | 1c78155e70a9f72ed6c191807c2b381cf114b91f (diff) | |
download | rtmux-824efe7be47ff534d57da1ab66c3d0dfde86992d.tar.gz rtmux-824efe7be47ff534d57da1ab66c3d0dfde86992d.tar.bz2 rtmux-824efe7be47ff534d57da1ab66c3d0dfde86992d.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1500,13 +1500,16 @@ winlink_clear_flags(struct winlink *wl) /* Shuffle window indexes up. */ int -winlink_shuffle_up(struct session *s, struct winlink *wl) +winlink_shuffle_up(struct session *s, struct winlink *wl, int before) { int idx, last; if (wl == NULL) return (-1); - idx = wl->idx + 1; + if (before) + idx = wl->idx; + else + idx = wl->idx + 1; /* Find the next free index. */ for (last = idx; last < INT_MAX; last++) { @@ -1519,8 +1522,9 @@ winlink_shuffle_up(struct session *s, struct winlink *wl) /* Move everything from last - 1 to idx up a bit. */ for (; last > idx; last--) { wl = winlink_find_by_index(&s->windows, last - 1); - server_link_window(s, wl, s, last, 0, 0, NULL); - server_unlink_window(s, wl); + RB_REMOVE(winlinks, &s->windows, wl); + wl->idx++; + RB_INSERT(winlinks, &s->windows, wl); } return (idx); |