summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-find.c10
-rw-r--r--usr.bin/tmux/resize.c13
-rw-r--r--usr.bin/tmux/server-client.c4
-rw-r--r--usr.bin/tmux/server-fn.c4
-rw-r--r--usr.bin/tmux/server.c4
-rw-r--r--usr.bin/tmux/session.c6
-rw-r--r--usr.bin/tmux/tmux.h7
7 files changed, 20 insertions, 28 deletions
diff --git a/usr.bin/tmux/cmd-find.c b/usr.bin/tmux/cmd-find.c
index bf08acb4c1c..89a2b2d9298 100644
--- a/usr.bin/tmux/cmd-find.c
+++ b/usr.bin/tmux/cmd-find.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-find.c,v 1.67 2018/08/02 11:44:07 nicm Exp $ */
+/* $OpenBSD: cmd-find.c,v 1.68 2018/08/18 20:08:52 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -136,7 +136,7 @@ cmd_find_best_client(struct session *s)
{
struct client *c_loop, *c;
- if (s->flags & SESSION_UNATTACHED)
+ if (s->attached == 0)
s = NULL;
c = NULL;
@@ -160,10 +160,10 @@ cmd_find_session_better(struct session *s, struct session *than, int flags)
if (than == NULL)
return (1);
if (flags & CMD_FIND_PREFER_UNATTACHED) {
- attached = (~than->flags & SESSION_UNATTACHED);
- if (attached && (s->flags & SESSION_UNATTACHED))
+ attached = (than->attached != 0);
+ if (attached && s->attached == 0)
return (1);
- else if (!attached && (~s->flags & SESSION_UNATTACHED))
+ else if (!attached && s->attached != 0)
return (0);
}
return (timercmp(&s->activity_time, &than->activity_time, >));
diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c
index c3c9c3ebaad..89d1769198a 100644
--- a/usr.bin/tmux/resize.c
+++ b/usr.bin/tmux/resize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resize.c,v 1.25 2017/10/16 19:30:53 nicm Exp $ */
+/* $OpenBSD: resize.c,v 1.26 2018/08/18 20:08:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -36,10 +36,6 @@
*
* This is quite inefficient - better/additional data structures are needed
* to make it better.
- *
- * As a side effect, this function updates the SESSION_UNATTACHED flag. This
- * flag is necessary to make sure unattached sessions do not limit the size of
- * windows that are attached both to them and to other (attached) sessions.
*/
void
@@ -79,11 +75,8 @@ recalculate_sizes(void)
s->attached++;
}
}
- if (ssx == UINT_MAX || ssy == UINT_MAX) {
- s->flags |= SESSION_UNATTACHED;
+ if (ssx == UINT_MAX || ssy == UINT_MAX)
continue;
- }
- s->flags &= ~SESSION_UNATTACHED;
if (lines != 0 && ssy == 0)
ssy = lines;
@@ -107,7 +100,7 @@ recalculate_sizes(void)
ssx = ssy = UINT_MAX;
RB_FOREACH(s, sessions, &sessions) {
- if (s->flags & SESSION_UNATTACHED)
+ if (s->attached == 0)
continue;
if (flag)
has = s->curw->window == w;
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 59f513423b3..77b2fd005ec 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.254 2018/08/02 11:44:07 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.255 2018/08/18 20:08:52 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1173,7 +1173,7 @@ server_client_check_focus(struct window_pane *wp)
TAILQ_FOREACH(c, &clients, entry) {
if (c->session == NULL || !(c->flags & CLIENT_FOCUSED))
continue;
- if (c->session->flags & SESSION_UNATTACHED)
+ if (c->session->attached == 0)
continue;
if (c->session->curw->window == wp->window)
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index 45433209a59..997bf027b6d 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.114 2018/04/10 10:48:44 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.115 2018/08/18 20:08:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -430,7 +430,7 @@ server_check_unattached(void)
* set, collect them.
*/
RB_FOREACH(s, sessions, &sessions) {
- if (!(s->flags & SESSION_UNATTACHED))
+ if (s->attached != 0)
continue;
if (options_get_number (s->options, "destroy-unattached"))
session_destroy(s, __func__);
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index 679bae889ef..83773c797af 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.181 2018/08/02 11:56:12 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.182 2018/08/18 20:08:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -319,7 +319,7 @@ server_update_socket(void)
n = 0;
RB_FOREACH(s, sessions, &sessions) {
- if (!(s->flags & SESSION_UNATTACHED)) {
+ if (s->attached != 0) {
n++;
break;
}
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c
index 69cc0dbad75..76a34c2a11e 100644
--- a/usr.bin/tmux/session.c
+++ b/usr.bin/tmux/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.80 2018/08/02 11:56:12 nicm Exp $ */
+/* $OpenBSD: session.c,v 1.81 2018/08/18 20:08:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -266,7 +266,7 @@ session_lock_timer(__unused int fd, __unused short events, void *arg)
{
struct session *s = arg;
- if (s->flags & SESSION_UNATTACHED)
+ if (s->attached == 0)
return;
log_debug("session %s locked, activity time %lld", s->name,
@@ -299,7 +299,7 @@ session_update_activity(struct session *s, struct timeval *from)
else
evtimer_set(&s->lock_timer, session_lock_timer, s);
- if (~s->flags & SESSION_UNATTACHED) {
+ if (s->attached != 0) {
timerclear(&tv);
tv.tv_sec = options_get_number(s->options, "lock-after-time");
if (tv.tv_sec != 0)
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 08da07b44d5..c1bb9adc6f1 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.838 2018/08/18 16:14:03 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.839 2018/08/18 20:08:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -938,9 +938,8 @@ struct session {
struct hooks *hooks;
struct options *options;
-#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
-#define SESSION_PASTING 0x2
-#define SESSION_ALERTED 0x4
+#define SESSION_PASTING 0x1
+#define SESSION_ALERTED 0x2
int flags;
u_int attached;