version 1.34, 2019/09/23 15:41:11 |
version 1.35, 2019/11/28 09:45:16 |
|
|
#include "tmux.h" |
#include "tmux.h" |
|
|
void |
void |
resize_window(struct window *w, u_int sx, u_int sy) |
resize_window(struct window *w, u_int sx, u_int sy, int xpixel, int ypixel) |
{ |
{ |
int zoomed; |
int zoomed; |
|
|
|
|
sx = w->layout_root->sx; |
sx = w->layout_root->sx; |
if (sy < w->layout_root->sy) |
if (sy < w->layout_root->sy) |
sy = w->layout_root->sy; |
sy = w->layout_root->sy; |
window_resize(w, sx, sy); |
window_resize(w, sx, sy, xpixel, ypixel); |
log_debug("%s: @%u resized to %u,%u; layout %u,%u", __func__, w->id, |
log_debug("%s: @%u resized to %u,%u; layout %u,%u", __func__, w->id, |
sx, sy, w->layout_root->sx, w->layout_root->sy); |
sx, sy, w->layout_root->sx, w->layout_root->sy); |
|
|
|
|
|
|
void |
void |
default_window_size(struct client *c, struct session *s, struct window *w, |
default_window_size(struct client *c, struct session *s, struct window *w, |
u_int *sx, u_int *sy, int type) |
u_int *sx, u_int *sy, u_int *xpixel, u_int *ypixel, int type) |
{ |
{ |
struct client *loop; |
struct client *loop; |
u_int cx, cy; |
u_int cx, cy; |
|
|
switch (type) { |
switch (type) { |
case WINDOW_SIZE_LARGEST: |
case WINDOW_SIZE_LARGEST: |
*sx = *sy = 0; |
*sx = *sy = 0; |
|
*xpixel = *ypixel = 0; |
TAILQ_FOREACH(loop, &clients, entry) { |
TAILQ_FOREACH(loop, &clients, entry) { |
if (ignore_client_size(loop)) |
if (ignore_client_size(loop)) |
continue; |
continue; |
|
|
*sx = cx; |
*sx = cx; |
if (cy > *sy) |
if (cy > *sy) |
*sy = cy; |
*sy = cy; |
|
|
|
if (loop->tty.xpixel > *xpixel && |
|
loop->tty.ypixel > *ypixel) { |
|
*xpixel = loop->tty.xpixel; |
|
*ypixel = loop->tty.ypixel; |
|
} |
} |
} |
if (*sx == 0 || *sy == 0) |
if (*sx == 0 || *sy == 0) |
goto manual; |
goto manual; |
break; |
break; |
case WINDOW_SIZE_SMALLEST: |
case WINDOW_SIZE_SMALLEST: |
*sx = *sy = UINT_MAX; |
*sx = *sy = UINT_MAX; |
|
*xpixel = *ypixel = 0; |
TAILQ_FOREACH(loop, &clients, entry) { |
TAILQ_FOREACH(loop, &clients, entry) { |
if (ignore_client_size(loop)) |
if (ignore_client_size(loop)) |
continue; |
continue; |
|
|
*sx = cx; |
*sx = cx; |
if (cy < *sy) |
if (cy < *sy) |
*sy = cy; |
*sy = cy; |
|
|
|
if (loop->tty.xpixel > *xpixel && |
|
loop->tty.ypixel > *ypixel) { |
|
*xpixel = loop->tty.xpixel; |
|
*ypixel = loop->tty.ypixel; |
|
} |
} |
} |
if (*sx == UINT_MAX || *sy == UINT_MAX) |
if (*sx == UINT_MAX || *sy == UINT_MAX) |
goto manual; |
goto manual; |
|
|
if (c != NULL && !ignore_client_size(c)) { |
if (c != NULL && !ignore_client_size(c)) { |
*sx = c->tty.sx; |
*sx = c->tty.sx; |
*sy = c->tty.sy - status_line_size(c); |
*sy = c->tty.sy - status_line_size(c); |
|
*xpixel = c->tty.xpixel; |
|
*ypixel = c->tty.ypixel; |
} else { |
} else { |
*sx = *sy = UINT_MAX; |
*sx = *sy = UINT_MAX; |
|
*xpixel = *ypixel = 0; |
TAILQ_FOREACH(loop, &clients, entry) { |
TAILQ_FOREACH(loop, &clients, entry) { |
if (ignore_client_size(loop)) |
if (ignore_client_size(loop)) |
continue; |
continue; |
|
|
*sx = cx; |
*sx = cx; |
if (cy < *sy) |
if (cy < *sy) |
*sy = cy; |
*sy = cy; |
|
|
|
if (loop->tty.xpixel > *xpixel && |
|
loop->tty.ypixel > *ypixel) { |
|
*xpixel = loop->tty.xpixel; |
|
*ypixel = loop->tty.ypixel; |
|
} |
} |
} |
if (*sx == UINT_MAX || *sy == UINT_MAX) |
if (*sx == UINT_MAX || *sy == UINT_MAX) |
goto manual; |
goto manual; |
|
|
{ |
{ |
struct session *s; |
struct session *s; |
struct client *c; |
struct client *c; |
u_int sx, sy, cx, cy; |
u_int sx, sy, cx, cy, xpixel = 0, ypixel = 0; |
int type, current, has, changed; |
int type, current, has, changed; |
|
|
if (w->active == NULL) |
if (w->active == NULL) |
|
|
sx = cx; |
sx = cx; |
if (cy > sy) |
if (cy > sy) |
sy = cy; |
sy = cy; |
|
|
|
if (c->tty.xpixel > xpixel && c->tty.ypixel > ypixel) { |
|
xpixel = c->tty.xpixel; |
|
ypixel = c->tty.ypixel; |
|
} |
} |
} |
if (sx == 0 || sy == 0) |
if (sx == 0 || sy == 0) |
changed = 0; |
changed = 0; |
|
|
sx = cx; |
sx = cx; |
if (cy < sy) |
if (cy < sy) |
sy = cy; |
sy = cy; |
|
|
|
if (c->tty.xpixel > xpixel && c->tty.ypixel > ypixel) { |
|
xpixel = c->tty.xpixel; |
|
ypixel = c->tty.ypixel; |
|
} |
} |
} |
if (sx == UINT_MAX || sy == UINT_MAX) |
if (sx == UINT_MAX || sy == UINT_MAX) |
changed = 0; |
changed = 0; |
|
|
sx = cx; |
sx = cx; |
if (cy < sy) |
if (cy < sy) |
sy = cy; |
sy = cy; |
|
|
|
if (c->tty.xpixel > xpixel && c->tty.ypixel > ypixel) { |
|
xpixel = c->tty.xpixel; |
|
ypixel = c->tty.ypixel; |
|
} |
} |
} |
if (sx == UINT_MAX || sy == UINT_MAX) |
if (sx == UINT_MAX || sy == UINT_MAX) |
changed = 0; |
changed = 0; |
|
|
tty_update_window_offset(w); |
tty_update_window_offset(w); |
return; |
return; |
} |
} |
log_debug("%s: @%u changed to %u,%u", __func__, w->id, sx, sy); |
log_debug("%s: @%u changed to %u,%u (%ux%u)", __func__, w->id, sx, sy, |
resize_window(w, sx, sy); |
xpixel, ypixel); |
|
resize_window(w, sx, sy, xpixel, ypixel); |
} |
} |
|
|
void |
void |