From 50d5a79031448248275673d6869181c4185d84a2 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 20 Dec 2014 16:01:06 -0800 Subject: [PATCH] GUAC-810: Resize client display depending only on containing element, not entire window. --- .../app/client/directives/guacClient.js | 11 ++++++++-- .../main/webapp/app/client/styles/display.css | 18 +++++++++++---- .../webapp/app/client/templates/blank.html | 22 +++++++++++++++++++ .../app/client/templates/guacClient.html | 3 +++ 4 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 guacamole/src/main/webapp/app/client/templates/blank.html diff --git a/guacamole/src/main/webapp/app/client/directives/guacClient.js b/guacamole/src/main/webapp/app/client/directives/guacClient.js index c5f7bcd35..8c330805a 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacClient.js +++ b/guacamole/src/main/webapp/app/client/directives/guacClient.js @@ -115,6 +115,13 @@ angular.module('client').directive('guacClient', [function guacClient() { */ var main = $element[0]; + /** + * The element which functions as a detector for size changes. + * + * @type Element + */ + var resizeSensor = $element.find('.resize-sensor')[0]; + /** * Guacamole mouse event object, wrapped around the main client * display. @@ -491,8 +498,8 @@ angular.module('client').directive('guacClient', [function guacClient() { $scope.clientProperties.scale = $scope.clientProperties.minScale; }); - // If the window is resized, attempt to resize client - $window.addEventListener('resize', function onResizeWindow() { + // If the element is resized, attempt to resize client + resizeSensor.contentWindow.addEventListener('resize', function mainElementResized() { // Send new display size, if changed if (client && display) { diff --git a/guacamole/src/main/webapp/app/client/styles/display.css b/guacamole/src/main/webapp/app/client/styles/display.css index 7fd44f623..a606514e4 100644 --- a/guacamole/src/main/webapp/app/client/styles/display.css +++ b/guacamole/src/main/webapp/app/client/styles/display.css @@ -32,11 +32,21 @@ div.main { overflow: auto; - position: fixed; - top: 0; - bottom: 0; - right: 0; + width: 100%; + height: 100%; + position: relative; +} + +.resize-sensor { + height: 100%; + width: 100%; + position: absolute; left: 0; + top: 0; + overflow: hidden; + border: none; + opacity: 0; + z-index: -1; } div.displayOuter { diff --git a/guacamole/src/main/webapp/app/client/templates/blank.html b/guacamole/src/main/webapp/app/client/templates/blank.html new file mode 100644 index 000000000..62b9f6aa2 --- /dev/null +++ b/guacamole/src/main/webapp/app/client/templates/blank.html @@ -0,0 +1,22 @@ + + diff --git a/guacamole/src/main/webapp/app/client/templates/guacClient.html b/guacamole/src/main/webapp/app/client/templates/guacClient.html index 91daf3b81..30e5d606d 100644 --- a/guacamole/src/main/webapp/app/client/templates/guacClient.html +++ b/guacamole/src/main/webapp/app/client/templates/guacClient.html @@ -21,6 +21,9 @@ THE SOFTWARE. --> + + +