GUACAMOLE-597: Add flag for forcing automatic flushing of pipe stream.

This commit is contained in:
Michael Jumper 2018-07-01 22:45:01 -07:00
parent 99b17b0ac4
commit e66178ff9a
2 changed files with 14 additions and 0 deletions

View File

@ -1551,6 +1551,10 @@ void guac_terminal_flush(guac_terminal* terminal) {
if (terminal->typescript != NULL) if (terminal->typescript != NULL)
guac_terminal_typescript_flush(terminal->typescript); guac_terminal_typescript_flush(terminal->typescript);
/* Flush pipe stream if automatic flushing is enabled */
if (terminal->pipe_stream_flags & GUAC_TERMINAL_PIPE_AUTOFLUSH)
guac_terminal_pipe_stream_flush(terminal);
/* Flush display state */ /* Flush display state */
guac_terminal_select_redraw(terminal); guac_terminal_select_redraw(terminal);
guac_terminal_commit_cursor(terminal); guac_terminal_commit_cursor(terminal);

View File

@ -105,6 +105,14 @@
*/ */
#define GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT 1 #define GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT 1
/**
* Flag which forces the open pipe stream to be flushed automatically, whenever
* a new frame would be rendered, with only minimal buffering performed between
* frames. By default, the contents of the pipe stream will be flushed only
* when the buffer is full or the pipe stream is being closed.
*/
#define GUAC_TERMINAL_PIPE_AUTOFLUSH 2
typedef struct guac_terminal guac_terminal; typedef struct guac_terminal guac_terminal;
/** /**
@ -228,6 +236,7 @@ struct guac_terminal {
* are undefined. * are undefined.
* *
* @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT * @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
* @see GUAC_TERMINAL_PIPE_AUTOFLUSH
*/ */
int pipe_stream_flags; int pipe_stream_flags;
@ -942,6 +951,7 @@ int guac_terminal_next_tab(guac_terminal* term, int column);
* stream. * stream.
* *
* @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT * @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
* @see GUAC_TERMINAL_PIPE_AUTOFLUSH
*/ */
void guac_terminal_pipe_stream_open(guac_terminal* term, const char* name, void guac_terminal_pipe_stream_open(guac_terminal* term, const char* name,
int flags); int flags);