[Sugar-devel] [PATCH] #1725: Resize home window on screen size change

Andrés Ambrois andresambrois at gmail.com
Sat Apr 24 02:08:54 EDT 2010


  When switching resolutions, the main window doesn't resize
properly. Listen for gtk.gdk.Screen size-changed signal and
resize the window accordingly.

Signed-off-by: Andrés Ambrois <andresambrois at gmail.com>
---
 src/jarabe/desktop/homewindow.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/desktop/homewindow.py b/src/jarabe/desktop/homewindow.py
index d830ed0..fec4289 100644
--- a/src/jarabe/desktop/homewindow.py
+++ b/src/jarabe/desktop/homewindow.py
@@ -45,8 +45,10 @@ class HomeWindow(gtk.Window):
         self._active = False
         self._fully_obscured = True
 
-        self.set_default_size(gtk.gdk.screen_width(),
-                              gtk.gdk.screen_height())
+        screen = self.get_screen()
+        screen.connect('size-changed', self.__screen_size_change_cb)
+        self.set_default_size(screen.get_width(),
+                              screen.get_height())
 
         self.realize()
         self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
@@ -80,6 +82,9 @@ class HomeWindow(gtk.Window):
         elif level == ShellModel.ZOOM_MESH:
             self._mesh_box.suspend()
 
+    def __screen_size_change_cb(self, screen):
+        self.resize(screen.get_width(), screen.get_height())
+
     def _activate_view(self, level):
         if level == ShellModel.ZOOM_HOME:
             self._home_box.resume()
-- 
1.6.3.3



More information about the Sugar-devel mailing list