From 40ac3960554373fd6fed54f193f932d3e050ab51 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 15 Sep 2006 01:56:59 +0200 Subject: [PATCH] Fix small bugs in the grid logic --- shell/FriendIcon.py | 2 +- sugar/canvas/Grid.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/shell/FriendIcon.py b/shell/FriendIcon.py index eb2cf9dd..8d1017c2 100644 --- a/shell/FriendIcon.py +++ b/shell/FriendIcon.py @@ -58,7 +58,7 @@ class FriendIcon(IconItem): grid_x = grid_x2 + distance if grid_x + self._popup.get_width() > Grid.ROWS: - grid_x = grid_x1 - self._popup.get_width() - distance + grid_x = grid_x1 - self._popup.get_width() + 1 - distance grid_y = grid_y1 diff --git a/sugar/canvas/Grid.py b/sugar/canvas/Grid.py index e4c377ab..50b5dbe6 100644 --- a/sugar/canvas/Grid.py +++ b/sugar/canvas/Grid.py @@ -10,7 +10,11 @@ class Grid: def convert_from_screen(self, x, y): factor = Grid.COLS / gtk.gdk.screen_width() - return [int(x * factor), int(y * factor)] + + grid_x = round(x * factor) - 1 + grid_y = round(y * factor) - 1 + + return [grid_x, grid_y] def set_constraints(self, component, x, y, width=-1, height=-1): if isinstance(component, gtk.Window):