Resize bugfix

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

 



Hi, folks!

There is a scaling bug [1] in virt-manager, which prevents user seeing bottom of console, especially when using tiling VM which is able to force window size. Here's my fix attempt.

Now, when user needs to scale console down, he/she is limited by minimum allowable size of widgets in detail pages even if those are not visible by user. Despite that, GTK still thinks those are visible and accounts them into size constrain that seems "too large" for some uses. This constrain later causes that scroll_size_allocate event in details.py doesn't receive correct size requirement for height. It sees the minimum mentioned above instead, which is where the scaling bug comes from.

After some hacking it turned out that it was sufficient to hook into swtich-page event and set_visible(False) all direct descendants of non-active pages. I did this twice - for console-pages and details-pages.

It was not enough, there was still a bit silly width constrain which was removed by allowing details-toolbar to show arrow.

Patches attached.

Best wishes,
- Maros

1 - https://bugzilla.redhat.com/show_bug.cgi?id=994456
>From c6cf843389d9a9e49494756d3448b3cd9ae42191 Mon Sep 17 00:00:00 2001
From: Maros Zatko <mzatko@xxxxxxxxxx>
Date: Thu, 27 Feb 2014 16:14:55 +0100
Subject: [PATCH 1/3] vmmConsolePages: toggle visibilities on page change

---
 virtManager/console.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/virtManager/console.py b/virtManager/console.py
index 6ac8abc..b42925c 100644
--- a/virtManager/console.py
+++ b/virtManager/console.py
@@ -1281,6 +1281,7 @@ class vmmConsolePages(vmmGObjectUI):
 
     def activate_auth_page(self, withPassword=True, withUsername=False):
         (pw, username) = self.config.get_console_password(self.vm)
+
         self.widget("details-menu-vm-screenshot").set_sensitive(False)
         self.widget("details-menu-usb-redirection").set_sensitive(False)
 
@@ -1319,8 +1320,16 @@ class vmmConsolePages(vmmGObjectUI):
             self.widget("details-menu-usb-redirection").set_sensitive(True)
             return
 
-    def page_changed(self, ignore1=None, ignore2=None, ignore3=None):
+    def page_changed(self, ignore1=None, ignore2=None, newpage=None):
         pagenum = self.widget("console-pages").get_current_page()
+
+        for i in range(self.widget("console-pages").get_n_pages()):
+          w = self.widget("console-pages").get_nth_page(i)
+          if i == newpage:
+            w.set_visible(True)
+          else:
+            w.set_visible(False)
+
         if pagenum < CONSOLE_PAGE_OFFSET:
             self.last_gfx_page = pagenum
         self.set_allow_fullscreen()
-- 
1.8.3.1

>From b5356db008f053bf24c37023e657cee02f0dc064 Mon Sep 17 00:00:00 2001
From: Maros Zatko <mzatko@xxxxxxxxxx>
Date: Fri, 28 Feb 2014 17:41:45 +0100
Subject: [PATCH 2/3] vmmDetails: toggle visibilities on page change

---
 virtManager/details.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/virtManager/details.py b/virtManager/details.py
index 72e79da..b74c9fc 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1269,7 +1269,14 @@ class vmmDetails(vmmGObjectUI):
         finally:
             self.ignoreDetails = False
 
-    def switch_page(self, ignore1=None, ignore2=None, newpage=None):
+    def switch_page(self, notebook=None, ignore2=None, newpage=None):
+        for i in range(notebook.get_n_pages()):
+          w = notebook.get_nth_page(i)
+          if i == newpage:
+            w.set_visible(True)
+          else:
+            w.set_visible(False)
+
         self.page_refresh(newpage)
 
         self.sync_details_console_view(newpage)
-- 
1.8.3.1

>From d569bc7d425ac1ade389a395a1ec68dc5af27345 Mon Sep 17 00:00:00 2001
From: Maros Zatko <mzatko@xxxxxxxxxx>
Date: Fri, 28 Feb 2014 17:55:48 +0100
Subject: [PATCH 3/3] details-toolbar: set show_arrow to true

---
 ui/details.ui | 1 -
 1 file changed, 1 deletion(-)

diff --git a/ui/details.ui b/ui/details.ui
index 6e330f9..643d210 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -371,7 +371,6 @@
               <object class="GtkToolbar" id="details-toolbar">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="show_arrow">False</property>
                 <child>
                   <object class="GtkRadioToolButton" id="control-vm-console">
                     <property name="visible">True</property>
-- 
1.8.3.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux