From 161c4d2359cb1cadffa824ce7d4fb51a5442755a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 3 Nov 2014 15:10:23 -0800 Subject: [PATCH] GUAC-919: Restore CSS3 cursor-related code from GUAC-823 and GUAC-842. --- .../app/client/directives/guacClient.js | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/directives/guacClient.js b/guacamole/src/main/webapp/app/client/directives/guacClient.js index fb8449264..085d4a224 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacClient.js +++ b/guacamole/src/main/webapp/app/client/directives/guacClient.js @@ -341,6 +341,16 @@ angular.module('client').directive('guacClient', [function guacClient() { * Handle mouse and touch events relative to the display element. */ + var localCursor = false; + + // Ensure software cursor is shown + guac.getDisplay().showCursor(true); + + // Use local cursor if possible. + guac.getDisplay().oncursor = function(canvas, x, y) { + localCursor = mouse.setCursor(canvas, x, y); + }; + // Touchscreen var touch_screen = new Guacamole.Mouse.Touchscreen(guac_display); $scope.touch_screen = touch_screen; @@ -353,6 +363,9 @@ angular.module('client').directive('guacClient', [function guacClient() { var mouse = new Guacamole.Mouse(guac_display); mouse.onmousedown = mouse.onmouseup = mouse.onmousemove = function(mouseState) { + // Hide software cursor if local cursor is in use + guac.getDisplay().showCursor(!localCursor); + // Scale event by current scale var scaledState = new Guacamole.Mouse.State( mouseState.x / guac.getDisplay().getScale(), @@ -368,6 +381,11 @@ angular.module('client').directive('guacClient', [function guacClient() { }; + // Hide software cursor when mouse leaves display + mouse.onmouseout = function() { + guac.getDisplay().showCursor(false); + }; + // Hide any existing status notifications $scope.$emit('guacClientStatusChange', guac, null); @@ -377,8 +395,8 @@ angular.module('client').directive('guacClient', [function guacClient() { $display.html(""); // Add client to UI - guac.getDisplay().getElement().className = "software-cursor"; - $display.append(guac.getDisplay().getElement()); + guac_display.className = "software-cursor"; + $display.append(guac_display); };