mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Do pane resize ioctls once at the end of the server loop rather than
immediately.
This commit is contained in:
parent
ce7bf1083e
commit
dbd8e47846
@ -28,6 +28,7 @@
|
|||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
void server_client_check_focus(struct window_pane *);
|
void server_client_check_focus(struct window_pane *);
|
||||||
|
void server_client_check_resize(struct window_pane *);
|
||||||
void server_client_check_mouse(struct client *, struct window_pane *);
|
void server_client_check_mouse(struct client *, struct window_pane *);
|
||||||
void server_client_repeat_timer(int, short, void *);
|
void server_client_repeat_timer(int, short, void *);
|
||||||
void server_client_check_exit(struct client *);
|
void server_client_check_exit(struct client *);
|
||||||
@ -495,7 +496,7 @@ server_client_loop(void)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Any windows will have been redrawn as part of clients, so clear
|
* Any windows will have been redrawn as part of clients, so clear
|
||||||
* their flags now. Also check and update pane focus.
|
* their flags now. Also check pane focus and resize.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
|
||||||
w = ARRAY_ITEM(&windows, i);
|
w = ARRAY_ITEM(&windows, i);
|
||||||
@ -505,11 +506,41 @@ server_client_loop(void)
|
|||||||
w->flags &= ~WINDOW_REDRAW;
|
w->flags &= ~WINDOW_REDRAW;
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
server_client_check_focus(wp);
|
server_client_check_focus(wp);
|
||||||
|
server_client_check_resize(wp);
|
||||||
wp->flags &= ~PANE_REDRAW;
|
wp->flags &= ~PANE_REDRAW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if pane should be resized. */
|
||||||
|
void
|
||||||
|
server_client_check_resize(struct window_pane *wp)
|
||||||
|
{
|
||||||
|
struct winsize ws;
|
||||||
|
|
||||||
|
if (wp->fd == -1 || !(wp->flags & PANE_RESIZE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
memset(&ws, 0, sizeof ws);
|
||||||
|
ws.ws_col = wp->sx;
|
||||||
|
ws.ws_row = wp->sy;
|
||||||
|
|
||||||
|
if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) {
|
||||||
|
#ifdef __sun
|
||||||
|
/*
|
||||||
|
* Some versions of Solaris apparently can return an error when
|
||||||
|
* resizing; don't know why this happens, can't reproduce on
|
||||||
|
* other platforms and ignoring it doesn't seem to cause any
|
||||||
|
* issues.
|
||||||
|
*/
|
||||||
|
if (errno != EINVAL)
|
||||||
|
#endif
|
||||||
|
fatal("ioctl failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
wp->flags &= ~PANE_RESIZE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check whether pane should be focused. */
|
/* Check whether pane should be focused. */
|
||||||
void
|
void
|
||||||
server_client_check_focus(struct window_pane *wp)
|
server_client_check_focus(struct window_pane *wp)
|
||||||
|
18
window.c
18
window.c
@ -855,32 +855,16 @@ window_pane_error_callback(
|
|||||||
void
|
void
|
||||||
window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)
|
window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)
|
||||||
{
|
{
|
||||||
struct winsize ws;
|
|
||||||
|
|
||||||
if (sx == wp->sx && sy == wp->sy)
|
if (sx == wp->sx && sy == wp->sy)
|
||||||
return;
|
return;
|
||||||
wp->sx = sx;
|
wp->sx = sx;
|
||||||
wp->sy = sy;
|
wp->sy = sy;
|
||||||
|
|
||||||
memset(&ws, 0, sizeof ws);
|
|
||||||
ws.ws_col = sx;
|
|
||||||
ws.ws_row = sy;
|
|
||||||
|
|
||||||
screen_resize(&wp->base, sx, sy, wp->saved_grid == NULL);
|
screen_resize(&wp->base, sx, sy, wp->saved_grid == NULL);
|
||||||
if (wp->mode != NULL)
|
if (wp->mode != NULL)
|
||||||
wp->mode->resize(wp, sx, sy);
|
wp->mode->resize(wp, sx, sy);
|
||||||
|
|
||||||
if (wp->fd != -1 && ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
|
wp->flags |= PANE_RESIZE;
|
||||||
#ifdef __sun
|
|
||||||
/*
|
|
||||||
* Some versions of Solaris apparently can return an error when
|
|
||||||
* resizing; don't know why this happens, can't reproduce on
|
|
||||||
* other platforms and ignoring it doesn't seem to cause any
|
|
||||||
* issues.
|
|
||||||
*/
|
|
||||||
if (errno != EINVAL)
|
|
||||||
#endif
|
|
||||||
fatal("ioctl failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user