diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 8ed9a1a6..aace3134 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -41,6 +41,9 @@ const struct cmd_entry cmd_break_pane_entry = { enum cmd_retval cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) { +#ifdef TMATE_SLAVE + return (CMD_RETURN_ERROR); +#else struct args *args = self->args; struct winlink *wl; struct session *s; @@ -112,4 +115,5 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) format_free(ft); } return (CMD_RETURN_NORMAL); +#endif } diff --git a/cmd-join-pane.c b/cmd-join-pane.c index 2cf587e0..62efe43d 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -76,6 +76,9 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq) enum cmd_retval join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) { +#ifdef TMATE_SLAVE + return (CMD_RETURN_ERROR); +#else struct args *args = self->args; struct session *dst_s; struct winlink *src_wl, *dst_wl; @@ -170,4 +173,5 @@ join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) notify_window_layout_changed(dst_w); return (CMD_RETURN_NORMAL); +#endif } diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c index 40761350..d6c7e8ac 100644 --- a/cmd-kill-pane.c +++ b/cmd-kill-pane.c @@ -41,6 +41,9 @@ const struct cmd_entry cmd_kill_pane_entry = { enum cmd_retval cmd_kill_pane_exec(struct cmd *self, struct cmd_q *cmdq) { +#ifdef TMATE_SLAVE + return (CMD_RETURN_ERROR); +#else struct args *args = self->args; struct winlink *wl; struct window_pane *loopwp, *tmpwp, *wp; @@ -70,4 +73,5 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_q *cmdq) server_redraw_window(wl->window); return (CMD_RETURN_NORMAL); +#endif } diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index ca2a6cd3..0b048885 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -88,6 +88,9 @@ cmd_resize_pane_key_binding(struct cmd *self, int key) enum cmd_retval cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) { +#ifdef TMATE_SLAVE + return (CMD_RETURN_ERROR); +#else struct args *args = self->args; struct winlink *wl; struct window *w; @@ -154,4 +157,5 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) server_redraw_window(wl->window); return (CMD_RETURN_NORMAL); +#endif } diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c index 75ca7292..56a5eb9f 100644 --- a/cmd-rotate-window.c +++ b/cmd-rotate-window.c @@ -48,6 +48,9 @@ cmd_rotate_window_key_binding(struct cmd *self, int key) enum cmd_retval cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq) { +#ifdef TMATE_SLAVE + return (CMD_RETURN_ERROR); +#else struct args *args = self->args; struct winlink *wl; struct window *w; @@ -116,4 +119,5 @@ cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq) } return (CMD_RETURN_NORMAL); +#endif } diff --git a/cmd-select-layout.c b/cmd-select-layout.c index ae1be4c4..75176933 100644 --- a/cmd-select-layout.c +++ b/cmd-select-layout.c @@ -85,6 +85,9 @@ cmd_select_layout_key_binding(struct cmd *self, int key) enum cmd_retval cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) { +#ifdef TMATE_SLAVE + return (CMD_RETURN_ERROR); +#else struct args *args = self->args; struct winlink *wl; const char *layoutname; @@ -132,4 +135,5 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) cmdq_info(cmdq, "arranging in: %s", layoutname); } return (CMD_RETURN_NORMAL); +#endif } diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index d484f4e2..4b899adf 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -52,6 +52,9 @@ cmd_swap_pane_key_binding(struct cmd *self, int key) enum cmd_retval cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) { +#ifdef TMATE_SLAVE + return (CMD_RETURN_ERROR); +#else struct args *args = self->args; struct winlink *src_wl, *dst_wl; struct window *src_w, *dst_w; @@ -141,4 +144,5 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) server_redraw_window(dst_w); return (CMD_RETURN_NORMAL); +#endif } diff --git a/control-notify.c b/control-notify.c index a298cdc5..766b783c 100644 --- a/control-notify.c +++ b/control-notify.c @@ -76,6 +76,7 @@ control_notify_window_layout_changed(struct window *w) if (winlink_find_by_window_id(&s->windows, w->id) == NULL) continue; +#ifndef TMATE_SLAVE /* * When the last pane in a window is closed it won't have a * layout root and we don't need to inform the client about the @@ -83,6 +84,7 @@ control_notify_window_layout_changed(struct window *w) */ if (w->layout_root == NULL) continue; +#endif template = "%layout-change #{window_id} #{window_layout}"; ft = format_create(); diff --git a/format.c b/format.c index c635f00f..84122202 100644 --- a/format.c +++ b/format.c @@ -352,7 +352,11 @@ format_winlink(struct format_tree *ft, struct session *s, struct winlink *wl) struct window *w = wl->window; char *layout, *flags; +#ifdef TMATE_SLAVE + layout = xstrdup("no layout"); +#else layout = layout_dump(w); +#endif flags = window_printable_flags(s, wl); format_add(ft, "window_id", "@%u", w->id); diff --git a/layout-custom.c b/layout-custom.c index e32d9d9d..4357907f 100644 --- a/layout-custom.c +++ b/layout-custom.c @@ -23,6 +23,8 @@ #include "tmux.h" +#ifndef TMATE_SLAVE + struct layout_cell *layout_find_bottomright(struct layout_cell *); u_short layout_checksum(const char *); int layout_append(struct layout_cell *, char *, size_t); @@ -289,3 +291,5 @@ fail: layout_free_cell(lc); return (NULL); } + +#endif diff --git a/layout-set.c b/layout-set.c index 646528ba..a66cc7b2 100644 --- a/layout-set.c +++ b/layout-set.c @@ -22,6 +22,8 @@ #include "tmux.h" +#ifndef TMATE_SLAVE + /* * Set window layouts - predefined methods to arrange windows. These are one-off * and generate a layout tree. @@ -567,3 +569,4 @@ layout_set_tiled(struct window *w) server_redraw_window(w); } +#endif diff --git a/layout.c b/layout.c index b74bd789..b5f8c5ac 100644 --- a/layout.c +++ b/layout.c @@ -22,6 +22,8 @@ #include "tmux.h" +#ifndef TMATE_SLAVE + /* * The window layout is a tree of cells each of which can be one of: a * left-right container for a list of cells, a top-bottom container for a list @@ -782,3 +784,5 @@ layout_close_pane(struct window_pane *wp) } notify_window_layout_changed(wp->window); } + +#endif diff --git a/resize.c b/resize.c index 07861081..326a2679 100644 --- a/resize.c +++ b/resize.c @@ -140,7 +140,9 @@ recalculate_sizes(void) is_zoomed = w->flags & WINDOW_ZOOMED; if (is_zoomed) window_unzoom(w); +#ifndef TMATE_SLAVE layout_resize(w, ssx, ssy); +#endif window_resize(w, ssx, ssy); if (is_zoomed && window_pane_visible(w->active)) window_zoom(w->active); diff --git a/server-fn.c b/server-fn.c index 6c51989d..dc6eb7d1 100644 --- a/server-fn.c +++ b/server-fn.c @@ -380,7 +380,9 @@ server_destroy_pane(struct window_pane *wp) #endif server_unzoom_window(w); +#ifndef TMATE_SLAVE layout_close_pane(wp); +#endif window_remove_pane(w, wp); if (TAILQ_EMPTY(&w->panes)) diff --git a/tmate-decoder.c b/tmate-decoder.c index 87f9a2a0..d2007270 100644 --- a/tmate-decoder.c +++ b/tmate-decoder.c @@ -152,10 +152,8 @@ static void tmate_sync_window_panes(struct window *w, } TAILQ_FOREACH_SAFE(wp, &w->panes, entry, wp_tmp) { - if (wp->flags & PANE_KILL) { - layout_close_pane(wp); + if (wp->flags & PANE_KILL) window_remove_pane(w, wp); - } } active_pane_id = unpack_int(w_uk); diff --git a/tmux.h b/tmux.h index daeb3445..e86b9bd5 100644 --- a/tmux.h +++ b/tmux.h @@ -930,8 +930,10 @@ struct window_pane { struct window *window; +#ifndef TMATE_SLAVE struct layout_cell *layout_cell; struct layout_cell *saved_layout_cell; +#endif u_int sx; u_int sy; @@ -1002,8 +1004,11 @@ struct window { struct window_panes panes; int lastlayout; + +#ifndef TMATE_SLAVE struct layout_cell *layout_root; struct layout_cell *saved_layout_root; +#endif u_int sx; u_int sy; diff --git a/window.c b/window.c index a8beaa28..1083ca6a 100644 --- a/window.c +++ b/window.c @@ -282,8 +282,10 @@ window_create1(u_int sx, u_int sy) TAILQ_INIT(&w->panes); w->active = NULL; +#ifndef TMATE_SLAVE w->lastlayout = -1; w->layout_root = NULL; +#endif w->sx = sx; w->sy = sy; @@ -315,7 +317,9 @@ window_create(const char *name, const char *cmd, const char *shell, w = window_create1(sx, sy); wp = window_add_pane(w, hlimit); +#ifndef TMATE_SLAVE layout_init(w, wp); +#endif if (window_pane_spawn(wp, cmd, shell, cwd, env, tio, cause) != 0) { window_destroy(w); @@ -345,8 +349,10 @@ window_destroy(struct window *w) while (!ARRAY_EMPTY(&windows) && ARRAY_LAST(&windows) == NULL) ARRAY_TRUNC(&windows, 1); +#ifndef TMATE_SLAVE if (w->layout_root != NULL) layout_free(w); +#endif if (event_initialized(&w->name_timer)) evtimer_del(&w->name_timer); @@ -479,6 +485,7 @@ window_zoom(struct window_pane *wp) if (w->active != wp) window_set_active_pane(w, wp); +#ifndef TMATE_SLAVE TAILQ_FOREACH(wp1, &w->panes, entry) { wp1->saved_layout_cell = wp1->layout_cell; wp1->layout_cell = NULL; @@ -486,6 +493,7 @@ window_zoom(struct window_pane *wp) w->saved_layout_root = w->layout_root; layout_init(w, wp); +#endif w->flags |= WINDOW_ZOOMED; return (0); @@ -500,6 +508,8 @@ window_unzoom(struct window *w) return (-1); w->flags &= ~WINDOW_ZOOMED; + +#ifndef TMATE_SLAVE layout_free(w); w->layout_root = w->saved_layout_root; @@ -508,6 +518,7 @@ window_unzoom(struct window *w) wp->saved_layout_cell = NULL; } layout_fix_panes(w, w->sx, w->sy); +#endif return (0); } @@ -684,7 +695,9 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit) wp->mode = NULL; +#ifndef TMATE_SLAVE wp->layout_cell = NULL; +#endif wp->xoff = 0; wp->yoff = 0;