From 8efb7c3f9318f139639d6986db1ecaf4b3dc98b9 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Sat, 29 Oct 2011 12:20:30 +0200 Subject: [PATCH] Adapt to changed Gtk.Window.set_geometry_hints() API Unlike PyGTK [1], GTK3+pygi [2] wants GDK Geometry and WindowHints objects, rather than individual values. [1] http://developer.gnome.org/pygtk/stable/class-gtkwindow.html#method-gtkwindow--set-geometry-hints [2] http://developer.gnome.org/gtk3/3.0/GtkWindow.html#gtk-window-set-geometry-hints Signed-off-by: Simon Schampijer [replaced description, included fix-up commit] Signed-off-by: Sascha Silbe --- src/sugar3/activity/activity.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py index 120dfae6..02fae65e 100644 --- a/src/sugar3/activity/activity.py +++ b/src/sugar3/activity/activity.py @@ -57,6 +57,7 @@ from functools import partial from gi.repository import GConf from gi.repository import Gtk +from gi.repository import Gdk from gi.repository import GObject import dbus import dbus.service @@ -484,11 +485,18 @@ class Activity(Window, Gtk.Container): def _adapt_window_to_screen(self): screen = Gdk.Screen.get_default() - self.set_geometry_hints(None, - screen.get_width(), screen.get_height(), - screen.get_width(), screen.get_height(), - screen.get_width(), screen.get_height(), - 1, 1, 1, 1) + geometry = Gdk.Geometry() + geometry.max_width = geometry.base_width = geometry.min_width = \ + screen.get_width() + geometry.max_height = geometry.base_height = geometry.min_height = \ + screen.get_height() + geometry.width_inc = geometry.height_inc = geometry.min_aspect = \ + geometry.max_aspect = 1 + hints = Gdk.WindowHints(Gdk.WindowHints.ASPECT | + Gdk.WindowHints.BASE_SIZE | + Gdk.WindowHints.MAX_SIZE | + Gdk.WindowHints.MIN_SIZE) + self.set_geometry_hints(None, geometry, hints) def __session_quit_requested_cb(self, session): self._quit_requested = True