Bug 1414718

Summary: cannot resize the vm window smaller when "Alway" and "Auto resize VM with window" are active
Product: [Community] Virtualization Tools Reporter: Xiaodai Wang <xiaodwan>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: berrange, crobinso, dav87legrand, gscrivan, juzhou, mxie, mzhan, tzheng, vierzigundzwei
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-12 16:46:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
workaround none

Description Xiaodai Wang 2017-01-19 10:37:42 UTC
Description of problem:
cannot resize the vm window smaller when "Alway" and "Auto resize VM with window" are active.

Version-Release number of selected component (if applicable):
virt-manager-1.4.0-2.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running spice guest.
2. Activate "View->Scale Display->Always & Auto resize VM with window". 
3. Move the mouse cursor to the bottom right corner of the vm winodw.
4. Try to drag the window to top left and bottom right directions.

Actual results:
The vm window can only be resized larger and can't be resized smaller.

Expected results:
The vm window should be resized smaller when drag the window smaller.

Additional info:

Comment 2 Jaroslav Suchanek 2017-01-19 14:47:35 UTC
Well, I think this is expectable. But lets see what Pavel will say...

Comment 3 Pavel Hrdina 2017-02-08 16:33:42 UTC
Virt-viewer doesn't suffer with the same issue and it does scaling and auto-resizing by default so this is probably a bug in virt-manager.  Moving to upstream.

Comment 4 dav87legrand 2019-04-19 12:20:33 UTC
Created attachment 1556464 [details]
workaround

Hi,

The bug is still present.
Here is my workaround, maybe not the best but seems to work.

Comment 5 Florian Ludwig 2019-10-09 09:13:31 UTC
The workaround from dav87legrand works.


I looked into the code but could not figure out why:

```
        if is_resizeguest:
            # With resize guest, we don't want to maintain aspect ratio,
            # since the guest can resize to arbitrary resolutions.
            self._viewer.console_set_size_request(req.width, req.height)
            return
```

would not resize the window but

```
        if is_resizeguest:
            # With resize guest, we don't want to maintain aspect ratio,
            # since the guest can resize to arbitrary resolutions.
            # self._viewer.console_set_size_request(req.width, req.height)
            viewer_alloc = Gdk.Rectangle()
            viewer_alloc.width = req.width
            viewer_alloc.height = req.height
            self._viewer.console_size_allocate(viewer_alloc)
            return
```

would.


How do we get this merged (or properly fixed by someone with more gtk knowledge :))?  Would a merge request on github help?

Comment 6 Cole Robinson 2019-11-12 16:46:34 UTC
Fixed upstream now by Florian: https://github.com/virt-manager/virt-manager/commit/ae19d6d6ec0b48085ce1c765fb2264e27fb51c63