Re: [PATCH spice-html5 2/2] Make sure to not set to smaller height than is minimal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/23/2017 03:44 AM, Tomáš Bohdálek wrote:
> Get minimal  screen height from css file.

The patch looks correct, but I'm not sure if we really want the
functionality.

When I originally set the minimum height in the css, I did it primarily
to cause the 'non connected' screen size to come up reasonably sized,
instead of being a short window pane.

However, while running, it seems valuable to allow the user to decide
what height the window should be.

With your change, the behavior I get is that if I make the window
shorter than 600 pixels, I get a scroll bar; the spice-html5 code tends
to break down and not function well once the dreaded scroll bar is on
the screen.

Can you explain your use case and the problem you were hoping to solve?

Cheers,

Jeremy

> ---
>  resize.js | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/resize.js b/resize.js
> index b572de7..89b59ff 100644
> --- a/resize.js
> +++ b/resize.js
> @@ -32,9 +32,14 @@
>  **--------------------------------------------------------------------------*/
>  function resize_helper(sc)
>  {
> -    var w = document.getElementById(sc.screen_id).clientWidth;
> +    var screen_id = document.getElementById(sc.screen_id);
> +    var w = screen_id.clientWidth;
>      var m = document.getElementById(sc.message_id);
>  
> +    /* Screen size can't be get from screen_id.style.minHeight, min-height is defined in css */
> +    var minHeight = parseInt(window.getComputedStyle(screen_id).getPropertyValue("min-height"),
> +                             10);
> +
>      /* Resize vertically; basically we leave a 20 pixel margin
>           at the bottom, and use the position of the message window
>           to figure out how to resize */
> @@ -42,6 +47,9 @@ function resize_helper(sc)
>      /* Show both div elements - spice-area and message-div */
>      var h = window.innerHeight - m.offsetHeight - m.clientHeight - 20;
>  
> +    /* Set minimal height if screen is smaller than screen min-height */
> +    if (h < minHeight)
> +        h = minHeight;
>  
>      /* Xorg requires height be a multiple of 8; round up */
>      if (h % 8 > 0)
> @@ -51,7 +59,6 @@ function resize_helper(sc)
>      if (w % 8 > 0)
>          w += (8 - (w % 8));
>  
> -
>      sc.resize_window(0, w, h, 32, 0, 0);
>      sc.spice_resize_timer = undefined;
>  }
> 

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]