From d7f488c896cbd0d9883a3261d3e03ddad55b505e Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 27 Jan 2012 15:31:17 -0800 Subject: [PATCH 01/11] Firefox < 9.0.1 does not call document.body.onload ... we must use window.onload instead. --- guacamole/src/main/webapp/client.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guacamole/src/main/webapp/client.xhtml b/guacamole/src/main/webapp/client.xhtml index ae01eb611..b50e01f8b 100644 --- a/guacamole/src/main/webapp/client.xhtml +++ b/guacamole/src/main/webapp/client.xhtml @@ -98,7 +98,7 @@ // Start connect after control returns from onload (allow browser // to consider the page loaded). - document.body.onload = function() { + window.onload = function() { window.setTimeout(function() { // Instantiate client From 82cb28062ddb51c53c8d8d4022c3bf2b72c18189 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 31 Jan 2012 21:12:40 -0800 Subject: [PATCH 02/11] Reduced duration of long-press detect from 1 second to 800 milliseconds (Thanks, Luca) --- guacamole/src/main/webapp/scripts/interface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index 527fd77da..2b810d2fa 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -234,7 +234,7 @@ var GuacamoleUI = { menuShowLongPressTimeout = null; GuacamoleUI.showMenu(); - }, 1000); + }, 800); } }; From cbb6490129f63291003dc7a39e99e783534a80c6 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 14 Feb 2012 23:02:09 -0800 Subject: [PATCH 03/11] Refactor supporting recent changes to guacamole-common-js (removal of getLayers() from Guacamole.Client, changes to Guacamole.Client constructor prototype, and addition of Guacamole.Client.getDisplay()). --- guacamole/src/main/webapp/client.xhtml | 4 ++- .../src/main/webapp/scripts/interface.js | 26 ------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/guacamole/src/main/webapp/client.xhtml b/guacamole/src/main/webapp/client.xhtml index b50e01f8b..e6e2a6ac3 100644 --- a/guacamole/src/main/webapp/client.xhtml +++ b/guacamole/src/main/webapp/client.xhtml @@ -103,10 +103,12 @@ // Instantiate client var guac = new Guacamole.Client( - GuacamoleUI.display, new Guacamole.HTTPTunnel("tunnel") ); + // Add client to UI + GuacamoleUI.display.appendChild(guac.getDisplay()); + // Tie UI to client GuacamoleUI.attach(guac); diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index 2b810d2fa..cb1f8f3db 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -423,32 +423,6 @@ GuacamoleUI.attach = function(guac) { // Display error message GuacamoleUI.showError(error); - - // Show error by desaturating display - var layers = guac.getLayers(); - for (var i=0; i Date: Wed, 15 Feb 2012 10:17:43 -0800 Subject: [PATCH 04/11] Hide cursor. Fix positioning regression. --- guacamole/src/main/webapp/client.xhtml | 2 +- guacamole/src/main/webapp/styles/client.css | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/guacamole/src/main/webapp/client.xhtml b/guacamole/src/main/webapp/client.xhtml index e6e2a6ac3..d9a71dc82 100644 --- a/guacamole/src/main/webapp/client.xhtml +++ b/guacamole/src/main/webapp/client.xhtml @@ -56,7 +56,7 @@ -
+
diff --git a/guacamole/src/main/webapp/styles/client.css b/guacamole/src/main/webapp/styles/client.css index b3693aebb..abf65ab3d 100644 --- a/guacamole/src/main/webapp/styles/client.css +++ b/guacamole/src/main/webapp/styles/client.css @@ -28,7 +28,7 @@ img { border: none; } -.guac-hide-cursor { +.software-cursor { cursor: url('../images/mouse/dot.gif'),url('../images/mouse/blank.cur'),default; } @@ -114,10 +114,8 @@ div.dialog p { background: #D44; } -div#display { +div#display * { position: relative; - width: 640px; - height: 480px; margin-left: auto; margin-right: auto; } From ca851827a432349e9d0c94488f55f98891c8be31 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 15 Feb 2012 10:28:17 -0800 Subject: [PATCH 05/11] Only actual client display should have hidden cursor, not main display div. --- guacamole/src/main/webapp/client.xhtml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/webapp/client.xhtml b/guacamole/src/main/webapp/client.xhtml index d9a71dc82..fb8c20c65 100644 --- a/guacamole/src/main/webapp/client.xhtml +++ b/guacamole/src/main/webapp/client.xhtml @@ -56,7 +56,7 @@ -
+
@@ -107,6 +107,7 @@ ); // Add client to UI + guac.getDisplay().className = "software-cursor"; GuacamoleUI.display.appendChild(guac.getDisplay()); // Tie UI to client From 29cb34d2a14fba758889a380b14e36b53359c226 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 16 Feb 2012 21:41:17 -0800 Subject: [PATCH 06/11] Move mouse events to new display. --- .../src/main/webapp/scripts/interface.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index cb1f8f3db..d1ec09c4c 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -220,9 +220,6 @@ var GuacamoleUI = { // When mouse hovers over top of screen, start detection of intent to open menu GuacamoleUI.menuControl.addEventListener('mousemove', GuacamoleUI.startMenuOpenDetect, true); - // When mouse enters display, start detection of intent to close menu - GuacamoleUI.display.addEventListener('mouseover', GuacamoleUI.startMenuCloseDetect, true); - var menuShowLongPressTimeout = null; GuacamoleUI.startLongPressDetect = function() { @@ -271,11 +268,6 @@ var GuacamoleUI = { window.location.reload(); }; - GuacamoleUI.display.onclick = function(e) { - e.preventDefault(); - return false; - }; - // On-screen keyboard GuacamoleUI.keyboard = new Guacamole.OnScreenKeyboard("layouts/en-us-qwerty-mobile.xml"); GuacamoleUI.containers.keyboard.appendChild(GuacamoleUI.keyboard.getElement()); @@ -295,17 +287,27 @@ var GuacamoleUI = { // Tie UI events / behavior to a specific Guacamole client GuacamoleUI.attach = function(guac) { + var guac_display = guac.getDisplay(); + + // When mouse enters display, start detection of intent to close menu + guac_display.addEventListener('mouseover', GuacamoleUI.startMenuCloseDetect, true); + + guac_display.onclick = function(e) { + e.preventDefault(); + return false; + }; + // Mouse - var mouse = new Guacamole.Mouse(GuacamoleUI.display); + var mouse = new Guacamole.Mouse(guac_display); mouse.onmousedown = mouse.onmouseup = mouse.onmousemove = function(mouseState) { // Determine mouse position within view - var mouse_view_x = mouseState.x + GuacamoleUI.display.offsetLeft - window.pageXOffset; - var mouse_view_y = mouseState.y + GuacamoleUI.display.offsetTop - window.pageYOffset; + var mouse_view_x = mouseState.x + guac_display.offsetLeft - window.pageXOffset; + var mouse_view_y = mouseState.y + guac_display.offsetTop - window.pageYOffset; // Determine viewport dimensioins - var view_width = GuacamoleUI.viewport.offsetWidth; + var view_width = GuacamoleUI.viewport.offsetWidth; var view_height = GuacamoleUI.viewport.offsetHeight; // Determine scroll amounts based on mouse position relative to document From 2e0ff46d6b96e06bcda9db70ef05f6aec36a2363 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 23 Feb 2012 13:28:59 -0800 Subject: [PATCH 07/11] Bumped version to 0.6.0 --- guacamole/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guacamole/pom.xml b/guacamole/pom.xml index 2df9860d7..f039f0c9f 100644 --- a/guacamole/pom.xml +++ b/guacamole/pom.xml @@ -5,7 +5,7 @@ net.sourceforge.guacamole guacamole-default-webapp war - 0.5.0 + 0.6.0 guacamole-default-webapp http://guacamole.sourceforge.net/ @@ -95,7 +95,7 @@ net.sourceforge.guacamole guacamole-common-js - 0.5.0 + 0.6.0 zip runtime From a0d81dbbbaa1f8895833586105b76c478b26b61f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 23 Feb 2012 15:46:11 -0800 Subject: [PATCH 08/11] Showing menu whenever mouse leaves document is too aggressive ... just using menuControl for now (see #94). --- .../src/main/webapp/scripts/interface.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index d1ec09c4c..0beb793d0 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -244,25 +244,6 @@ var GuacamoleUI = { // Detect long-press at bottom of screen document.body.addEventListener('touchstart', GuacamoleUI.startLongPressDetect, true); - // Show menu if mouse leaves document - document.addEventListener('mouseout', function(e) { - - // Get parent of the element the mouse pointer is leaving - if (!e) e = window.event; - var target = e.relatedTarget || e.toElement; - - // Ensure target is not document nor child of document - var targetParent = target; - while (targetParent != null) { - if (targetParent == document) return; - targetParent = targetParent.parentNode; - } - - // Start detection of intent to open menu - GuacamoleUI.startMenuOpenDetect(); - - }, true); - // Reconnect button GuacamoleUI.buttons.reconnect.onclick = function() { window.location.reload(); From 0dcaed693e9a663afd16825ea81a3b9764ee787f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 29 Feb 2012 00:10:21 -0800 Subject: [PATCH 09/11] Hint to browser that configuration list should not be cached. --- .../net/sourceforge/guacamole/net/basic/ConfigurationList.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/ConfigurationList.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/ConfigurationList.java index dcbc446e6..f7585a662 100644 --- a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/ConfigurationList.java +++ b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/ConfigurationList.java @@ -53,6 +53,9 @@ public class ConfigurationList extends HttpServlet { return; } + // Do not cache + response.setHeader("Cache-Control", "no-cache"); + // Write XML response.setHeader("Content-Type", "text/xml"); PrintWriter out = response.getWriter(); From 612b1c19eff32118d43c68150713afa2ea650525 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 1 Mar 2012 12:55:50 -0800 Subject: [PATCH 10/11] Menu button styling. --- guacamole/src/main/webapp/styles/client.css | 33 +++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/guacamole/src/main/webapp/styles/client.css b/guacamole/src/main/webapp/styles/client.css index abf65ab3d..9d0f9d265 100644 --- a/guacamole/src/main/webapp/styles/client.css +++ b/guacamole/src/main/webapp/styles/client.css @@ -124,12 +124,41 @@ div#display * { vertical-align: middle; } -#menu button { +#menu span { vertical-align: middle; } -#menu span { +#menu button { vertical-align: middle; + background: #DC8; + border: 1px solid #986; + color: black; + padding: 0.25em; + padding-right: 1em; + padding-left: 1em; +} + +#menu button:hover { + background: #FFC; + border: 1px solid #DC8; +} + +#menu button:active { + padding-top: 0.35em; + padding-left: 1.1em; + + padding-bottom: 0.15em; + padding-right: 0.9em; +} + +.guac-error #menu button { + background: #B33; + border: 1px solid #822; +} + +.guac-error #menu button:hover { + background: #F44; + border: 1px solid #B33; } div#clipboardDiv { From 64b8bb02956b80c1e6b587de7df4f9a5b98e01cd Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 1 Mar 2012 12:56:21 -0800 Subject: [PATCH 11/11] Do not require classList. --- .../src/main/webapp/scripts/interface.js | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index 0beb793d0..8ea48a34d 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -42,19 +42,69 @@ var GuacamoleUI = { var guacErrorImage = new Image(); guacErrorImage.src = "images/noguacamole-logo-24.png"; + // Function for adding a class to an element + var addClass; + + // Function for removing a class from an element + var removeClass; + + // If Node.classList is supported, implement addClass/removeClass using that + if (Node.classList) { + + addClass = function(element, classname) { + element.classList.add(classname); + }; + + removeClass = function(element, classname) { + element.classList.remove(classname); + }; + + } + + // Otherwise, implement own + else { + + addClass = function(element, classname) { + + // Simply add new class + element.className += " " + classname; + + }; + + removeClass = function(element, classname) { + + // Filter out classes with given name + element.className = element.className.replace(/([^ ]+)[ ]*/g, + function(match, testClassname, spaces, offset, string) { + + // If same class, remove + if (testClassname == classname) + return ""; + + // Otherwise, allow + return match; + + } + ); + + }; + + } + + GuacamoleUI.hideStatus = function() { - document.body.classList.remove("guac-error"); + removeClass(document.body, "guac-error"); GuacamoleUI.containers.state.style.visibility = "hidden"; }; GuacamoleUI.showStatus = function(text) { - document.body.classList.remove("guac-error"); + removeClass(document.body, "guac-error"); GuacamoleUI.containers.state.style.visibility = "visible"; GuacamoleUI.state.textContent = text; }; GuacamoleUI.showError = function(error) { - document.body.classList.add("guac-error"); + addClass(document.body, "guac-error"); GuacamoleUI.state.textContent = error; };