diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-07-01 09:25:35 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-07-01 09:25:35 (GMT) |
commit | 84c94ecabeb21541d7ef888e1b480c3b6fa72130 (patch) | |
tree | 88d200d3676352481b8a84d154ed0afac1e4e7ec /sugar | |
parent | 3ca87cd46deeb901dec638954392d441c0c99415 (diff) |
Restrict palette positioning to screen height/width - 1 grid cell.
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/graphics/palette.py | 7 |
1 files changed, 5 insertions, 2 deletions
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): |