You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/01/30 19:06:52 UTC
[5/9] guacamole-server git commit: GUACAMOLE-313: Do not render
cursor unless mouse has actually moved.
GUACAMOLE-313: Do not render cursor unless mouse has actually moved.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/e2455d6f
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/e2455d6f
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/e2455d6f
Branch: refs/heads/master
Commit: e2455d6f26513c2d1e9bf7304c8b15436b58b9ef
Parents: cafcd90
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Nov 27 19:32:59 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Jan 26 16:21:47 2018 -0800
----------------------------------------------------------------------
src/guacenc/cursor.c | 6 ++++--
src/guacenc/cursor.h | 8 ++++++--
src/guacenc/display-flatten.c | 4 ++++
3 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e2455d6f/src/guacenc/cursor.c
----------------------------------------------------------------------
diff --git a/src/guacenc/cursor.c b/src/guacenc/cursor.c
index 4883ac1..d67e946 100644
--- a/src/guacenc/cursor.c
+++ b/src/guacenc/cursor.c
@@ -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;
}
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e2455d6f/src/guacenc/cursor.h
----------------------------------------------------------------------
diff --git a/src/guacenc/cursor.h b/src/guacenc/cursor.h
index 73dc3c9..89c8fca 100644
--- a/src/guacenc/cursor.h
+++ b/src/guacenc/cursor.h
@@ -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;
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e2455d6f/src/guacenc/display-flatten.c
----------------------------------------------------------------------
diff --git a/src/guacenc/display-flatten.c b/src/guacenc/display-flatten.c
index e2fba82..4a86c0d 100644
--- a/src/guacenc/display-flatten.c
+++ b/src/guacenc/display-flatten.c
@@ -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);