[Spice-devel] [PATCH spice-html5] If an agent is attached, enable dynamic resizing of the guest screen.

Gianni Pirozzi germanium at gmx.us
Tue Sep 9 07:06:52 PDT 2014

On Saturday, September 06, 2014 at 5:14 PM, Jeremy White wrote:
> I've respun this and sent a v2 that should not tie the resize agent 
> requests so strictly to the presentation, hopefully this will help you.

Yes, this one has no problems with my use case, thank you!
For Windows guests, at the moment I allow resizing only to a set of resolutions that always seem to work.

On Friday, September 05, 2014 at 10:59 PM, Jeremy White wrote:
> Yes, you are probably correct.  The issue is that there appears to be no 
> way to have a vertical html element dynamically resize itself; all of my 
> Google Fu pointed at a need to use Javascript to compute that.

I know, vertical sizing relative to the viewport is a pain.
Have you considered to style the body as a positioned element and update its height at resize? If you do that, elements with a percentage height should dynamically resize too, e.g.

<body style="position: relative; height: 100%; width: 100%;">
    document.body.style.height = window.innerHeight + "px"
    window.addEventListener("resize", function() {
      document.body.style.height = window.innerHeight + "px"
      // Now elements with a percentage height have been resized too,
      // and clientHeight is accurate.
      // If agent is connected, resize.

Note that if you want to do this with the screen element you should leave its height in percentage instead of setting it in pixels (display.js, line 451), otherwise it will not dynamically resize.


More information about the Spice-devel mailing list