diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2018-08-20 15:22:14 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2018-08-20 15:22:14 +0100 |
commit | 641191ab2047d1437d46dc0ae787346b74fddca5 (patch) | |
tree | 21844a1ed3a4b3bc987f8d967457d74f10c888d5 /tmux.h | |
parent | bf03197e185b8f274fa6681fbaf6d4237c2bfe4f (diff) | |
download | rtmux-641191ab2047d1437d46dc0ae787346b74fddca5.tar.gz rtmux-641191ab2047d1437d46dc0ae787346b74fddca5.tar.bz2 rtmux-641191ab2047d1437d46dc0ae787346b74fddca5.zip |
Support for windows larger than the client.
This adds two new options, window-size and default-size, and a new
command, resize-window.
The force-width and force-height options, and the session_width and
session_height formats have been removed.
The new window-size option tells tmux how to work out the size of
windows: largest means it picks the size of the largest session,
smallest the smallest session (similar to the old behaviour) and
manual means that it does not automatically resize
windows. aggressive-resize modifies the choice of session for largest
and smallest as it did before.
If a window is in a session attached to a client that is too small,
only part of the window is shown. tmux attempts to keep the cursor
visible, so the part of the window displayed is changed as the cursor
moves (with a small delay, to try and avoid excess redrawing when
applications redraw status lines or similar that are not currently
visible).
Drawing windows which are larger than the client is not as efficient
as those which fit, particularly when the cursor moves, so it is
recommended to avoid using this on slow machines or networks (set
window-size to smallest or manual).
The resize-window command can be used to resize a window manually. If
it is used, the window-size option is automatically set to manual for
the window (undo this with "setw -u window-size"). resize-window works
in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has
-a and -A flags. -a sets the window to the size of the smallest client
(what it would be if window-size was smallest) and -A the largest.
For the same behaviour as force-width or force-height, use
resize-width -x or -y.
If the global window-size option is set to manual, the default-size
option is used for new windows. If -x or -y is used with new-session,
that sets the default-size option for the new session.
The maximum size of a window is 10000x10000. But expect applications
to complain and higher memory use if you make a window that big. The
minimum size is the size required for the current layout including
borders.
This change allows some code improvements, most notably that since
windows can now never be cropped, that code can be removed from the
layout code, and since panes can now never be outside the size of the
window, window_pane_visible can be removed.
Diffstat (limited to 'tmux.h')
-rw-r--r-- | tmux.h | 53 |
1 files changed, 40 insertions, 13 deletions
@@ -68,6 +68,10 @@ struct tmuxproc; */ #define PANE_MINIMUM 2 +/* Minimum and maximum window size. */ +#define WINDOW_MINIMUM PANE_MINIMUM +#define WINDOW_MAXIMUM 10000 + /* Automatic name refresh interval, in microseconds. Must be < 1 second. */ #define NAME_INTERVAL 500000 @@ -809,6 +813,7 @@ struct window { struct timeval name_time; struct event alerts_timer; + struct event offset_timer; struct timeval activity_time; @@ -829,9 +834,7 @@ struct window { #define WINDOW_ACTIVITY 0x2 #define WINDOW_SILENCE 0x4 #define WINDOW_ZOOMED 0x8 -#define WINDOW_FORCEWIDTH 0x10 -#define WINDOW_FORCEHEIGHT 0x20 -#define WINDOW_STYLECHANGED 0x40 +#define WINDOW_STYLECHANGED 0x10 #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE) int alerts_queued; @@ -872,6 +875,11 @@ struct winlink { RB_HEAD(winlinks, winlink); TAILQ_HEAD(winlink_stack, winlink); +/* Window size option. */ +#define WINDOW_SIZE_LARGEST 0 +#define WINDOW_SIZE_SMALLEST 1 +#define WINDOW_SIZE_MANUAL 2 + /* Layout direction. */ enum layout_type { LAYOUT_LEFTRIGHT, @@ -930,9 +938,6 @@ struct session { struct event lock_timer; - u_int sx; - u_int sy; - struct winlink *curw; struct winlink_stack lastw; struct winlinks windows; @@ -992,6 +997,9 @@ struct mouse_event { u_int ly; u_int lb; + u_int ox; + u_int oy; + int s; int w; int wp; @@ -1039,6 +1047,12 @@ struct tty { u_int cstyle; char *ccolour; + int oflag; + u_int oox; + u_int ooy; + u_int osx; + u_int osy; + int mode; u_int rlower; @@ -1119,11 +1133,19 @@ struct tty_ctx { u_int orupper; u_int orlower; + /* Pane offset. */ u_int xoff; u_int yoff; /* The background colour used for clearing (erasing). */ u_int bg; + + /* Window offset and size. */ + int bigger; + u_int ox; + u_int oy; + u_int sx; + u_int sy; }; /* Saved message entry. */ @@ -1456,6 +1478,7 @@ struct options_table_entry { const char *separator; const char *style; + const char *pattern; }; /* Common command usages. */ @@ -1647,7 +1670,11 @@ struct environ *environ_for_session(struct session *, int); /* tty.c */ void tty_create_log(void); -u_int tty_status_lines(struct client *); +int tty_window_bigger(struct tty *); +int tty_window_offset(struct tty *, u_int *, u_int *, u_int *, u_int *); +void tty_update_window_offset(struct window *); +void tty_update_client_offset(struct client *); +u_int tty_status_lines(struct tty *); void tty_raw(struct tty *, const char *); void tty_attributes(struct tty *, const struct grid_cell *, const struct window_pane *); @@ -1672,10 +1699,8 @@ void tty_start_tty(struct tty *); void tty_stop_tty(struct tty *); void tty_set_title(struct tty *, const char *); void tty_update_mode(struct tty *, int, struct screen *); -void tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int, - u_int); void tty_draw_line(struct tty *, const struct window_pane *, struct screen *, - u_int, u_int, u_int); + u_int, u_int, u_int, u_int, u_int); int tty_open(struct tty *, char **); void tty_close(struct tty *); void tty_free(struct tty *); @@ -1926,6 +1951,9 @@ void status_prompt_load_history(void); void status_prompt_save_history(void); /* resize.c */ +void resize_window(struct window *, u_int, u_int); +void default_window_size(struct session *, struct window *, u_int *, + u_int *, int); void recalculate_sizes(void); /* input.c */ @@ -2156,7 +2184,6 @@ int window_pane_set_mode(struct window_pane *, void window_pane_reset_mode(struct window_pane *); void window_pane_key(struct window_pane *, struct client *, struct session *, key_code, struct mouse_event *); -int window_pane_visible(struct window_pane *); u_int window_pane_search(struct window_pane *, const char *); const char *window_printable_flags(struct winlink *); struct window_pane *window_pane_find_up(struct window_pane *); @@ -2184,7 +2211,7 @@ void layout_set_size(struct layout_cell *, u_int, u_int, u_int, void layout_make_leaf(struct layout_cell *, struct window_pane *); void layout_make_node(struct layout_cell *, enum layout_type); void layout_fix_offsets(struct layout_cell *); -void layout_fix_panes(struct window *, u_int, u_int); +void layout_fix_panes(struct window *); void layout_resize_adjust(struct window *, struct layout_cell *, enum layout_type, int); void layout_init(struct window *, struct window_pane *); @@ -2300,7 +2327,7 @@ struct session *session_find_by_id_str(const char *); struct session *session_find_by_id(u_int); struct session *session_create(const char *, const char *, int, char **, const char *, const char *, struct environ *, - struct termios *, int, u_int, u_int, char **); + struct options *, struct termios *, int, char **); void session_destroy(struct session *, const char *); void session_add_ref(struct session *, const char *); void session_remove_ref(struct session *, const char *); |