From 84c94ecabeb21541d7ef888e1b480c3b6fa72130 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sun, 01 Jul 2007 09:25:35 +0000 Subject: Restrict palette positioning to screen height/width - 1 grid cell. --- (limited to 'sugar') diff --git a/sugar/graphics/palette.py b/sugar/graphics/palette.py index 00a45c9..72e8af9 100644 --- a/sugar/graphics/palette.py +++ b/sugar/graphics/palette.py @@ -23,6 +23,7 @@ import time import hippo from sugar.graphics import animator +from sugar.graphics import units from sugar import _sugarext _BOTTOM_LEFT = 0 @@ -158,9 +159,11 @@ class Palette(gobject.GObject): def _in_screen(self, x, y): [width, height] = self._menu.size_request() + screen_width = gtk.gdk.screen_width() - units.grid_to_pixels(1) + screen_height = gtk.gdk.screen_height() - units.grid_to_pixels(1) - return x + width < gtk.gdk.screen_width() and \ - y + height < gtk.gdk.screen_height() and \ + return x + width <= screen_width and \ + y + height <= screen_height and \ x >= 0 and y >= 0 def _get_automatic_position(self): -- cgit v0.9.1