Rename delta to display.
This commit is contained in:
parent
396bba6ea3
commit
32e6a07f59
@ -44,7 +44,7 @@ libguac_client_ssh_la_SOURCES = \
|
|||||||
src/blank.c \
|
src/blank.c \
|
||||||
src/buffer.c \
|
src/buffer.c \
|
||||||
src/cursor.c \
|
src/cursor.c \
|
||||||
src/delta.c \
|
src/display.c \
|
||||||
src/ibar.c \
|
src/ibar.c \
|
||||||
src/ssh_client.c \
|
src/ssh_client.c \
|
||||||
src/ssh_handlers.c \
|
src/ssh_handlers.c \
|
||||||
@ -55,7 +55,7 @@ noinst_HEADERS = \
|
|||||||
include/blank.h \
|
include/blank.h \
|
||||||
include/buffer.h \
|
include/buffer.h \
|
||||||
include/cursor.h \
|
include/cursor.h \
|
||||||
include/delta.h \
|
include/display.h \
|
||||||
include/ibar.h \
|
include/ibar.h \
|
||||||
include/ssh_client.h \
|
include/ssh_client.h \
|
||||||
include/ssh_handlers.h \
|
include/ssh_handlers.h \
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#ifndef _SSH_GUAC_DELTA_H
|
#ifndef _SSH_GUAC_DISPLAY_H
|
||||||
#define _SSH_GUAC_DELTA_H
|
#define _SSH_GUAC_DISPLAY_H
|
||||||
|
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
#include <guacamole/client.h>
|
#include <guacamole/client.h>
|
||||||
@ -105,10 +105,10 @@ typedef struct guac_terminal_operation {
|
|||||||
/**
|
/**
|
||||||
* Set of all pending operations for the currently-visible screen area.
|
* Set of all pending operations for the currently-visible screen area.
|
||||||
*/
|
*/
|
||||||
typedef struct guac_terminal_delta {
|
typedef struct guac_terminal_display {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Guacamole client this delta will use for rendering.
|
* The Guacamole client this display will use for rendering.
|
||||||
*/
|
*/
|
||||||
guac_client* client;
|
guac_client* client;
|
||||||
|
|
||||||
@ -180,49 +180,49 @@ typedef struct guac_terminal_delta {
|
|||||||
*/
|
*/
|
||||||
guac_layer* filled_glyphs;
|
guac_layer* filled_glyphs;
|
||||||
|
|
||||||
} guac_terminal_delta;
|
} guac_terminal_display;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates a new delta having the given dimensions.
|
* Allocates a new display having the given dimensions.
|
||||||
*/
|
*/
|
||||||
guac_terminal_delta* guac_terminal_delta_alloc(guac_client* client, int width, int height,
|
guac_terminal_display* guac_terminal_display_alloc(guac_client* client, int width, int height,
|
||||||
int foreground, int background);
|
int foreground, int background);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frees the given delta.
|
* Frees the given display.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_delta_free(guac_terminal_delta* delta);
|
void guac_terminal_display_free(guac_terminal_display* display);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the given range of columns to a new location, offset from
|
* Copies the given range of columns to a new location, offset from
|
||||||
* the original by the given number of columns.
|
* the original by the given number of columns.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_delta_copy_columns(guac_terminal_delta* delta, int row,
|
void guac_terminal_display_copy_columns(guac_terminal_display* display, int row,
|
||||||
int start_column, int end_column, int offset);
|
int start_column, int end_column, int offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the given range of rows to a new location, offset from the
|
* Copies the given range of rows to a new location, offset from the
|
||||||
* original by the given number of rows.
|
* original by the given number of rows.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_delta_copy_rows(guac_terminal_delta* delta, int src_row, int rows,
|
void guac_terminal_display_copy_rows(guac_terminal_display* display, int src_row, int rows,
|
||||||
int start_row, int end_row, int offset);
|
int start_row, int end_row, int offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given range of columns within the given row to the given
|
* Sets the given range of columns within the given row to the given
|
||||||
* character.
|
* character.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_delta_set_columns(guac_terminal_delta* delta, int row,
|
void guac_terminal_display_set_columns(guac_terminal_display* display, int row,
|
||||||
int start_column, int end_column, guac_terminal_char* character);
|
int start_column, int end_column, guac_terminal_char* character);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resize the terminal to the given dimensions.
|
* Resize the terminal to the given dimensions.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_delta_resize(guac_terminal_delta* delta, int rows, int cols);
|
void guac_terminal_display_resize(guac_terminal_display* display, int rows, int cols);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flushes all pending operations within the given guac_terminal_delta.
|
* Flushes all pending operations within the given guac_terminal_display.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_delta_flush(guac_terminal_delta* delta);
|
void guac_terminal_display_flush(guac_terminal_display* display);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -44,7 +44,7 @@
|
|||||||
#include <guacamole/client.h>
|
#include <guacamole/client.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "delta.h"
|
#include "display.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
|
||||||
#define GUAC_SSH_WHEEL_SCROLL_AMOUNT 3
|
#define GUAC_SSH_WHEEL_SCROLL_AMOUNT 3
|
||||||
@ -133,11 +133,11 @@ struct guac_terminal {
|
|||||||
* The difference between the currently-rendered screen and the current
|
* The difference between the currently-rendered screen and the current
|
||||||
* state of the terminal.
|
* state of the terminal.
|
||||||
*/
|
*/
|
||||||
guac_terminal_delta* delta;
|
guac_terminal_display* display;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current terminal display state. All characters present on the screen
|
* Current terminal display state. All characters present on the screen
|
||||||
* are within this buffer. This has nothing to do with the delta, which
|
* are within this buffer. This has nothing to do with the display, which
|
||||||
* facilitates transfer of a set of changes to the remote display.
|
* facilitates transfer of a set of changes to the remote display.
|
||||||
*/
|
*/
|
||||||
guac_terminal_buffer* buffer;
|
guac_terminal_buffer* buffer;
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include <guacamole/protocol.h>
|
#include <guacamole/protocol.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "delta.h"
|
#include "display.h"
|
||||||
|
|
||||||
const guac_terminal_color guac_terminal_palette[16] = {
|
const guac_terminal_color guac_terminal_palette[16] = {
|
||||||
|
|
||||||
@ -73,18 +73,18 @@ const guac_terminal_color guac_terminal_palette[16] = {
|
|||||||
* and thus must be multiplied by the glyph width to obtain the actual
|
* and thus must be multiplied by the glyph width to obtain the actual
|
||||||
* location within the glyph cache layer.
|
* location within the glyph cache layer.
|
||||||
*/
|
*/
|
||||||
int __guac_terminal_get_glyph(guac_terminal_delta* delta, char c) {
|
int __guac_terminal_get_glyph(guac_terminal_display* display, char c) {
|
||||||
|
|
||||||
guac_socket* socket = delta->client->socket;
|
guac_socket* socket = display->client->socket;
|
||||||
int location;
|
int location;
|
||||||
|
|
||||||
/* Use foreground color */
|
/* Use foreground color */
|
||||||
const guac_terminal_color* color =
|
const guac_terminal_color* color =
|
||||||
&guac_terminal_palette[delta->glyph_foreground];
|
&guac_terminal_palette[display->glyph_foreground];
|
||||||
|
|
||||||
/* Use background color */
|
/* Use background color */
|
||||||
const guac_terminal_color* background =
|
const guac_terminal_color* background =
|
||||||
&guac_terminal_palette[delta->glyph_background];
|
&guac_terminal_palette[display->glyph_background];
|
||||||
|
|
||||||
cairo_surface_t* surface;
|
cairo_surface_t* surface;
|
||||||
cairo_t* cairo;
|
cairo_t* cairo;
|
||||||
@ -92,20 +92,20 @@ int __guac_terminal_get_glyph(guac_terminal_delta* delta, char c) {
|
|||||||
PangoLayout* layout;
|
PangoLayout* layout;
|
||||||
|
|
||||||
/* Return glyph if exists */
|
/* Return glyph if exists */
|
||||||
if (delta->glyphs[(int) c])
|
if (display->glyphs[(int) c])
|
||||||
return delta->glyphs[(int) c] - 1;
|
return display->glyphs[(int) c] - 1;
|
||||||
|
|
||||||
location = delta->next_glyph++;
|
location = display->next_glyph++;
|
||||||
|
|
||||||
/* Otherwise, draw glyph */
|
/* Otherwise, draw glyph */
|
||||||
surface = cairo_image_surface_create(
|
surface = cairo_image_surface_create(
|
||||||
CAIRO_FORMAT_ARGB32,
|
CAIRO_FORMAT_ARGB32,
|
||||||
delta->char_width, delta->char_height);
|
display->char_width, display->char_height);
|
||||||
cairo = cairo_create(surface);
|
cairo = cairo_create(surface);
|
||||||
|
|
||||||
/* Get layout */
|
/* Get layout */
|
||||||
layout = pango_cairo_create_layout(cairo);
|
layout = pango_cairo_create_layout(cairo);
|
||||||
pango_layout_set_font_description(layout, delta->font_desc);
|
pango_layout_set_font_description(layout, display->font_desc);
|
||||||
pango_layout_set_text(layout, &c, 1);
|
pango_layout_set_text(layout, &c, 1);
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
@ -123,23 +123,23 @@ int __guac_terminal_get_glyph(guac_terminal_delta* delta, char c) {
|
|||||||
cairo_destroy(cairo);
|
cairo_destroy(cairo);
|
||||||
|
|
||||||
/* Send glyph and update filled flyphs */
|
/* Send glyph and update filled flyphs */
|
||||||
guac_protocol_send_png(socket, GUAC_COMP_OVER, delta->glyph_stroke, location * delta->char_width, 0, surface);
|
guac_protocol_send_png(socket, GUAC_COMP_OVER, display->glyph_stroke, location * display->char_width, 0, surface);
|
||||||
|
|
||||||
guac_protocol_send_rect(socket, delta->filled_glyphs,
|
guac_protocol_send_rect(socket, display->filled_glyphs,
|
||||||
location * delta->char_width, 0,
|
location * display->char_width, 0,
|
||||||
delta->char_width, delta->char_height);
|
display->char_width, display->char_height);
|
||||||
|
|
||||||
guac_protocol_send_cfill(socket, GUAC_COMP_OVER, delta->filled_glyphs,
|
guac_protocol_send_cfill(socket, GUAC_COMP_OVER, display->filled_glyphs,
|
||||||
background->red,
|
background->red,
|
||||||
background->green,
|
background->green,
|
||||||
background->blue,
|
background->blue,
|
||||||
0xFF);
|
0xFF);
|
||||||
|
|
||||||
guac_protocol_send_copy(socket, delta->glyph_stroke,
|
guac_protocol_send_copy(socket, display->glyph_stroke,
|
||||||
location * delta->char_width, 0, delta->char_width, delta->char_height,
|
location * display->char_width, 0, display->char_width, display->char_height,
|
||||||
GUAC_COMP_OVER, delta->filled_glyphs, location * delta->char_width, 0);
|
GUAC_COMP_OVER, display->filled_glyphs, location * display->char_width, 0);
|
||||||
|
|
||||||
delta->glyphs[(int) c] = location+1;
|
display->glyphs[(int) c] = location+1;
|
||||||
|
|
||||||
cairo_surface_destroy(surface);
|
cairo_surface_destroy(surface);
|
||||||
|
|
||||||
@ -152,10 +152,10 @@ int __guac_terminal_get_glyph(guac_terminal_delta* delta, char c) {
|
|||||||
* Sets the attributes of the glyph cache layer such that future copies from
|
* Sets the attributes of the glyph cache layer such that future copies from
|
||||||
* this layer will display as expected.
|
* this layer will display as expected.
|
||||||
*/
|
*/
|
||||||
int __guac_terminal_set_colors(guac_terminal_delta* delta,
|
int __guac_terminal_set_colors(guac_terminal_display* display,
|
||||||
guac_terminal_attributes* attributes) {
|
guac_terminal_attributes* attributes) {
|
||||||
|
|
||||||
guac_socket* socket = delta->client->socket;
|
guac_socket* socket = display->client->socket;
|
||||||
const guac_terminal_color* background_color;
|
const guac_terminal_color* background_color;
|
||||||
int background, foreground;
|
int background, foreground;
|
||||||
|
|
||||||
@ -177,18 +177,18 @@ int __guac_terminal_set_colors(guac_terminal_delta* delta,
|
|||||||
background_color = &guac_terminal_palette[background];
|
background_color = &guac_terminal_palette[background];
|
||||||
|
|
||||||
/* If foreground different from current, colorize */
|
/* If foreground different from current, colorize */
|
||||||
if (foreground != delta->glyph_foreground) {
|
if (foreground != display->glyph_foreground) {
|
||||||
|
|
||||||
/* Get color */
|
/* Get color */
|
||||||
const guac_terminal_color* color =
|
const guac_terminal_color* color =
|
||||||
&guac_terminal_palette[foreground];
|
&guac_terminal_palette[foreground];
|
||||||
|
|
||||||
/* Colorize letter */
|
/* Colorize letter */
|
||||||
guac_protocol_send_rect(socket, delta->glyph_stroke,
|
guac_protocol_send_rect(socket, display->glyph_stroke,
|
||||||
0, 0,
|
0, 0,
|
||||||
delta->char_width * delta->next_glyph, delta->char_height);
|
display->char_width * display->next_glyph, display->char_height);
|
||||||
|
|
||||||
guac_protocol_send_cfill(socket, GUAC_COMP_ATOP, delta->glyph_stroke,
|
guac_protocol_send_cfill(socket, GUAC_COMP_ATOP, display->glyph_stroke,
|
||||||
color->red,
|
color->red,
|
||||||
color->green,
|
color->green,
|
||||||
color->blue,
|
color->blue,
|
||||||
@ -197,33 +197,33 @@ int __guac_terminal_set_colors(guac_terminal_delta* delta,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If any color change at all, update filled */
|
/* If any color change at all, update filled */
|
||||||
if (foreground != delta->glyph_foreground
|
if (foreground != display->glyph_foreground
|
||||||
|| background != delta->glyph_background) {
|
|| background != display->glyph_background) {
|
||||||
|
|
||||||
/* Set background */
|
/* Set background */
|
||||||
guac_protocol_send_rect(socket, delta->filled_glyphs,
|
guac_protocol_send_rect(socket, display->filled_glyphs,
|
||||||
0, 0,
|
0, 0,
|
||||||
delta->char_width * delta->next_glyph, delta->char_height);
|
display->char_width * display->next_glyph, display->char_height);
|
||||||
|
|
||||||
guac_protocol_send_cfill(socket, GUAC_COMP_OVER, delta->filled_glyphs,
|
guac_protocol_send_cfill(socket, GUAC_COMP_OVER, display->filled_glyphs,
|
||||||
background_color->red,
|
background_color->red,
|
||||||
background_color->green,
|
background_color->green,
|
||||||
background_color->blue,
|
background_color->blue,
|
||||||
255);
|
255);
|
||||||
|
|
||||||
/* Copy stroke */
|
/* Copy stroke */
|
||||||
guac_protocol_send_copy(socket, delta->glyph_stroke,
|
guac_protocol_send_copy(socket, display->glyph_stroke,
|
||||||
|
|
||||||
0, 0,
|
0, 0,
|
||||||
delta->char_width * delta->next_glyph, delta->char_height,
|
display->char_width * display->next_glyph, display->char_height,
|
||||||
|
|
||||||
GUAC_COMP_OVER, delta->filled_glyphs,
|
GUAC_COMP_OVER, display->filled_glyphs,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delta->glyph_foreground = foreground;
|
display->glyph_foreground = foreground;
|
||||||
delta->glyph_background = background;
|
display->glyph_background = background;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -231,25 +231,25 @@ int __guac_terminal_set_colors(guac_terminal_delta* delta,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the given character to the terminal at the given row and column,
|
* Sends the given character to the terminal at the given row and column,
|
||||||
* rendering the charater immediately. This bypasses the guac_terminal_delta
|
* rendering the charater immediately. This bypasses the guac_terminal_display
|
||||||
* mechanism and is intended for flushing of updates only.
|
* mechanism and is intended for flushing of updates only.
|
||||||
*/
|
*/
|
||||||
int __guac_terminal_set(guac_terminal_delta* delta, int row, int col, char c) {
|
int __guac_terminal_set(guac_terminal_display* display, int row, int col, char c) {
|
||||||
|
|
||||||
guac_socket* socket = delta->client->socket;
|
guac_socket* socket = display->client->socket;
|
||||||
int location = __guac_terminal_get_glyph(delta, c);
|
int location = __guac_terminal_get_glyph(display, c);
|
||||||
|
|
||||||
return guac_protocol_send_copy(socket,
|
return guac_protocol_send_copy(socket,
|
||||||
delta->filled_glyphs,
|
display->filled_glyphs,
|
||||||
location * delta->char_width, 0, delta->char_width, delta->char_height,
|
location * display->char_width, 0, display->char_width, display->char_height,
|
||||||
GUAC_COMP_OVER, GUAC_DEFAULT_LAYER,
|
GUAC_COMP_OVER, GUAC_DEFAULT_LAYER,
|
||||||
delta->char_width * col,
|
display->char_width * col,
|
||||||
delta->char_height * row);
|
display->char_height * row);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
guac_terminal_delta* guac_terminal_delta_alloc(guac_client* client, int width, int height,
|
guac_terminal_display* guac_terminal_display_alloc(guac_client* client, int width, int height,
|
||||||
int foreground, int background) {
|
int foreground, int background) {
|
||||||
|
|
||||||
guac_terminal_operation* current;
|
guac_terminal_operation* current;
|
||||||
@ -260,55 +260,55 @@ guac_terminal_delta* guac_terminal_delta_alloc(guac_client* client, int width, i
|
|||||||
PangoFontMetrics* metrics;
|
PangoFontMetrics* metrics;
|
||||||
PangoContext* context;
|
PangoContext* context;
|
||||||
|
|
||||||
/* Allocate delta */
|
/* Allocate display */
|
||||||
guac_terminal_delta* delta = malloc(sizeof(guac_terminal_delta));
|
guac_terminal_display* display = malloc(sizeof(guac_terminal_display));
|
||||||
delta->client = client;
|
display->client = client;
|
||||||
|
|
||||||
memset(delta->glyphs, 0, sizeof(delta->glyphs));
|
memset(display->glyphs, 0, sizeof(display->glyphs));
|
||||||
delta->glyph_stroke = guac_client_alloc_buffer(client);
|
display->glyph_stroke = guac_client_alloc_buffer(client);
|
||||||
delta->filled_glyphs = guac_client_alloc_buffer(client);
|
display->filled_glyphs = guac_client_alloc_buffer(client);
|
||||||
|
|
||||||
/* Get font */
|
/* Get font */
|
||||||
delta->font_desc = pango_font_description_new();
|
display->font_desc = pango_font_description_new();
|
||||||
pango_font_description_set_family(delta->font_desc, "monospace");
|
pango_font_description_set_family(display->font_desc, "monospace");
|
||||||
pango_font_description_set_weight(delta->font_desc, PANGO_WEIGHT_NORMAL);
|
pango_font_description_set_weight(display->font_desc, PANGO_WEIGHT_NORMAL);
|
||||||
pango_font_description_set_size(delta->font_desc, 12*PANGO_SCALE);
|
pango_font_description_set_size(display->font_desc, 12*PANGO_SCALE);
|
||||||
|
|
||||||
font_map = pango_cairo_font_map_get_default();
|
font_map = pango_cairo_font_map_get_default();
|
||||||
context = pango_font_map_create_context(font_map);
|
context = pango_font_map_create_context(font_map);
|
||||||
|
|
||||||
font = pango_font_map_load_font(font_map, context, delta->font_desc);
|
font = pango_font_map_load_font(font_map, context, display->font_desc);
|
||||||
if (font == NULL) {
|
if (font == NULL) {
|
||||||
guac_client_log_error(delta->client, "Unable to get font.");
|
guac_client_log_error(display->client, "Unable to get font.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics = pango_font_get_metrics(font, NULL);
|
metrics = pango_font_get_metrics(font, NULL);
|
||||||
if (metrics == NULL) {
|
if (metrics == NULL) {
|
||||||
guac_client_log_error(delta->client, "Unable to get font metrics.");
|
guac_client_log_error(display->client, "Unable to get font metrics.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
delta->glyph_foreground = foreground;
|
display->glyph_foreground = foreground;
|
||||||
delta->glyph_background = background;
|
display->glyph_background = background;
|
||||||
|
|
||||||
/* Calculate character dimensions */
|
/* Calculate character dimensions */
|
||||||
delta->char_width =
|
display->char_width =
|
||||||
pango_font_metrics_get_approximate_digit_width(metrics) / PANGO_SCALE;
|
pango_font_metrics_get_approximate_digit_width(metrics) / PANGO_SCALE;
|
||||||
delta->char_height =
|
display->char_height =
|
||||||
(pango_font_metrics_get_descent(metrics)
|
(pango_font_metrics_get_descent(metrics)
|
||||||
+ pango_font_metrics_get_ascent(metrics)) / PANGO_SCALE;
|
+ pango_font_metrics_get_ascent(metrics)) / PANGO_SCALE;
|
||||||
|
|
||||||
/* Set width and height */
|
/* Set width and height */
|
||||||
delta->width = width;
|
display->width = width;
|
||||||
delta->height = height;
|
display->height = height;
|
||||||
|
|
||||||
/* Alloc operations */
|
/* Alloc operations */
|
||||||
delta->operations = malloc(width * height *
|
display->operations = malloc(width * height *
|
||||||
sizeof(guac_terminal_operation));
|
sizeof(guac_terminal_operation));
|
||||||
|
|
||||||
/* Init each operation buffer row */
|
/* Init each operation buffer row */
|
||||||
current = delta->operations;
|
current = display->operations;
|
||||||
for (y=0; y<height; y++) {
|
for (y=0; y<height; y++) {
|
||||||
|
|
||||||
/* Init entire row to NOP */
|
/* Init entire row to NOP */
|
||||||
@ -318,56 +318,56 @@ guac_terminal_delta* guac_terminal_delta_alloc(guac_client* client, int width, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Alloc scratch area */
|
/* Alloc scratch area */
|
||||||
delta->scratch = malloc(width * height * sizeof(guac_terminal_operation));
|
display->scratch = malloc(width * height * sizeof(guac_terminal_operation));
|
||||||
|
|
||||||
/* Send initial display size */
|
/* Send initial display size */
|
||||||
guac_protocol_send_size(client->socket,
|
guac_protocol_send_size(client->socket,
|
||||||
GUAC_DEFAULT_LAYER,
|
GUAC_DEFAULT_LAYER,
|
||||||
delta->char_width * width,
|
display->char_width * width,
|
||||||
delta->char_height * height);
|
display->char_height * height);
|
||||||
|
|
||||||
return delta;
|
return display;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_free(guac_terminal_delta* delta) {
|
void guac_terminal_display_free(guac_terminal_display* display) {
|
||||||
|
|
||||||
/* Free operations buffers */
|
/* Free operations buffers */
|
||||||
free(delta->operations);
|
free(display->operations);
|
||||||
free(delta->scratch);
|
free(display->scratch);
|
||||||
|
|
||||||
/* Free delta */
|
/* Free display */
|
||||||
free(delta);
|
free(display);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_copy_columns(guac_terminal_delta* delta, int row,
|
void guac_terminal_display_copy_columns(guac_terminal_display* display, int row,
|
||||||
int start_column, int end_column, int offset) {
|
int start_column, int end_column, int offset) {
|
||||||
/* STUB */
|
/* STUB */
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_copy_rows(guac_terminal_delta* delta, int src_row, int rows,
|
void guac_terminal_display_copy_rows(guac_terminal_display* display, int src_row, int rows,
|
||||||
int start_row, int end_row, int offset) {
|
int start_row, int end_row, int offset) {
|
||||||
/* STUB */
|
/* STUB */
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_set_columns(guac_terminal_delta* delta, int row,
|
void guac_terminal_display_set_columns(guac_terminal_display* display, int row,
|
||||||
int start_column, int end_column, guac_terminal_char* character) {
|
int start_column, int end_column, guac_terminal_char* character) {
|
||||||
/* STUB */
|
/* STUB */
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_resize(guac_terminal_delta* delta, int rows, int cols) {
|
void guac_terminal_display_resize(guac_terminal_display* display, int rows, int cols) {
|
||||||
/* STUB */
|
/* STUB */
|
||||||
}
|
}
|
||||||
|
|
||||||
void __guac_terminal_delta_flush_copy(guac_terminal_delta* delta) {
|
void __guac_terminal_display_flush_copy(guac_terminal_display* display) {
|
||||||
|
|
||||||
guac_terminal_operation* current = delta->operations;
|
guac_terminal_operation* current = display->operations;
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
/* For each operation */
|
/* For each operation */
|
||||||
for (row=0; row<delta->height; row++) {
|
for (row=0; row<display->height; row++) {
|
||||||
for (col=0; col<delta->width; col++) {
|
for (col=0; col<display->width; col++) {
|
||||||
|
|
||||||
/* If operation is a copy operation */
|
/* If operation is a copy operation */
|
||||||
if (current->type == GUAC_CHAR_COPY) {
|
if (current->type == GUAC_CHAR_COPY) {
|
||||||
@ -393,13 +393,13 @@ void __guac_terminal_delta_flush_copy(guac_terminal_delta* delta) {
|
|||||||
/* Determine bounds of rectangle */
|
/* Determine bounds of rectangle */
|
||||||
rect_current_row = current;
|
rect_current_row = current;
|
||||||
expected_row = current->row;
|
expected_row = current->row;
|
||||||
for (rect_row=row; rect_row<delta->height; rect_row++) {
|
for (rect_row=row; rect_row<display->height; rect_row++) {
|
||||||
|
|
||||||
guac_terminal_operation* rect_current = rect_current_row;
|
guac_terminal_operation* rect_current = rect_current_row;
|
||||||
expected_col = current->column;
|
expected_col = current->column;
|
||||||
|
|
||||||
/* Find width */
|
/* Find width */
|
||||||
for (rect_col=col; rect_col<delta->width; rect_col++) {
|
for (rect_col=col; rect_col<display->width; rect_col++) {
|
||||||
|
|
||||||
/* If not identical operation, stop */
|
/* If not identical operation, stop */
|
||||||
if (rect_current->type != GUAC_CHAR_COPY
|
if (rect_current->type != GUAC_CHAR_COPY
|
||||||
@ -425,7 +425,7 @@ void __guac_terminal_delta_flush_copy(guac_terminal_delta* delta) {
|
|||||||
detected_right = rect_col - 1;
|
detected_right = rect_col - 1;
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
rect_current_row += delta->width;
|
rect_current_row += display->width;
|
||||||
expected_row++;
|
expected_row++;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -457,24 +457,24 @@ void __guac_terminal_delta_flush_copy(guac_terminal_delta* delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
rect_current_row += delta->width;
|
rect_current_row += display->width;
|
||||||
expected_row++;
|
expected_row++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send copy */
|
/* Send copy */
|
||||||
guac_protocol_send_copy(delta->client->socket,
|
guac_protocol_send_copy(display->client->socket,
|
||||||
|
|
||||||
GUAC_DEFAULT_LAYER,
|
GUAC_DEFAULT_LAYER,
|
||||||
current->column * delta->char_width,
|
current->column * display->char_width,
|
||||||
current->row * delta->char_height,
|
current->row * display->char_height,
|
||||||
rect_width * delta->char_width,
|
rect_width * display->char_width,
|
||||||
rect_height * delta->char_height,
|
rect_height * display->char_height,
|
||||||
|
|
||||||
GUAC_COMP_OVER,
|
GUAC_COMP_OVER,
|
||||||
GUAC_DEFAULT_LAYER,
|
GUAC_DEFAULT_LAYER,
|
||||||
col * delta->char_width,
|
col * display->char_width,
|
||||||
row * delta->char_height);
|
row * display->char_height);
|
||||||
|
|
||||||
} /* end if copy operation */
|
} /* end if copy operation */
|
||||||
|
|
||||||
@ -486,14 +486,14 @@ void __guac_terminal_delta_flush_copy(guac_terminal_delta* delta) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __guac_terminal_delta_flush_clear(guac_terminal_delta* delta) {
|
void __guac_terminal_display_flush_clear(guac_terminal_display* display) {
|
||||||
|
|
||||||
guac_terminal_operation* current = delta->operations;
|
guac_terminal_operation* current = display->operations;
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
/* For each operation */
|
/* For each operation */
|
||||||
for (row=0; row<delta->height; row++) {
|
for (row=0; row<display->height; row++) {
|
||||||
for (col=0; col<delta->width; col++) {
|
for (col=0; col<display->width; col++) {
|
||||||
|
|
||||||
/* If operation is a cler operation (set to space) */
|
/* If operation is a cler operation (set to space) */
|
||||||
if (current->type == GUAC_CHAR_SET &&
|
if (current->type == GUAC_CHAR_SET &&
|
||||||
@ -525,12 +525,12 @@ void __guac_terminal_delta_flush_clear(guac_terminal_delta* delta) {
|
|||||||
|
|
||||||
/* Determine bounds of rectangle */
|
/* Determine bounds of rectangle */
|
||||||
rect_current_row = current;
|
rect_current_row = current;
|
||||||
for (rect_row=row; rect_row<delta->height; rect_row++) {
|
for (rect_row=row; rect_row<display->height; rect_row++) {
|
||||||
|
|
||||||
guac_terminal_operation* rect_current = rect_current_row;
|
guac_terminal_operation* rect_current = rect_current_row;
|
||||||
|
|
||||||
/* Find width */
|
/* Find width */
|
||||||
for (rect_col=col; rect_col<delta->width; rect_col++) {
|
for (rect_col=col; rect_col<display->width; rect_col++) {
|
||||||
|
|
||||||
int joining_color;
|
int joining_color;
|
||||||
if (rect_current->character.attributes.reverse)
|
if (rect_current->character.attributes.reverse)
|
||||||
@ -561,7 +561,7 @@ void __guac_terminal_delta_flush_clear(guac_terminal_delta* delta) {
|
|||||||
detected_right = rect_col - 1;
|
detected_right = rect_col - 1;
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
rect_current_row += delta->width;
|
rect_current_row += display->width;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,19 +595,19 @@ void __guac_terminal_delta_flush_clear(guac_terminal_delta* delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
rect_current_row += delta->width;
|
rect_current_row += display->width;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send rect */
|
/* Send rect */
|
||||||
guac_protocol_send_rect(delta->client->socket,
|
guac_protocol_send_rect(display->client->socket,
|
||||||
GUAC_DEFAULT_LAYER,
|
GUAC_DEFAULT_LAYER,
|
||||||
col * delta->char_width,
|
col * display->char_width,
|
||||||
row * delta->char_height,
|
row * display->char_height,
|
||||||
rect_width * delta->char_width,
|
rect_width * display->char_width,
|
||||||
rect_height * delta->char_height);
|
rect_height * display->char_height);
|
||||||
|
|
||||||
guac_protocol_send_cfill(delta->client->socket,
|
guac_protocol_send_cfill(display->client->socket,
|
||||||
GUAC_COMP_OVER,
|
GUAC_COMP_OVER,
|
||||||
GUAC_DEFAULT_LAYER,
|
GUAC_DEFAULT_LAYER,
|
||||||
guac_color->red, guac_color->green, guac_color->blue,
|
guac_color->red, guac_color->green, guac_color->blue,
|
||||||
@ -623,24 +623,24 @@ void __guac_terminal_delta_flush_clear(guac_terminal_delta* delta) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __guac_terminal_delta_flush_set(guac_terminal_delta* delta) {
|
void __guac_terminal_display_flush_set(guac_terminal_display* display) {
|
||||||
|
|
||||||
guac_terminal_operation* current = delta->operations;
|
guac_terminal_operation* current = display->operations;
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
/* For each operation */
|
/* For each operation */
|
||||||
for (row=0; row<delta->height; row++) {
|
for (row=0; row<display->height; row++) {
|
||||||
for (col=0; col<delta->width; col++) {
|
for (col=0; col<display->width; col++) {
|
||||||
|
|
||||||
/* Perform given operation */
|
/* Perform given operation */
|
||||||
if (current->type == GUAC_CHAR_SET) {
|
if (current->type == GUAC_CHAR_SET) {
|
||||||
|
|
||||||
/* Set attributes */
|
/* Set attributes */
|
||||||
__guac_terminal_set_colors(delta,
|
__guac_terminal_set_colors(display,
|
||||||
&(current->character.attributes));
|
&(current->character.attributes));
|
||||||
|
|
||||||
/* Send character */
|
/* Send character */
|
||||||
__guac_terminal_set(delta, row, col,
|
__guac_terminal_set(display, row, col,
|
||||||
current->character.value);
|
current->character.value);
|
||||||
|
|
||||||
/* Mark operation as handled */
|
/* Mark operation as handled */
|
||||||
@ -656,12 +656,12 @@ void __guac_terminal_delta_flush_set(guac_terminal_delta* delta) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_flush(guac_terminal_delta* delta) {
|
void guac_terminal_display_flush(guac_terminal_display* display) {
|
||||||
|
|
||||||
/* Flush operations, copies first, then clears, then sets. */
|
/* Flush operations, copies first, then clears, then sets. */
|
||||||
__guac_terminal_delta_flush_copy(delta);
|
__guac_terminal_display_flush_copy(display);
|
||||||
__guac_terminal_delta_flush_clear(delta);
|
__guac_terminal_display_flush_clear(display);
|
||||||
__guac_terminal_delta_flush_set(delta);
|
__guac_terminal_display_flush_set(display);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -117,8 +117,8 @@ int ssh_guac_client_handle_messages(guac_client* client) {
|
|||||||
client_data->term->cursor_row,
|
client_data->term->cursor_row,
|
||||||
client_data->term->cursor_col);
|
client_data->term->cursor_col);
|
||||||
|
|
||||||
/* Flush terminal delta */
|
/* Flush terminal display */
|
||||||
guac_terminal_delta_flush(client_data->term->delta);
|
guac_terminal_display_flush(client_data->term->display);
|
||||||
|
|
||||||
/* Unlock terminal access */
|
/* Unlock terminal access */
|
||||||
pthread_mutex_unlock(&(client_data->term->lock));
|
pthread_mutex_unlock(&(client_data->term->lock));
|
||||||
@ -186,8 +186,8 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
|
|||||||
/* Otherwise, just update */
|
/* Otherwise, just update */
|
||||||
else
|
else
|
||||||
guac_terminal_select_update(term,
|
guac_terminal_select_update(term,
|
||||||
y / term->delta->char_height - term->scroll_offset,
|
y / term->display->char_height - term->scroll_offset,
|
||||||
x / term->delta->char_width);
|
x / term->display->char_width);
|
||||||
|
|
||||||
pthread_mutex_unlock(&(term->lock));
|
pthread_mutex_unlock(&(term->lock));
|
||||||
}
|
}
|
||||||
@ -197,8 +197,8 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
|
|||||||
pthread_mutex_lock(&(term->lock));
|
pthread_mutex_lock(&(term->lock));
|
||||||
|
|
||||||
guac_terminal_select_start(term,
|
guac_terminal_select_start(term,
|
||||||
y / term->delta->char_height - term->scroll_offset,
|
y / term->display->char_height - term->scroll_offset,
|
||||||
x / term->delta->char_width);
|
x / term->display->char_width);
|
||||||
|
|
||||||
pthread_mutex_unlock(&(term->lock));
|
pthread_mutex_unlock(&(term->lock));
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "delta.h"
|
#include "display.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "terminal_handlers.h"
|
#include "terminal_handlers.h"
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
|||||||
term->buffer = guac_terminal_buffer_alloc(1000);
|
term->buffer = guac_terminal_buffer_alloc(1000);
|
||||||
term->scroll_offset = 0;
|
term->scroll_offset = 0;
|
||||||
|
|
||||||
/* Init delta */
|
/* Init display */
|
||||||
term->delta = guac_terminal_delta_alloc(client,
|
term->display = guac_terminal_display_alloc(client,
|
||||||
term->term_width, term->term_height,
|
term->term_width, term->term_height,
|
||||||
default_attributes.foreground,
|
default_attributes.foreground,
|
||||||
default_attributes.background);
|
default_attributes.background);
|
||||||
@ -84,8 +84,8 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
|||||||
term->cursor_row = 0;
|
term->cursor_row = 0;
|
||||||
term->cursor_col = 0;
|
term->cursor_col = 0;
|
||||||
|
|
||||||
term->term_width = width / term->delta->char_width;
|
term->term_width = width / term->display->char_width;
|
||||||
term->term_height = height / term->delta->char_height;
|
term->term_height = height / term->display->char_height;
|
||||||
term->char_handler = guac_terminal_echo;
|
term->char_handler = guac_terminal_echo;
|
||||||
|
|
||||||
term->scroll_start = 0;
|
term->scroll_start = 0;
|
||||||
@ -106,8 +106,8 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
|||||||
|
|
||||||
void guac_terminal_free(guac_terminal* term) {
|
void guac_terminal_free(guac_terminal* term) {
|
||||||
|
|
||||||
/* Free delta */
|
/* Free display */
|
||||||
guac_terminal_delta_free(term->delta);
|
guac_terminal_display_free(term->display);
|
||||||
|
|
||||||
/* Free buffer */
|
/* Free buffer */
|
||||||
guac_terminal_buffer_free(term->buffer);
|
guac_terminal_buffer_free(term->buffer);
|
||||||
@ -123,9 +123,9 @@ int guac_terminal_set(guac_terminal* term, int row, int col, char c) {
|
|||||||
guac_char.value = c;
|
guac_char.value = c;
|
||||||
guac_char.attributes = term->current_attributes;
|
guac_char.attributes = term->current_attributes;
|
||||||
|
|
||||||
/* Set delta */
|
/* Set display */
|
||||||
if (scrolled_row < term->delta->height)
|
if (scrolled_row < term->display->height)
|
||||||
guac_terminal_delta_set_columns(term->delta, scrolled_row, col, col, &guac_char);
|
guac_terminal_display_set_columns(term->display, scrolled_row, col, col, &guac_char);
|
||||||
|
|
||||||
/* Set buffer */
|
/* Set buffer */
|
||||||
guac_terminal_buffer_set_columns(term->buffer, row, col, col, &guac_char);
|
guac_terminal_buffer_set_columns(term->buffer, row, col, col, &guac_char);
|
||||||
@ -145,9 +145,9 @@ int guac_terminal_toggle_reverse(guac_terminal* term, int row, int col) {
|
|||||||
/* Toggle reverse */
|
/* Toggle reverse */
|
||||||
guac_char->attributes.reverse = !(guac_char->attributes.reverse);
|
guac_char->attributes.reverse = !(guac_char->attributes.reverse);
|
||||||
|
|
||||||
/* Set delta */
|
/* Set display */
|
||||||
if (scrolled_row < term->delta->height)
|
if (scrolled_row < term->display->height)
|
||||||
guac_terminal_delta_set(term->delta, scrolled_row, col, guac_char);
|
guac_terminal_display_set(term->display, scrolled_row, col, guac_char);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -174,22 +174,22 @@ int guac_terminal_copy(guac_terminal* term,
|
|||||||
int scrolled_rows = rows;
|
int scrolled_rows = rows;
|
||||||
|
|
||||||
/* FIXME: If source (but not dest) is partially scrolled out of view, then
|
/* FIXME: If source (but not dest) is partially scrolled out of view, then
|
||||||
* the delta will not be updated properly. We need to pull the data
|
* the display will not be updated properly. We need to pull the data
|
||||||
* from the buffer in such a case.
|
* from the buffer in such a case.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (scrolled_src_row < term->delta->height &&
|
if (scrolled_src_row < term->display->height &&
|
||||||
scrolled_dst_row < term->delta->height) {
|
scrolled_dst_row < term->display->height) {
|
||||||
|
|
||||||
/* Adjust delta rect height if scrolled out of view */
|
/* Adjust display rect height if scrolled out of view */
|
||||||
if (scrolled_src_row + scrolled_rows > term->delta->height)
|
if (scrolled_src_row + scrolled_rows > term->display->height)
|
||||||
scrolled_rows = term->delta->height - scrolled_src_row;
|
scrolled_rows = term->display->height - scrolled_src_row;
|
||||||
|
|
||||||
if (scrolled_dst_row + scrolled_rows > term->delta->height)
|
if (scrolled_dst_row + scrolled_rows > term->display->height)
|
||||||
scrolled_rows = term->delta->height - scrolled_dst_row;
|
scrolled_rows = term->display->height - scrolled_dst_row;
|
||||||
|
|
||||||
/* Update delta */
|
/* Update display */
|
||||||
guac_terminal_delta_copy(term->delta,
|
guac_terminal_display_copy(term->display,
|
||||||
scrolled_dst_row, dst_col,
|
scrolled_dst_row, dst_col,
|
||||||
scrolled_src_row, src_col,
|
scrolled_src_row, src_col,
|
||||||
cols, rows);
|
cols, rows);
|
||||||
@ -218,14 +218,14 @@ int guac_terminal_clear(guac_terminal* term,
|
|||||||
character.value = ' ';
|
character.value = ' ';
|
||||||
character.attributes = term->current_attributes;
|
character.attributes = term->current_attributes;
|
||||||
|
|
||||||
if (scrolled_row < term->delta->height) {
|
if (scrolled_row < term->display->height) {
|
||||||
|
|
||||||
/* Adjust delta rect height if scrolled out of view */
|
/* Adjust display rect height if scrolled out of view */
|
||||||
if (scrolled_row + scrolled_rows > term->delta->height)
|
if (scrolled_row + scrolled_rows > term->display->height)
|
||||||
scrolled_rows = term->delta->height - scrolled_row;
|
scrolled_rows = term->display->height - scrolled_row;
|
||||||
|
|
||||||
/* Fill with color */
|
/* Fill with color */
|
||||||
guac_terminal_delta_set_rect(term->delta,
|
guac_terminal_display_set_rect(term->display,
|
||||||
scrolled_row, col, cols, scrolled_rows, &character);
|
scrolled_row, col, cols, scrolled_rows, &character);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -324,11 +324,11 @@ int guac_terminal_clear_range(guac_terminal* term,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void guac_terminal_delta_set(guac_terminal_delta* delta, int r, int c,
|
void guac_terminal_display_set(guac_terminal_display* display, int r, int c,
|
||||||
guac_terminal_char* character) {
|
guac_terminal_char* character) {
|
||||||
|
|
||||||
/* Get operation at coordinate */
|
/* Get operation at coordinate */
|
||||||
guac_terminal_operation* op = &(delta->operations[r*delta->width + c]);
|
guac_terminal_operation* op = &(display->operations[r*display->width + c]);
|
||||||
|
|
||||||
/* Store operation */
|
/* Store operation */
|
||||||
op->type = GUAC_CHAR_SET;
|
op->type = GUAC_CHAR_SET;
|
||||||
@ -336,7 +336,7 @@ void guac_terminal_delta_set(guac_terminal_delta* delta, int r, int c,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_copy(guac_terminal_delta* delta,
|
void guac_terminal_display_copy(guac_terminal_display* display,
|
||||||
int dst_row, int dst_column,
|
int dst_row, int dst_column,
|
||||||
int src_row, int src_column,
|
int src_row, int src_column,
|
||||||
int w, int h) {
|
int w, int h) {
|
||||||
@ -345,14 +345,14 @@ void guac_terminal_delta_copy(guac_terminal_delta* delta,
|
|||||||
|
|
||||||
/* FIXME: Handle intersections between src and dst rects */
|
/* FIXME: Handle intersections between src and dst rects */
|
||||||
|
|
||||||
memcpy(delta->scratch, delta->operations,
|
memcpy(display->scratch, display->operations,
|
||||||
sizeof(guac_terminal_operation) * delta->width * delta->height);
|
sizeof(guac_terminal_operation) * display->width * display->height);
|
||||||
|
|
||||||
guac_terminal_operation* current_row =
|
guac_terminal_operation* current_row =
|
||||||
&(delta->operations[dst_row*delta->width + dst_column]);
|
&(display->operations[dst_row*display->width + dst_column]);
|
||||||
|
|
||||||
guac_terminal_operation* src_current_row =
|
guac_terminal_operation* src_current_row =
|
||||||
&(delta->scratch[src_row*delta->width + src_column]);
|
&(display->scratch[src_row*display->width + src_column]);
|
||||||
|
|
||||||
/* Set rectangle to copy operations */
|
/* Set rectangle to copy operations */
|
||||||
for (row=0; row<h; row++) {
|
for (row=0; row<h; row++) {
|
||||||
@ -362,7 +362,7 @@ void guac_terminal_delta_copy(guac_terminal_delta* delta,
|
|||||||
|
|
||||||
for (column=0; column<w; column++) {
|
for (column=0; column<w; column++) {
|
||||||
|
|
||||||
/* If copying existing delta operation, just copy that rather
|
/* If copying existing display operation, just copy that rather
|
||||||
* than create a new copy op */
|
* than create a new copy op */
|
||||||
if (src_current->type != GUAC_CHAR_NOP)
|
if (src_current->type != GUAC_CHAR_NOP)
|
||||||
*current = *src_current;
|
*current = *src_current;
|
||||||
@ -381,8 +381,8 @@ void guac_terminal_delta_copy(guac_terminal_delta* delta,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
current_row += delta->width;
|
current_row += display->width;
|
||||||
src_current_row += delta->width;
|
src_current_row += display->width;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,12 +390,12 @@ void guac_terminal_delta_copy(guac_terminal_delta* delta,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_delta_set_rect(guac_terminal_delta* delta,
|
void guac_terminal_display_set_rect(guac_terminal_display* display,
|
||||||
int row, int column, int w, int h,
|
int row, int column, int w, int h,
|
||||||
guac_terminal_char* character) {
|
guac_terminal_char* character) {
|
||||||
|
|
||||||
guac_terminal_operation* current_row =
|
guac_terminal_operation* current_row =
|
||||||
&(delta->operations[row*delta->width + column]);
|
&(display->operations[row*display->width + column]);
|
||||||
|
|
||||||
/* Set rectangle contents to given character */
|
/* Set rectangle contents to given character */
|
||||||
for (row=0; row<h; row++) {
|
for (row=0; row<h; row++) {
|
||||||
@ -414,7 +414,7 @@ void guac_terminal_delta_set_rect(guac_terminal_delta* delta,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
current_row += delta->width;
|
current_row += display->width;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ void guac_terminal_scroll_display_down(guac_terminal* terminal,
|
|||||||
|
|
||||||
/* Shift screen up */
|
/* Shift screen up */
|
||||||
if (terminal->term_height > scroll_amount)
|
if (terminal->term_height > scroll_amount)
|
||||||
guac_terminal_delta_copy(terminal->delta,
|
guac_terminal_display_copy(terminal->display,
|
||||||
0, 0, /* Destination row, col */
|
0, 0, /* Destination row, col */
|
||||||
scroll_amount, 0, /* source row,col */
|
scroll_amount, 0, /* source row,col */
|
||||||
terminal->term_width, terminal->term_height - scroll_amount);
|
terminal->term_width, terminal->term_height - scroll_amount);
|
||||||
@ -514,7 +514,7 @@ void guac_terminal_scroll_display_down(guac_terminal* terminal,
|
|||||||
guac_terminal_char* current = guac_terminal_get_row(terminal, row, &length);
|
guac_terminal_char* current = guac_terminal_get_row(terminal, row, &length);
|
||||||
|
|
||||||
for (column=0; column<length; column++)
|
for (column=0; column<length; column++)
|
||||||
guac_terminal_delta_set(terminal->delta, dest_row, column,
|
guac_terminal_display_set(terminal->display, dest_row, column,
|
||||||
current++);
|
current++);
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
@ -523,7 +523,7 @@ void guac_terminal_scroll_display_down(guac_terminal* terminal,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Should flush somewhere more sensible */
|
/* FIXME: Should flush somewhere more sensible */
|
||||||
guac_terminal_delta_flush(terminal->delta, terminal);
|
guac_terminal_display_flush(terminal->display, terminal);
|
||||||
guac_socket_flush(terminal->client->socket);
|
guac_socket_flush(terminal->client->socket);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -546,7 +546,7 @@ void guac_terminal_scroll_display_up(guac_terminal* terminal,
|
|||||||
|
|
||||||
/* Shift screen down */
|
/* Shift screen down */
|
||||||
if (terminal->term_height > scroll_amount)
|
if (terminal->term_height > scroll_amount)
|
||||||
guac_terminal_delta_copy(terminal->delta,
|
guac_terminal_display_copy(terminal->display,
|
||||||
scroll_amount, 0, /* Destination row,col */
|
scroll_amount, 0, /* Destination row,col */
|
||||||
0, 0, /* Source row, col */
|
0, 0, /* Source row, col */
|
||||||
terminal->term_width, terminal->term_height - scroll_amount);
|
terminal->term_width, terminal->term_height - scroll_amount);
|
||||||
@ -570,7 +570,7 @@ void guac_terminal_scroll_display_up(guac_terminal* terminal,
|
|||||||
/* FIXME: Clear row first */
|
/* FIXME: Clear row first */
|
||||||
guac_terminal_char* current = scrollback_row->characters;
|
guac_terminal_char* current = scrollback_row->characters;
|
||||||
for (column=0; column<scrollback_row->length; column++)
|
for (column=0; column<scrollback_row->length; column++)
|
||||||
guac_terminal_delta_set(terminal->delta, dest_row, column,
|
guac_terminal_display_set(terminal->display, dest_row, column,
|
||||||
current++);
|
current++);
|
||||||
|
|
||||||
/* Next row */
|
/* Next row */
|
||||||
@ -579,7 +579,7 @@ void guac_terminal_scroll_display_up(guac_terminal* terminal,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Should flush somewhere more sensible */
|
/* FIXME: Should flush somewhere more sensible */
|
||||||
guac_terminal_delta_flush(terminal->delta, terminal);
|
guac_terminal_display_flush(terminal->display, terminal);
|
||||||
guac_socket_flush(terminal->client->socket);
|
guac_socket_flush(terminal->client->socket);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -610,14 +610,14 @@ void guac_terminal_select_start(guac_terminal* terminal, int row, int column) {
|
|||||||
|
|
||||||
/* Get char and operation */
|
/* Get char and operation */
|
||||||
guac_char = &(terminal->buffer->characters[terminal->buffer->width * row + column]);
|
guac_char = &(terminal->buffer->characters[terminal->buffer->width * row + column]);
|
||||||
guac_operation = &(terminal->delta->operations[terminal->delta->width * row + column]);
|
guac_operation = &(terminal->display->operations[terminal->display->width * row + column]);
|
||||||
|
|
||||||
/* Set character as selected */
|
/* Set character as selected */
|
||||||
guac_char->attributes.selected = true;
|
guac_char->attributes.selected = true;
|
||||||
guac_operation->type = GUAC_CHAR_SET;
|
guac_operation->type = GUAC_CHAR_SET;
|
||||||
guac_operation->character = *guac_char;
|
guac_operation->character = *guac_char;
|
||||||
|
|
||||||
guac_terminal_delta_flush(terminal->delta, terminal);
|
guac_terminal_display_flush(terminal->display, terminal);
|
||||||
guac_socket_flush(terminal->client->socket);
|
guac_socket_flush(terminal->client->socket);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -676,7 +676,7 @@ void guac_terminal_select_update(guac_terminal* terminal, int row, int column) {
|
|||||||
|
|
||||||
/* Get first character */
|
/* Get first character */
|
||||||
guac_char = &(terminal->buffer->characters[search_index_a]);
|
guac_char = &(terminal->buffer->characters[search_index_a]);
|
||||||
guac_operation = &(terminal->delta->operations[search_index_a]);
|
guac_operation = &(terminal->display->operations[search_index_a]);
|
||||||
|
|
||||||
/* Invert modified area */
|
/* Invert modified area */
|
||||||
for (i=search_index_a; i<=search_index_b; i++) {
|
for (i=search_index_a; i<=search_index_b; i++) {
|
||||||
@ -710,7 +710,7 @@ void guac_terminal_select_update(guac_terminal* terminal, int row, int column) {
|
|||||||
terminal->selection_end_row = row;
|
terminal->selection_end_row = row;
|
||||||
terminal->selection_end_column = column;
|
terminal->selection_end_column = column;
|
||||||
|
|
||||||
guac_terminal_delta_flush(terminal->delta, terminal);
|
guac_terminal_display_flush(terminal->display, terminal);
|
||||||
guac_socket_flush(terminal->client->socket);
|
guac_socket_flush(terminal->client->socket);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -743,7 +743,7 @@ void guac_terminal_select_end(guac_terminal* terminal) {
|
|||||||
|
|
||||||
/* Get first character */
|
/* Get first character */
|
||||||
guac_char = &(terminal->buffer->characters[start_index]);
|
guac_char = &(terminal->buffer->characters[start_index]);
|
||||||
guac_operation = &(terminal->delta->operations[start_index]);
|
guac_operation = &(terminal->display->operations[start_index]);
|
||||||
|
|
||||||
/* Restore state from buffer */
|
/* Restore state from buffer */
|
||||||
for (i=start_index; i<=end_index; i++) {
|
for (i=start_index; i<=end_index; i++) {
|
||||||
@ -761,7 +761,7 @@ void guac_terminal_select_end(guac_terminal* terminal) {
|
|||||||
|
|
||||||
terminal->text_selected = false;
|
terminal->text_selected = false;
|
||||||
|
|
||||||
guac_terminal_delta_flush(terminal->delta, terminal);
|
guac_terminal_display_flush(terminal->display, terminal);
|
||||||
guac_socket_flush(terminal->client->socket);
|
guac_socket_flush(terminal->client->socket);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user