version 1.46, 2021/08/25 10:18:01 |
version 1.47, 2021/08/27 17:15:57 |
|
|
return (1); |
return (1); |
} |
} |
} |
} |
if ((c->flags & CLIENT_CONTROL) && (~c->flags & CLIENT_SIZECHANGED)) |
if ((c->flags & CLIENT_CONTROL) && |
|
(~c->flags & CLIENT_SIZECHANGED) && |
|
(~c->flags & CLIENT_WINDOWSIZECHANGED)) |
return (1); |
return (1); |
return (0); |
return (0); |
} |
} |
|
|
int, int, struct session *, struct window *), u_int *sx, u_int *sy, |
int, int, struct session *, struct window *), u_int *sx, u_int *sy, |
u_int *xpixel, u_int *ypixel) |
u_int *xpixel, u_int *ypixel) |
{ |
{ |
struct client *loop; |
struct client *loop; |
u_int cx, cy, n = 0; |
struct client_window *cw; |
|
u_int cx, cy, n = 0; |
|
|
/* Manual windows do not have their size changed based on a client. */ |
|
if (type == WINDOW_SIZE_MANUAL) { |
|
log_debug("%s: type is manual", __func__); |
|
return (0); |
|
} |
|
|
|
/* |
/* |
* Start comparing with 0 for largest and UINT_MAX for smallest or |
* Start comparing with 0 for largest and UINT_MAX for smallest or |
* latest. |
* latest. |
*/ |
*/ |
if (type == WINDOW_SIZE_LARGEST) |
if (type == WINDOW_SIZE_LARGEST) { |
*sx = *sy = 0; |
*sx = 0; |
else |
*sy = 0; |
*sx = *sy = UINT_MAX; |
} else if (type == WINDOW_SIZE_MANUAL) { |
|
*sx = w->manual_sx; |
|
*sy = w->manual_sy; |
|
log_debug("%s: manual size %ux%u", __func__, *sx, *sy); |
|
} else { |
|
*sx = UINT_MAX; |
|
*sy = UINT_MAX; |
|
} |
*xpixel = *ypixel = 0; |
*xpixel = *ypixel = 0; |
|
|
/* |
/* |
|
|
if (type == WINDOW_SIZE_LATEST && w != NULL) |
if (type == WINDOW_SIZE_LATEST && w != NULL) |
n = clients_with_window(w); |
n = clients_with_window(w); |
|
|
|
/* Skip setting the size if manual */ |
|
if (type == WINDOW_SIZE_MANUAL) |
|
goto skip; |
|
|
/* Loop over the clients and work out the size. */ |
/* Loop over the clients and work out the size. */ |
TAILQ_FOREACH(loop, &clients, entry) { |
TAILQ_FOREACH(loop, &clients, entry) { |
if (loop != c && ignore_client_size(loop)) { |
if (loop != c && ignore_client_size(loop)) { |
log_debug("%s: ignoring %s", __func__, loop->name); |
log_debug("%s: ignoring %s (1)", __func__, loop->name); |
continue; |
continue; |
} |
} |
if (loop != c && skip_client(loop, type, current, s, w)) { |
if (loop != c && skip_client(loop, type, current, s, w)) { |
log_debug("%s: skipping %s", __func__, loop->name); |
log_debug("%s: skipping %s (1)", __func__, loop->name); |
continue; |
continue; |
} |
} |
|
|
|
|
continue; |
continue; |
} |
} |
|
|
|
/* |
|
* If the client has a per-window size, use this instead if it is |
|
* smaller. |
|
*/ |
|
if (w != NULL) |
|
cw = server_client_get_client_window(loop, w->id); |
|
else |
|
cw = NULL; |
|
|
/* Work out this client's size. */ |
/* Work out this client's size. */ |
cx = loop->tty.sx; |
if (cw != NULL) { |
cy = loop->tty.sy - status_line_size(loop); |
cx = cw->sx; |
|
cy = cw->sy; |
|
} else { |
|
cx = loop->tty.sx; |
|
cy = loop->tty.sy - status_line_size(loop); |
|
} |
|
|
/* |
/* |
* If it is larger or smaller than the best so far, update the |
* If it is larger or smaller than the best so far, update the |
|
|
else |
else |
log_debug("%s: no calculated size", __func__); |
log_debug("%s: no calculated size", __func__); |
|
|
|
skip: |
|
/* |
|
* Do not allow any size to be larger than the per-client window size |
|
* if one exists. |
|
*/ |
|
if (w != NULL) { |
|
TAILQ_FOREACH(loop, &clients, entry) { |
|
if (loop != c && ignore_client_size(loop)) |
|
continue; |
|
if (loop != c && skip_client(loop, type, current, s, w)) |
|
continue; |
|
|
|
/* Look up per-window size if any. */ |
|
if (~loop->flags & CLIENT_WINDOWSIZECHANGED) |
|
continue; |
|
cw = server_client_get_client_window(loop, w->id); |
|
if (cw == NULL) |
|
continue; |
|
|
|
/* Clamp the size. */ |
|
log_debug("%s: %s size for @%u is %ux%u", __func__, |
|
loop->name, w->id, cw->sx, cw->sy); |
|
if (cw->sx != 0 && *sx > cw->sx) |
|
*sx = cw->sx; |
|
if (cw->sy != 0 && *sy > cw->sy) |
|
*sy = cw->sy; |
|
} |
|
} |
|
if (*sx != UINT_MAX && *sy != UINT_MAX) |
|
log_debug("%s: calculated size %ux%u", __func__, *sx, *sy); |
|
else |
|
log_debug("%s: no calculated size", __func__); |
|
|
/* Return whether a suitable size was found. */ |
/* Return whether a suitable size was found. */ |
|
if (type == WINDOW_SIZE_MANUAL) { |
|
log_debug("%s: type is manual", __func__); |
|
return (1); |
|
} |
if (type == WINDOW_SIZE_LARGEST) { |
if (type == WINDOW_SIZE_LARGEST) { |
log_debug("%s: type is largest", __func__); |
log_debug("%s: type is largest", __func__); |
return (*sx != 0 && *sy != 0); |
return (*sx != 0 && *sy != 0); |