mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Removing all the layout crap, too lazy to fix properly.
At least we get smaller binaries :)
This commit is contained in:
parent
4037b4666b
commit
e8ca45b088
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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();
|
||||
|
4
format.c
4
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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
4
layout.c
4
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
|
||||
|
2
resize.c
2
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);
|
||||
|
@ -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))
|
||||
|
@ -152,11 +152,9 @@ 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);
|
||||
wp = window_pane_find_by_id(active_pane_id);
|
||||
|
5
tmux.h
5
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;
|
||||
|
13
window.c
13
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user