GUAC-653: Update namespace in common terminal code.

This commit is contained in:
Michael Jumper 2014-05-05 16:36:49 -07:00
parent b4e7f95603
commit 455f2e543a
17 changed files with 75 additions and 75 deletions

View File

@ -187,17 +187,17 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
}
/* Set up I-bar pointer */
client_data->ibar_cursor = guac_ssh_create_ibar(client);
client_data->ibar_cursor = guac_terminal_create_ibar(client);
/* Set up blank pointer */
client_data->blank_cursor = guac_ssh_create_blank(client);
client_data->blank_cursor = guac_terminal_create_blank(client);
/* Send initial name */
guac_protocol_send_name(socket, client_data->hostname);
/* Initialize pointer */
client_data->current_cursor = client_data->blank_cursor;
guac_ssh_set_cursor(client, client_data->current_cursor);
guac_terminal_set_cursor(client, client_data->current_cursor);
guac_socket_flush(socket);

View File

@ -176,17 +176,17 @@ typedef struct ssh_guac_client_data {
/**
* The cached I-bar cursor.
*/
guac_ssh_cursor* ibar_cursor;
guac_terminal_cursor* ibar_cursor;
/**
* The cached invisible (blank) cursor.
*/
guac_ssh_cursor* blank_cursor;
guac_terminal_cursor* blank_cursor;
/**
* The current cursor, used to avoid re-setting the cursor.
*/
guac_ssh_cursor* current_cursor;
guac_terminal_cursor* current_cursor;
} ssh_guac_client_data;

View File

