[ 
https://issues.apache.org/jira/browse/GUACAMOLE-165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Jumper updated GUACAMOLE-165:
-------------------------------------
    Description: 
If the client template is modified such that the Guacamole display does not 
occupy the whole browser window, the width/height values submitted as "optimal" 
via {{GUAC_WIDTH}} and {{GUAC_HEIGHT}} will not match the actual space 
available for the client display:

{code:javascript|title=ManagedClient.js}
        // Calculate optimal width/height for display
        var pixel_density = $window.devicePixelRatio || 1;
        var optimal_dpi = pixel_density * 96;
        var optimal_width = $window.innerWidth * pixel_density;
        var optimal_height = $window.innerHeight * pixel_density;

        // Build base connect string
        var connectString =
              "token="             + 
encodeURIComponent(authenticationService.getCurrentToken())
            + "&GUAC_DATA_SOURCE=" + encodeURIComponent(identifier.dataSource)
            + "&GUAC_ID="          + encodeURIComponent(identifier.id)
            + "&GUAC_TYPE="        + encodeURIComponent(identifier.type)
            + "&GUAC_WIDTH="       + Math.floor(optimal_width)
            + "&GUAC_HEIGHT="      + Math.floor(optimal_height)
            + "&GUAC_DPI="         + Math.floor(optimal_dpi)
            + (connectionParameters ? '&' + connectionParameters : '');
{code}


  was:
When the Guacamole client is not occupying the whole browser window, the screen 
ratio is not calculated properly. If there are some elements above client (e.g. 
added from extension), the connection string height is taking optimal height 
calculated using window.height. This is not correct if there are elements above 
and the client is not occupying the whole area.

{code:javascript|title=ManagedClient.js}
        // Calculate optimal width/height for display
        var pixel_density = $window.devicePixelRatio || 1;
        var optimal_dpi = pixel_density * 96;
        var optimal_width = $window.innerWidth * pixel_density;
        var optimal_height = $window.innerHeight * pixel_density;

        // Build base connect string
        var connectString =
              "token="             + 
encodeURIComponent(authenticationService.getCurrentToken())
            + "&GUAC_DATA_SOURCE=" + encodeURIComponent(identifier.dataSource)
            + "&GUAC_ID="          + encodeURIComponent(identifier.id)
            + "&GUAC_TYPE="        + encodeURIComponent(identifier.type)
            + "&GUAC_WIDTH="       + Math.floor(optimal_width)
            + "&GUAC_HEIGHT="      + Math.floor(optimal_height)
            + "&GUAC_DPI="         + Math.floor(optimal_dpi)
            + (connectionParameters ? '&' + connectionParameters : '');
{code}

If the GUAC_HEIGHT parameter is corrected for the size of the element above 
client, the ratio is correct.



> Optimal height/width calculations incorrect if client template is modified
> --------------------------------------------------------------------------
>
>                 Key: GUACAMOLE-165
>                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-165
>             Project: Guacamole
>          Issue Type: Bug
>          Components: guacamole
>    Affects Versions: 0.9.10-incubating
>         Environment: browser
>            Reporter: Marko Nikolić
>
> If the client template is modified such that the Guacamole display does not 
> occupy the whole browser window, the width/height values submitted as 
> "optimal" via {{GUAC_WIDTH}} and {{GUAC_HEIGHT}} will not match the actual 
> space available for the client display:
> {code:javascript|title=ManagedClient.js}
>         // Calculate optimal width/height for display
>         var pixel_density = $window.devicePixelRatio || 1;
>         var optimal_dpi = pixel_density * 96;
>         var optimal_width = $window.innerWidth * pixel_density;
>         var optimal_height = $window.innerHeight * pixel_density;
>         // Build base connect string
>         var connectString =
>               "token="             + 
> encodeURIComponent(authenticationService.getCurrentToken())
>             + "&GUAC_DATA_SOURCE=" + encodeURIComponent(identifier.dataSource)
>             + "&GUAC_ID="          + encodeURIComponent(identifier.id)
>             + "&GUAC_TYPE="        + encodeURIComponent(identifier.type)
>             + "&GUAC_WIDTH="       + Math.floor(optimal_width)
>             + "&GUAC_HEIGHT="      + Math.floor(optimal_height)
>             + "&GUAC_DPI="         + Math.floor(optimal_dpi)
>             + (connectionParameters ? '&' + connectionParameters : '');
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to