mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
e811132b05
@ -135,7 +135,7 @@ cmd_find_best_client(struct session *s)
|
|||||||
{
|
{
|
||||||
struct client *c_loop, *c;
|
struct client *c_loop, *c;
|
||||||
|
|
||||||
if (s->flags & SESSION_UNATTACHED)
|
if (s->attached == 0)
|
||||||
s = NULL;
|
s = NULL;
|
||||||
|
|
||||||
c = NULL;
|
c = NULL;
|
||||||
@ -159,10 +159,10 @@ cmd_find_session_better(struct session *s, struct session *than, int flags)
|
|||||||
if (than == NULL)
|
if (than == NULL)
|
||||||
return (1);
|
return (1);
|
||||||
if (flags & CMD_FIND_PREFER_UNATTACHED) {
|
if (flags & CMD_FIND_PREFER_UNATTACHED) {
|
||||||
attached = (~than->flags & SESSION_UNATTACHED);
|
attached = (than->attached != 0);
|
||||||
if (attached && (s->flags & SESSION_UNATTACHED))
|
if (attached && s->attached == 0)
|
||||||
return (1);
|
return (1);
|
||||||
else if (!attached && (~s->flags & SESSION_UNATTACHED))
|
else if (!attached && s->attached != 0)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
return (timercmp(&s->activity_time, &than->activity_time, >));
|
return (timercmp(&s->activity_time, &than->activity_time, >));
|
||||||
|
11
resize.c
11
resize.c
@ -36,10 +36,6 @@
|
|||||||
*
|
*
|
||||||
* This is quite inefficient - better/additional data structures are needed
|
* This is quite inefficient - better/additional data structures are needed
|
||||||
* to make it better.
|
* 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
|
void
|
||||||
@ -79,11 +75,8 @@ recalculate_sizes(void)
|
|||||||
s->attached++;
|
s->attached++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssx == UINT_MAX || ssy == UINT_MAX) {
|
if (ssx == UINT_MAX || ssy == UINT_MAX)
|
||||||
s->flags |= SESSION_UNATTACHED;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
s->flags &= ~SESSION_UNATTACHED;
|
|
||||||
|
|
||||||
if (lines != 0 && ssy == 0)
|
if (lines != 0 && ssy == 0)
|
||||||
ssy = lines;
|
ssy = lines;
|
||||||
@ -107,7 +100,7 @@ recalculate_sizes(void)
|
|||||||
|
|
||||||
ssx = ssy = UINT_MAX;
|
ssx = ssy = UINT_MAX;
|
||||||
RB_FOREACH(s, sessions, &sessions) {
|
RB_FOREACH(s, sessions, &sessions) {
|
||||||
if (s->flags & SESSION_UNATTACHED)
|
if (s->attached == 0)
|
||||||
continue;
|
continue;
|
||||||
if (flag)
|
if (flag)
|
||||||
has = s->curw->window == w;
|
has = s->curw->window == w;
|
||||||
|
@ -1183,7 +1183,7 @@ server_client_check_focus(struct window_pane *wp)
|
|||||||
TAILQ_FOREACH(c, &clients, entry) {
|
TAILQ_FOREACH(c, &clients, entry) {
|
||||||
if (c->session == NULL || !(c->flags & CLIENT_FOCUSED))
|
if (c->session == NULL || !(c->flags & CLIENT_FOCUSED))
|
||||||
continue;
|
continue;
|
||||||
if (c->session->flags & SESSION_UNATTACHED)
|
if (c->session->attached == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (c->session->curw->window == wp->window)
|
if (c->session->curw->window == wp->window)
|
||||||
|
@ -431,7 +431,7 @@ server_check_unattached(void)
|
|||||||
* set, collect them.
|
* set, collect them.
|
||||||
*/
|
*/
|
||||||
RB_FOREACH(s, sessions, &sessions) {
|
RB_FOREACH(s, sessions, &sessions) {
|
||||||
if (!(s->flags & SESSION_UNATTACHED))
|
if (s->attached != 0)
|
||||||
continue;
|
continue;
|
||||||
if (options_get_number (s->options, "destroy-unattached"))
|
if (options_get_number (s->options, "destroy-unattached"))
|
||||||
session_destroy(s, __func__);
|
session_destroy(s, __func__);
|
||||||
|
2
server.c
2
server.c
@ -318,7 +318,7 @@ server_update_socket(void)
|
|||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
RB_FOREACH(s, sessions, &sessions) {
|
RB_FOREACH(s, sessions, &sessions) {
|
||||||
if (!(s->flags & SESSION_UNATTACHED)) {
|
if (s->attached != 0) {
|
||||||
n++;
|
n++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ session_lock_timer(__unused int fd, __unused short events, void *arg)
|
|||||||
{
|
{
|
||||||
struct session *s = arg;
|
struct session *s = arg;
|
||||||
|
|
||||||
if (s->flags & SESSION_UNATTACHED)
|
if (s->attached == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log_debug("session %s locked, activity time %lld", s->name,
|
log_debug("session %s locked, activity time %lld", s->name,
|
||||||
@ -298,7 +298,7 @@ session_update_activity(struct session *s, struct timeval *from)
|
|||||||
else
|
else
|
||||||
evtimer_set(&s->lock_timer, session_lock_timer, s);
|
evtimer_set(&s->lock_timer, session_lock_timer, s);
|
||||||
|
|
||||||
if (~s->flags & SESSION_UNATTACHED) {
|
if (s->attached != 0) {
|
||||||
timerclear(&tv);
|
timerclear(&tv);
|
||||||
tv.tv_sec = options_get_number(s->options, "lock-after-time");
|
tv.tv_sec = options_get_number(s->options, "lock-after-time");
|
||||||
if (tv.tv_sec != 0)
|
if (tv.tv_sec != 0)
|
||||||
|
5
tmux.h
5
tmux.h
@ -942,9 +942,8 @@ struct session {
|
|||||||
struct hooks *hooks;
|
struct hooks *hooks;
|
||||||
struct options *options;
|
struct options *options;
|
||||||
|
|
||||||
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
|
#define SESSION_PASTING 0x1
|
||||||
#define SESSION_PASTING 0x2
|
#define SESSION_ALERTED 0x2
|
||||||
#define SESSION_ALERTED 0x4
|
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
u_int attached;
|
u_int attached;
|
||||||
|
Loading…
Reference in New Issue
Block a user