From 8f903acaa6e3cf2d5ce05eabdfae66fb9b31e40e Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 16 Oct 2014 22:49:51 -0700 Subject: [PATCH] GUAC-823: Test for CSS3 cursor support. --- .../src/main/webapp/modules/Mouse.js | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/guacamole-common-js/src/main/webapp/modules/Mouse.js b/guacamole-common-js/src/main/webapp/modules/Mouse.js index a27eae7ab..9e7f9e1d1 100644 --- a/guacamole-common-js/src/main/webapp/modules/Mouse.js +++ b/guacamole-common-js/src/main/webapp/modules/Mouse.js @@ -310,7 +310,30 @@ Guacamole.Mouse = function(element) { * @private * @type Boolean */ - var CSS3_CURSOR_SUPPORTED = true; + var CSS3_CURSOR_SUPPORTED = (function() { + + var div = document.createElement("div"); + + // If no cursor property at all, then no support + if (!("cursor" in div.style)) + return false; + + try { + // Apply simple 1x1 PNG + div.style.cursor = "url(data:image/png;base64," + + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAAB" + + "AQMAAAAl21bKAAAAA1BMVEX///+nxBvI" + + "AAAACklEQVQI12NgAAAAAgAB4iG8MwAA" + + "AABJRU5ErkJggg==) 0 0, auto"; + } + catch (e) { + return false; + } + + // Verify cursor property is set to URL with hotspot + return /\burl\([^()]*\)\s+0\s+0\b/.test(div.style.cursor || ""); + + })(); /** * Changes the local mouse cursor to the given canvas, having the given