From 21864ed823f89401f135c7f3c035746d3a4d11d2 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 30 Jan 2015 12:31:47 -0800 Subject: [PATCH 1/5] GUAC-1044: Move guac menu inside guacViewport. Move menu-specific properties to own object. --- .../client/controllers/clientController.js | 62 ++++--- .../webapp/app/client/templates/client.html | 172 +++++++++--------- 2 files changed, 125 insertions(+), 109 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index b613838e4..7fb586192 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -154,25 +154,41 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams callback: RECONNECT_ACTION.callback, remaining: 15 }; - - // Hide menu by default - $scope.menuShown = false; - // Use physical keyboard by default - $scope.inputMethod = 'none'; + /** + * Menu-specific properties. + */ + $scope.menu = { + + /** + * Whether the menu is currently shown. + * + * @type Boolean + */ + shown : false, + + /** + * The currently selected input method. This may be either 'none', + * 'osk', or 'none'. + * + * @type String + */ + inputMethod : 'none', + + /** + * The current scroll state of the menu. + * + * @type ScrollState + */ + scrollState : new ScrollState() + + }; // Convenience method for closing the menu $scope.closeMenu = function closeMenu() { - $scope.menuShown = false; + $scope.menu.shown = false; }; - /** - * The current scroll state of the menu. - * - * @type ScrollState - */ - $scope.menuScrollState = new ScrollState(); - // Update the model when clipboard data received from client $scope.$on('guacClientClipboard', function clientClipboardListener(event, client, mimetype, clipboardData) { $scope.clipboardData = clipboardData; @@ -206,12 +222,12 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // Hide menu if swipe gesture is detected if (Math.abs(currentY - startY) < MENU_DRAG_VERTICAL_TOLERANCE && startX - currentX >= MENU_DRAG_DELTA) - $scope.menuShown = false; + $scope.menu.shown = false; // Scroll menu by default else { - $scope.menuScrollState.left -= deltaX; - $scope.menuScrollState.top -= deltaY; + $scope.menu.scrollState.left -= deltaX; + $scope.menu.scrollState.top -= deltaY; } return false; @@ -226,7 +242,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams if (Math.abs(currentY - startY) < MENU_DRAG_VERTICAL_TOLERANCE && currentX - startX >= MENU_DRAG_DELTA) - $scope.menuShown = true; + $scope.menu.shown = true; } @@ -307,7 +323,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams }; // Show/hide UI elements depending on input method - $scope.$watch('inputMethod', function setInputMethod(inputMethod) { + $scope.$watch('menu.inputMethod', function setInputMethod(inputMethod) { // Show input methods only if selected $scope.showOSK = (inputMethod === 'osk'); @@ -315,7 +331,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams }); - $scope.$watch('menuShown', function menuVisibilityChanged(menuShown, menuShownPreviousState) { + $scope.$watch('menu.shown', function menuVisibilityChanged(menuShown, menuShownPreviousState) { // Send clipboard data if menu is hidden if (!menuShown && menuShownPreviousState) @@ -351,7 +367,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // Toggle the menu $scope.$apply(function() { - $scope.menuShown = !$scope.menuShown; + $scope.menu.shown = !$scope.menu.shown; }); } } @@ -372,8 +388,8 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // Show menu and scroll file transfer into view if (count > oldCount) { - $scope.menuShown = true; - $scope.fileTransferMarker.scrollIntoView(); + $scope.menu.shown = true; + $scope.menu.fileTransferMarker.scrollIntoView(); } }); @@ -495,7 +511,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams $scope.client.client.disconnect(); // Hide menu - $scope.menuShown = false; + $scope.menu.shown = false; }; diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html index 55781ec8a..aa2d5c294 100644 --- a/guacamole/src/main/webapp/app/client/templates/client.html +++ b/guacamole/src/main/webapp/app/client/templates/client.html @@ -20,8 +20,9 @@ THE SOFTWARE. --> - + +
@@ -49,90 +50,89 @@
+ +
- - - From a87d8053f0540eb0d83ad85b8054c6f16d848364 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 30 Jan 2015 13:49:43 -0800 Subject: [PATCH 2/5] GUAC-1044: Fix audio error when using IE over RDP - it's blocking testing (regression of GUAC-882). --- .../webapp/app/client/services/guacAudio.js | 74 ++++++++++++++----- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/services/guacAudio.js b/guacamole/src/main/webapp/app/client/services/guacAudio.js index f648ecbb4..061820584 100644 --- a/guacamole/src/main/webapp/app/client/services/guacAudio.js +++ b/guacamole/src/main/webapp/app/client/services/guacAudio.js @@ -30,6 +30,11 @@ angular.module('client').factory('guacAudio', [function guacAudio() { */ return new (function() { + /** + * Array of codecs to test. + * + * @type String[] + */ var codecs = [ 'audio/ogg; codecs="vorbis"', 'audio/mp4; codecs="mp4a.40.5"', @@ -38,41 +43,70 @@ angular.module('client').factory('guacAudio', [function guacAudio() { 'audio/wav; codecs=1' ]; + /** + * Array of all codecs that are reported as "probably" supported. + * + * @type String[] + */ var probably_supported = []; + + /** + * Array of all codecs that are reported as "maybe" supported. + * + * @type String[] + */ var maybe_supported = []; + /** + * Internal audio element for the sake of testing codec support. If + * audio is explicitly not supported by the browser, this will instead + * be null. + * + * @type Audio + */ + var audio = null; + + // Attempt to create audio element + try { + audio = new Audio(); + } + catch (e) { + // If creation fails, allow audio to remain null + } + /** * Array of all supported audio mimetypes, ordered by liklihood of * working. */ this.supported = []; - // Build array of supported audio formats - codecs.forEach(function(mimetype) { + // Build array of supported audio formats (if audio supported at all) + if (audio) { + codecs.forEach(function(mimetype) { - var audio = new Audio(); - var support_level = audio.canPlayType(mimetype); + var support_level = audio.canPlayType(mimetype); - // Trim semicolon and trailer - var semicolon = mimetype.indexOf(";"); - if (semicolon != -1) - mimetype = mimetype.substring(0, semicolon); + // Trim semicolon and trailer + var semicolon = mimetype.indexOf(";"); + if (semicolon !== -1) + mimetype = mimetype.substring(0, semicolon); - // Partition by probably/maybe - if (support_level == "probably") - probably_supported.push(mimetype); - else if (support_level == "maybe") - maybe_supported.push(mimetype); + // Partition by probably/maybe + if (support_level === "probably") + probably_supported.push(mimetype); + else if (support_level === "maybe") + maybe_supported.push(mimetype); - }); + }); - // Add probably supported types first - Array.prototype.push.apply( - this.supported, probably_supported); + // Add probably supported types first + Array.prototype.push.apply( + this.supported, probably_supported); - // Prioritize "maybe" supported types second - Array.prototype.push.apply( - this.supported, maybe_supported); + // Prioritize "maybe" supported types second + Array.prototype.push.apply( + this.supported, maybe_supported); + } })(); From 7b9449d2dad7e804a327e3ea66b5a290011197df Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 30 Jan 2015 14:06:20 -0800 Subject: [PATCH 3/5] GUAC-1044: Keep menu header stationary while allowing body to scroll. --- .../main/webapp/app/client/styles/menu.css | 41 ++++- .../webapp/app/client/templates/client.html | 164 ++++++++++-------- 2 files changed, 128 insertions(+), 77 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/styles/menu.css b/guacamole/src/main/webapp/app/client/styles/menu.css index dd96408cc..f3f324025 100644 --- a/guacamole/src/main/webapp/app/client/styles/menu.css +++ b/guacamole/src/main/webapp/app/client/styles/menu.css @@ -21,10 +21,10 @@ */ #menu { - overflow: auto; + overflow: hidden; position: absolute; top: 0; - bottom: 0; + height: 100%; max-width: 100%; width: 480px; background: #EEE; @@ -37,6 +37,43 @@ transition: left 0.125s, opacity 0.125s; } +.menu-content { + overflow: hidden; + display: table; + table-layout: fixed; + width: 100%; + height: 100%; +} + +.menu-header { + display: table-row; + height: 0; +} + +.menu-header h2 { + margin-bottom: 0; +} + +.menu-body { + display: table-row; + height: 100%; +} + +.menu-body-content { + position: relative; + width: 100%; + height: 100%; +} + +.menu-body-scroll-region { + overflow: auto; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; +} + #menu h3 { margin: 1em; } diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html index aa2d5c294..685045312 100644 --- a/guacamole/src/main/webapp/app/client/templates/client.html +++ b/guacamole/src/main/webapp/app/client/templates/client.html @@ -43,7 +43,7 @@
- +
@@ -51,88 +51,102 @@ -