GUACAMOLE-313: Do not render cursor unless mouse has actually moved.
This commit is contained in:
parent
cafcd90f9f
commit
e2455d6f26
@ -26,8 +26,7 @@
|
||||
guacenc_cursor* guacenc_cursor_alloc() {
|
||||
|
||||
/* Allocate new cursor */
|
||||
guacenc_cursor* cursor = (guacenc_cursor*) calloc(1,
|
||||
sizeof(guacenc_cursor));
|
||||
guacenc_cursor* cursor = (guacenc_cursor*) malloc(sizeof(guacenc_cursor));
|
||||
if (cursor == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -38,6 +37,9 @@ guacenc_cursor* guacenc_cursor_alloc() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Do not initially render cursor, unless it moves */
|
||||
cursor->x = cursor->y = -1;
|
||||
|
||||
return cursor;
|
||||
|
||||
}
|
||||
|
@ -33,12 +33,16 @@
|
||||
typedef struct guacenc_cursor {
|
||||
|
||||
/**
|
||||
* The current X coordinate of the mouse cursor, in pixels.
|
||||
* The current X coordinate of the mouse cursor, in pixels. Valid values
|
||||
* are non-negative. Negative values indicate that the cursor should not
|
||||
* be rendered.
|
||||
*/
|
||||
int x;
|
||||
|
||||
/**
|
||||
* The current Y coordinate of the mouse cursor, in pixels.
|
||||
* The current Y coordinate of the mouse cursor, in pixels. Valid values
|
||||
* are non-negative. Negative values indicate that the cursor should not
|
||||
* be rendered.
|
||||
*/
|
||||
int y;
|
||||
|
||||
|
@ -93,6 +93,10 @@ static int guacenc_display_render_cursor(guacenc_display* display) {
|
||||
|
||||
guacenc_cursor* cursor = display->cursor;
|
||||
|
||||
/* Do not render cursor if coordinates are negative */
|
||||
if (cursor->x < 0 || cursor->y < 0)
|
||||
return 0;
|
||||
|
||||
/* Retrieve default layer (guaranteed to not be NULL) */
|
||||
guacenc_layer* def_layer = guacenc_display_get_layer(display, 0);
|
||||
assert(def_layer != NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user