GUAC-1389: Redraw / resync terminal contents.
This commit is contained in:
parent
60dec61c51
commit
a14e0fa3fb
@ -845,6 +845,18 @@ void guac_terminal_display_flush(guac_terminal_display* display) {
|
||||
|
||||
}
|
||||
|
||||
void guac_terminal_display_dup(guac_terminal_display* display, guac_user* user,
|
||||
guac_socket* socket) {
|
||||
|
||||
/* Create default surface */
|
||||
guac_common_surface_dup(display->display_surface, user, socket);
|
||||
|
||||
/* Select layer is a child of the display layer */
|
||||
guac_protocol_send_move(socket, display->select_layer,
|
||||
display->display_layer, 0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
void guac_terminal_display_commit_select(guac_terminal_display* display) {
|
||||
display->selection_committed = true;
|
||||
}
|
||||
|
@ -333,6 +333,23 @@ void guac_terminal_display_resize(guac_terminal_display* display, int width, int
|
||||
*/
|
||||
void guac_terminal_display_flush(guac_terminal_display* display);
|
||||
|
||||
/**
|
||||
* Initializes and syncs the current terminal display state for the given user
|
||||
* that has just joined the connection, sending the necessary instructions to
|
||||
* completely recreate and redraw the terminal rendering over the given socket.
|
||||
*
|
||||
* @param display
|
||||
* The terminal display to sync to the given user.
|
||||
*
|
||||
* @param user
|
||||
* The user that has just joined the connection.
|
||||
*
|
||||
* @param socket
|
||||
* The socket over which any necessary instructions should be sent.
|
||||
*/
|
||||
void guac_terminal_display_dup(guac_terminal_display* display, guac_user* user,
|
||||
guac_socket* socket);
|
||||
|
||||
/**
|
||||
* Draws the text selection rectangle from the given coordinates to the given end coordinates.
|
||||
*/
|
||||
|
@ -200,6 +200,10 @@ void guac_terminal_reset(guac_terminal* term) {
|
||||
* @param terminal
|
||||
* The terminal whose background should be painted or repainted.
|
||||
*
|
||||
* @param socket
|
||||
* The socket over which instructions required to paint / repaint the
|
||||
* terminal background should be send.
|
||||
*
|
||||
* @param width
|
||||
* The width of the background to draw, in pixels.
|
||||
*
|
||||
@ -207,11 +211,9 @@ void guac_terminal_reset(guac_terminal* term) {
|
||||
* The height of the background to draw, in pixels.
|
||||
*/
|
||||
static void guac_terminal_paint_background(guac_terminal* terminal,
|
||||
int width, int height) {
|
||||
guac_socket* socket, int width, int height) {
|
||||
|
||||
guac_terminal_display* display = terminal->term_display;
|
||||
guac_client* client = display->client;
|
||||
guac_socket* socket = client->socket;
|
||||
|
||||
/* Get background color */
|
||||
const guac_terminal_color* color =
|
||||
@ -371,7 +373,7 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
||||
pthread_mutex_init(&(term->lock), NULL);
|
||||
|
||||
/* Size display */
|
||||
guac_terminal_paint_background(term, width, height);
|
||||
guac_terminal_paint_background(term, client->socket, width, height);
|
||||
guac_terminal_display_resize(term->term_display,
|
||||
term->term_width, term->term_height);
|
||||
|
||||
@ -1369,7 +1371,7 @@ int guac_terminal_resize(guac_terminal* terminal, int width, int height) {
|
||||
|
||||
/* Resize default layer to given pixel dimensions */
|
||||
guac_common_surface_resize(terminal->display->default_surface, width, height);
|
||||
guac_terminal_paint_background(terminal, width, height);
|
||||
guac_terminal_paint_background(terminal, client->socket, width, height);
|
||||
|
||||
/* Notify scrollbar of resize */
|
||||
guac_terminal_scrollbar_parent_resized(terminal->scrollbar, width, height, rows);
|
||||
@ -1910,7 +1912,13 @@ void guac_terminal_add_user(guac_terminal* term, guac_user* user,
|
||||
|
||||
/* Synchronize display state with new user */
|
||||
guac_common_display_dup(term->display, user, socket);
|
||||
guac_terminal_display_dup(term->term_display, user, socket);
|
||||
guac_terminal_scrollbar_dup(term->scrollbar, user, socket);
|
||||
|
||||
/* Paint background for joining user */
|
||||
guac_common_surface* default_surface = term->display->default_surface;
|
||||
guac_terminal_paint_background(term, socket, default_surface->width,
|
||||
default_surface->height);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user