@ -119,7 +119,7 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
pthread_mutex_lock(&(term->lock));
client_data->current_cursor = client_data->ibar_cursor;
guac_ssh_set_cursor(client, client_data->ibar_cursor);
guac_terminal_set_cursor(client, client_data->ibar_cursor);
guac_socket_flush(client->socket);
pthread_mutex_unlock(&(term->lock));
@ -180,14 +180,14 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
/* Scroll up if wheel moved up */
if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_UP) {
pthread_mutex_lock(&(term->lock));
guac_terminal_scroll_display_up(term, GUAC_SSH_WHEEL_SCROLL_AMOUNT);
guac_terminal_scroll_display_up(term, GUAC_TERMINAL_WHEEL_SCROLL_AMOUNT);
pthread_mutex_unlock(&(term->lock));
}
/* Scroll down if wheel moved down */
if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_DOWN) {
pthread_mutex_lock(&(term->lock));
guac_terminal_scroll_display_down(term, GUAC_SSH_WHEEL_SCROLL_AMOUNT);
guac_terminal_scroll_display_down(term, GUAC_TERMINAL_WHEEL_SCROLL_AMOUNT);
pthread_mutex_unlock(&(term->lock));
}
@ -205,7 +205,7 @@ int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
pthread_mutex_lock(&(term->lock));
client_data->current_cursor = client_data->blank_cursor;
guac_ssh_set_cursor(client, client_data->blank_cursor);
guac_terminal_set_cursor(client, client_data->blank_cursor);
guac_socket_flush(client->socket);
pthread_mutex_unlock(&(term->lock));
@ -421,8 +421,8 @@ int ssh_guac_client_free_handler(guac_client* client) {
guac_common_clipboard_free(guac_client_data->clipboard);
/* Free cursors */
guac_ssh_cursor_free(client, guac_client_data->ibar_cursor);
guac_ssh_cursor_free(client, guac_client_data->blank_cursor);
guac_terminal_cursor_free(client, guac_client_data->ibar_cursor);
guac_terminal_cursor_free(client, guac_client_data->blank_cursor);
/* Free generic data struct */
free(client->data);

View File

@ -29,10 +29,10 @@
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
guac_ssh_cursor* guac_ssh_create_blank(guac_client* client) {
guac_terminal_cursor* guac_terminal_create_blank(guac_client* client) {
guac_socket* socket = client->socket;
guac_ssh_cursor* cursor = guac_ssh_cursor_alloc(client);
guac_terminal_cursor* cursor = guac_terminal_cursor_alloc(client);
/* Set buffer to a single 1x1 transparent rectangle */
guac_protocol_send_rect(socket, cursor->buffer, 0, 0, 1, 1);

View File

@ -21,8 +21,8 @@
*/
#ifndef _GUAC_SSH_BLANK_H
#define _GUAC_SSH_BLANK_H
#ifndef _GUAC_TERMINAL_BLANK_H
#define _GUAC_TERMINAL_BLANK_H
#include "config.h"
@ -35,8 +35,8 @@
* Creates a new blank cursor, returning the corresponding cursor object.
*
* @param client The guac_client to send the cursor to.
* @return A new cursor which must be free'd via guac_ssh_cursor_free()/
* @return A new cursor which must be free'd via guac_terminal_cursor_free()/
*/
guac_ssh_cursor* guac_ssh_create_blank(guac_client* client);
guac_terminal_cursor* guac_terminal_create_blank(guac_client* client);
#endif

View File

@ -21,8 +21,8 @@
*/
#ifndef _SSH_GUAC_BUFFER_H
#define _SSH_GUAC_BUFFER_H
#ifndef _GUAC_TERMINAL_BUFFER_H
#define _GUAC_TERMINAL_BUFFER_H
#include "config.h"

View File

@ -21,8 +21,8 @@
*/
#ifndef _GUAC_SSH_CHAR_MAPPINGS_H
#define _GUAC_SSH_CHAR_MAPPINGS_H
#ifndef _GUAC_TERMINAL_CHAR_MAPPINGS_H
#define _GUAC_TERMINAL_CHAR_MAPPINGS_H
#include "config.h"

View File

@ -21,8 +21,8 @@
*/
#ifndef _SSH_GUAC_COMMON_H
#define _SSH_GUAC_COMMON_H
#ifndef _GUAC_TERMINAL_COMMON_H
#define _GUAC_TERMINAL_COMMON_H
#include "config.h"

View File

@ -29,17 +29,17 @@
#include <guacamole/client.h>
#include <guacamole/protocol.h>
guac_ssh_cursor* guac_ssh_cursor_alloc(guac_client* client) {
guac_terminal_cursor* guac_terminal_cursor_alloc(guac_client* client) {
/* Alloc new cursor, initialize buffer */
guac_ssh_cursor* cursor = malloc(sizeof(guac_ssh_cursor));
guac_terminal_cursor* cursor = malloc(sizeof(guac_terminal_cursor));
cursor->buffer = guac_client_alloc_buffer(client);
return cursor;
}
void guac_ssh_cursor_free(guac_client* client, guac_ssh_cursor* cursor) {
void guac_terminal_cursor_free(guac_client* client, guac_terminal_cursor* cursor) {
/* Free buffer */
guac_client_free_buffer(client, cursor->buffer);
@ -49,7 +49,7 @@ void guac_ssh_cursor_free(guac_client* client, guac_ssh_cursor* cursor) {
}
void guac_ssh_set_cursor(guac_client* client, guac_ssh_cursor* cursor) {
void guac_terminal_set_cursor(guac_client* client, guac_terminal_cursor* cursor) {
/* Set cursor */
guac_protocol_send_cursor(client->socket,

View File

@ -21,14 +21,14 @@
*/
#ifndef _GUAC_SSH_CURSOR_H
#define _GUAC_SSH_CURSOR_H
#ifndef _GUAC_TERMINAL_CURSOR_H
#define _GUAC_TERMINAL_CURSOR_H
#include "config.h"
#include <guacamole/client.h>
typedef struct guac_ssh_cursor {
typedef struct guac_terminal_cursor {
/**
* A buffer allocated with guac_client_alloc_buffer() that contains the
@ -56,22 +56,22 @@ typedef struct guac_ssh_cursor {
*/
int hotspot_y;
} guac_ssh_cursor;
} guac_terminal_cursor;
/**
* Allocates a new cursor, pre-populating the cursor with a newly-allocated
* buffer.
*/
guac_ssh_cursor* guac_ssh_cursor_alloc(guac_client* client);
guac_terminal_cursor* guac_terminal_cursor_alloc(guac_client* client);
/**
* Frees the buffer associated with this cursor as well as the cursor itself.
*/
void guac_ssh_cursor_free(guac_client* client, guac_ssh_cursor* cursor);
void guac_terminal_cursor_free(guac_client* client, guac_terminal_cursor* cursor);
/**
* Set the remote cursor.
*/
void guac_ssh_set_cursor(guac_client* client, guac_ssh_cursor* cursor);
void guac_terminal_set_cursor(guac_client* client, guac_terminal_cursor* cursor);
#endif

View File

@ -21,8 +21,8 @@
*/
#ifndef _SSH_GUAC_DISPLAY_H
#define _SSH_GUAC_DISPLAY_H
#ifndef _GUAC_TERMINAL_DISPLAY_H
#define _GUAC_TERMINAL_DISPLAY_H
#include "config.h"

View File

@ -36,15 +36,15 @@
#define _ 0x00,0x00,0x00,0x00
/* Dimensions */
const int guac_ssh_ibar_width = 7;
const int guac_ssh_ibar_height = 16;
const int guac_terminal_ibar_width = 7;
const int guac_terminal_ibar_height = 16;
/* Format */
const cairo_format_t guac_ssh_ibar_format = CAIRO_FORMAT_ARGB32;
const int guac_ssh_ibar_stride = 28;
const cairo_format_t guac_terminal_ibar_format = CAIRO_FORMAT_ARGB32;
const int guac_terminal_ibar_stride = 28;
/* Embedded pointer graphic */
unsigned char guac_ssh_ibar[] = {
unsigned char guac_terminal_ibar[] = {
X,X,X,X,X,X,X,
X,O,O,U,O,O,X,
@ -65,28 +65,28 @@ unsigned char guac_ssh_ibar[] = {
};
guac_ssh_cursor* guac_ssh_create_ibar(guac_client* client) {
guac_terminal_cursor* guac_terminal_create_ibar(guac_client* client) {
guac_socket* socket = client->socket;
guac_ssh_cursor* cursor = guac_ssh_cursor_alloc(client);
guac_terminal_cursor* cursor = guac_terminal_cursor_alloc(client);
/* Draw to buffer */
cairo_surface_t* graphic = cairo_image_surface_create_for_data(
guac_ssh_ibar,
guac_ssh_ibar_format,
guac_ssh_ibar_width,
guac_ssh_ibar_height,
guac_ssh_ibar_stride);
guac_terminal_ibar,
guac_terminal_ibar_format,
guac_terminal_ibar_width,
guac_terminal_ibar_height,
guac_terminal_ibar_stride);
guac_protocol_send_png(socket, GUAC_COMP_SRC, cursor->buffer,
0, 0, graphic);
cairo_surface_destroy(graphic);
/* Initialize cursor properties */
cursor->width = guac_ssh_ibar_width;
cursor->height = guac_ssh_ibar_height;
cursor->hotspot_x = guac_ssh_ibar_width / 2;
cursor->hotspot_y = guac_ssh_ibar_height / 2;
cursor->width = guac_terminal_ibar_width;
cursor->height = guac_terminal_ibar_height;
cursor->hotspot_x = guac_terminal_ibar_width / 2;
cursor->hotspot_y = guac_terminal_ibar_height / 2;
return cursor;

View File

@ -21,8 +21,8 @@
*/
#ifndef _GUAC_SSH_IBAR_H
#define _GUAC_SSH_IBAR_H
#ifndef _GUAC_TERMINAL_IBAR_H
#define _GUAC_TERMINAL_IBAR_H
#include "config.h"
@ -32,34 +32,34 @@
/**
* Width of the embedded mouse cursor graphic.
*/
extern const int guac_ssh_ibar_width;
extern const int guac_terminal_ibar_width;
/**
* Height of the embedded mouse cursor graphic.
*/
extern const int guac_ssh_ibar_height;
extern const int guac_terminal_ibar_height;
/**
* Number of bytes in each row of the embedded mouse cursor graphic.
*/
extern const int guac_ssh_ibar_stride;
extern const int guac_terminal_ibar_stride;
/**
* The Cairo grapic format of the mouse cursor graphic.
*/
extern const cairo_format_t guac_ssh_ibar_format;
extern const cairo_format_t guac_terminal_ibar_format;
/**
* Embedded mouse cursor graphic.
*/
extern unsigned char guac_ssh_ibar[];
extern unsigned char guac_terminal_ibar[];
/**
* Creates a new I-bar cursor, returning the corresponding cursor object.
*
* @param client The guac_client to send the cursor to.
* @return A new cursor which must be free'd via guac_ssh_cursor_free()/
* @return A new cursor which must be free'd via guac_terminal_cursor_free()/
*/
guac_ssh_cursor* guac_ssh_create_ibar(guac_client* client);
guac_terminal_cursor* guac_terminal_create_ibar(guac_client* client);
#endif

View File

@ -21,8 +21,8 @@
*/
#ifndef _SSH_GUAC_TERMINAL_H
#define _SSH_GUAC_TERMINAL_H
#ifndef _GUAC_TERMINAL_H
#define _GUAC_TERMINAL_H
#include "config.h"
@ -43,7 +43,7 @@
/**
* The number of rows to scroll per scroll wheel event.
*/
#define GUAC_SSH_WHEEL_SCROLL_AMOUNT 3
#define GUAC_TERMINAL_WHEEL_SCROLL_AMOUNT 3
typedef struct guac_terminal guac_terminal;

View File

@ -875,7 +875,7 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) {
}
int guac_terminal_guac_set_directory(guac_terminal* term, unsigned char c) {
int guac_terminal_set_directory(guac_terminal* term, unsigned char c) {
static char filename[2048];
static int length = 0;
@ -896,7 +896,7 @@ int guac_terminal_guac_set_directory(guac_terminal* term, unsigned char c) {
}
int guac_terminal_guac_download(guac_terminal* term, unsigned char c) {
int guac_terminal_download(guac_terminal* term, unsigned char c) {
static char filename[2048];
static int length = 0;
@ -930,11 +930,11 @@ int guac_terminal_osc(guac_terminal* term, unsigned char c) {
/* Download OSC */
if (operation == 482200)
term->char_handler = guac_terminal_guac_download;
term->char_handler = guac_terminal_download;
/* Set upload directory OSC */
else if (operation == 482201)
term->char_handler = guac_terminal_guac_set_directory;
term->char_handler = guac_terminal_set_directory;
/* Reset parameter for next OSC */
operation = 0;

View File

@ -21,8 +21,8 @@
*/
#ifndef _SSH_GUAC_TERMINAL_HANDLERS
#define _SSH_GUAC_TERMINAL_HANDLERS
#ifndef _GUAC_TERMINAL_HANDLERS
#define _GUAC_TERMINAL_HANDLERS
#include "config.h"
@ -33,8 +33,8 @@ int guac_terminal_escape(guac_terminal* term, unsigned char c);
int guac_terminal_g0_charset(guac_terminal* term, unsigned char c);
int guac_terminal_g1_charset(guac_terminal* term, unsigned char c);
int guac_terminal_csi(guac_terminal* term, unsigned char c);
int guac_terminal_guac_download(guac_terminal* term, unsigned char c);
int guac_terminal_guac_set_directory(guac_terminal* term, unsigned char c);
int guac_terminal_download(guac_terminal* term, unsigned char c);
int guac_terminal_set_directory(guac_terminal* term, unsigned char c);
int guac_terminal_osc(guac_terminal* term, unsigned char c);
int guac_terminal_ctrl_func(guac_terminal* term, unsigned char c);

View File

@ -21,8 +21,8 @@
*/
#ifndef _SSH_GUAC_TYPES_H
#define _SSH_GUAC_TYPES_H
#ifndef _GUAC_TERMINAL_TYPES_H
#define _GUAC_TERMINAL_TYPES_H
#include "config.h"