From 470dd09380ac2cf000af2b40d0b68fc203958764 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Mon, 10 Dec 2012 18:43:43 -0300
Subject: [PATCH sugar 2/2] Do not check intersection with the same icon
Skip the intersection check against the same icon and use the new Gdk
API to know if there was a collision (Gdk.rectangle_intersect returns
a boolean value).
http://developer.gnome.org/gdk/stable/gdk-Points-Rectangles-and-Regions.html#gdk-rectangle-intersect
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
src/jarabe/desktop/grid.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/jarabe/desktop/grid.py b/src/jarabe/desktop/grid.py
index 83404e2..e9a5658 100644
a
|
b
|
class Grid(SugarExt.Grid): |
198 | 198 | collision_found = False |
199 | 199 | child_rect = self._child_rects[child] |
200 | 200 | for c in self._children: |
| 201 | if c == child: |
| 202 | continue |
| 203 | |
201 | 204 | intersects_, intersection = Gdk.rectangle_intersect( |
202 | 205 | child_rect, self._child_rects[c]) |
203 | | if c != child and intersection.width > 0: |
| 206 | if intersects_: |
204 | 207 | collision_found = True |
205 | 208 | if (c not in self._locked_children and |
206 | 209 | c not in self._collisions): |