Remove scroll logging, reset scroll upon typing.
This commit is contained in:
parent
7897be9316
commit
c20fe79ace
@ -45,6 +45,8 @@
|
|||||||
|
|
||||||
#include <guacamole/client.h>
|
#include <guacamole/client.h>
|
||||||
|
|
||||||
|
#define GUAC_SSH_WHEEL_SCROLL_AMOUNT 3
|
||||||
|
|
||||||
typedef struct guac_terminal guac_terminal;
|
typedef struct guac_terminal guac_terminal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,16 +608,18 @@ guac_terminal_scrollback_row* guac_terminal_scrollback_buffer_get_row(
|
|||||||
guac_terminal_scrollback_buffer* buffer, int row);
|
guac_terminal_scrollback_buffer* buffer, int row);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scroll down the display by one row, replacing the new space with data from
|
* Scroll down the display by the given amount, replacing the new space with
|
||||||
* the scrollback.
|
* data from the scrollback. If not enough data is available, the maximum
|
||||||
|
* amount will be scrolled.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_scroll_display_down(guac_terminal* terminal);
|
void guac_terminal_scroll_display_down(guac_terminal* terminal, int amount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scroll up the display by one row, replacing the new space with data from
|
* Scroll up the display by the given amount, replacing the new space with data
|
||||||
* either the scrollback or the terminal buffer.
|
* from either the scrollback or the terminal buffer. If not enough data is
|
||||||
|
* available, the maximum amount will be scrolled.
|
||||||
*/
|
*/
|
||||||
void guac_terminal_scroll_display_up(guac_terminal* terminal);
|
void guac_terminal_scroll_display_up(guac_terminal* terminal, int amount);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -164,14 +164,14 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
|
|||||||
/* Scroll up if wheel moved up */
|
/* Scroll up if wheel moved up */
|
||||||
if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_UP) {
|
if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_UP) {
|
||||||
pthread_mutex_lock(&(term->lock));
|
pthread_mutex_lock(&(term->lock));
|
||||||
guac_terminal_scroll_display_up(term);
|
guac_terminal_scroll_display_up(term, GUAC_SSH_WHEEL_SCROLL_AMOUNT);
|
||||||
pthread_mutex_unlock(&(term->lock));
|
pthread_mutex_unlock(&(term->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scroll down if wheel moved down */
|
/* Scroll down if wheel moved down */
|
||||||
if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_DOWN) {
|
if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_DOWN) {
|
||||||
pthread_mutex_lock(&(term->lock));
|
pthread_mutex_lock(&(term->lock));
|
||||||
guac_terminal_scroll_display_down(term);
|
guac_terminal_scroll_display_down(term, GUAC_SSH_WHEEL_SCROLL_AMOUNT);
|
||||||
pthread_mutex_unlock(&(term->lock));
|
pthread_mutex_unlock(&(term->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +182,7 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
|
|||||||
int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
|
int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
|
||||||
|
|
||||||
ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data;
|
ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data;
|
||||||
|
guac_terminal* term = client_data->term;
|
||||||
|
|
||||||
/* Track modifiers */
|
/* Track modifiers */
|
||||||
if (keysym == 0xFFE3) {
|
if (keysym == 0xFFE3) {
|
||||||
@ -191,6 +192,13 @@ int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
|
|||||||
/* If key pressed */
|
/* If key pressed */
|
||||||
else if (pressed) {
|
else if (pressed) {
|
||||||
|
|
||||||
|
/* Reset scroll */
|
||||||
|
if (term->scroll_offset != 0) {
|
||||||
|
pthread_mutex_lock(&(term->lock));
|
||||||
|
guac_terminal_scroll_display_down(term, term->scroll_offset);
|
||||||
|
pthread_mutex_unlock(&(term->lock));
|
||||||
|
}
|
||||||
|
|
||||||
/* If simple ASCII key */
|
/* If simple ASCII key */
|
||||||
if (keysym >= 0x00 && keysym <= 0xFF) {
|
if (keysym >= 0x00 && keysym <= 0xFF) {
|
||||||
char data = (char) keysym;
|
char data = (char) keysym;
|
||||||
|
@ -1219,16 +1219,10 @@ void guac_terminal_scrollback_buffer_append(
|
|||||||
if (buffer->length > buffer->rows)
|
if (buffer->length > buffer->rows)
|
||||||
buffer->length = buffer->rows;
|
buffer->length = buffer->rows;
|
||||||
|
|
||||||
/* Log string version of row that WOULD have been scrolled into the
|
|
||||||
* scrollback */
|
|
||||||
guac_client_log_info(terminal->client,
|
|
||||||
"scrollback->top=%i (length=%i/%i)", buffer->top, buffer->length, buffer->rows);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_scroll_display_down(guac_terminal* terminal) {
|
void guac_terminal_scroll_display_down(guac_terminal* terminal,
|
||||||
|
int scroll_amount) {
|
||||||
int scroll_amount = 3;
|
|
||||||
|
|
||||||
int start_row, end_row;
|
int start_row, end_row;
|
||||||
int dest_row;
|
int dest_row;
|
||||||
@ -1257,10 +1251,6 @@ void guac_terminal_scroll_display_down(guac_terminal* terminal) {
|
|||||||
start_row = end_row - scroll_amount + 1;
|
start_row = end_row - scroll_amount + 1;
|
||||||
dest_row = terminal->term_height - scroll_amount;
|
dest_row = terminal->term_height - scroll_amount;
|
||||||
|
|
||||||
guac_client_log_info(terminal->client,
|
|
||||||
"Scrolling rows %i through %i into view (scroll down)",
|
|
||||||
start_row, end_row);
|
|
||||||
|
|
||||||
/* Draw new rows from scrollback */
|
/* Draw new rows from scrollback */
|
||||||
for (row=start_row; row<=end_row; row++) {
|
for (row=start_row; row<=end_row; row++) {
|
||||||
|
|
||||||
@ -1304,9 +1294,8 @@ void guac_terminal_scroll_display_down(guac_terminal* terminal) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_terminal_scroll_display_up(guac_terminal* terminal) {
|
void guac_terminal_scroll_display_up(guac_terminal* terminal,
|
||||||
|
int scroll_amount) {
|
||||||
int scroll_amount = 3;
|
|
||||||
|
|
||||||
int start_row, end_row;
|
int start_row, end_row;
|
||||||
int dest_row;
|
int dest_row;
|
||||||
@ -1336,10 +1325,6 @@ void guac_terminal_scroll_display_up(guac_terminal* terminal) {
|
|||||||
end_row = start_row + scroll_amount - 1;
|
end_row = start_row + scroll_amount - 1;
|
||||||
dest_row = 0;
|
dest_row = 0;
|
||||||
|
|
||||||
guac_client_log_info(terminal->client,
|
|
||||||
"Scrolling rows %i through %i into view (scroll up)",
|
|
||||||
start_row, end_row);
|
|
||||||
|
|
||||||
/* Draw new rows from scrollback */
|
/* Draw new rows from scrollback */
|
||||||
for (row=start_row; row<=end_row; row++) {
|
for (row=start_row; row<=end_row; row++) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user