[Sugar-devel] [sugar PATCH] sl#3833: Now, the palettes appear fine in the bottom frame-tray.

Ajay Garg ajay at activitycentral.com
Wed Mar 6 07:30:39 EST 2013


The solution has been build upon the "no-caching" solution provided by erikos at
http://bugs.sugarlabs.org/ticket/4419#comment:4

Theerafter, the cause of http://bugs.sugarlabs.org/attachment/ticket/3833/Screenshot%20of%20_Journal_.png
is not taking "style.GRID_CELL_SIZE" into account, when calucating the alignments for the palettes.

I will have to thank manuq a great deal, for his comment http://bugs.sugarlabs.org/ticket/3833#comment:11,
which helped me debug the real issue.
In particular, his observation that the "landscape"-mode-obscurity occurs only in one of the erikos' solutions;
while the "portrait-mode-obscurity" occurs only in both of erikos's solutions.

Finally, this patch provides the no-obscurity solution for all cases :)


 src/sugar3/graphics/palettewindow.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py
index c48ae55..e192a7c 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -777,8 +777,6 @@ class Invoker(GObject.GObject):
 
         self._screen_area = Gdk.Rectangle()
         self._screen_area.x = self._screen_area.y = 0
-        self._screen_area.width = Gdk.Screen.width()
-        self._screen_area.height = Gdk.Screen.height()
         self._position_hint = self.ANCHORED
         self._cursor_x = -1
         self._cursor_y = -1
@@ -841,8 +839,8 @@ class Invoker(GObject.GObject):
     def _in_screen(self, rect):
         return rect.x >= self._screen_area.x and \
                rect.y >= self._screen_area.y and \
-               rect.x + rect.width <= self._screen_area.width and \
-               rect.y + rect.height <= self._screen_area.height
+               rect.x + rect.width <= (Gdk.Screen.width() - style.GRID_CELL_SIZE) and \
+               rect.y + rect.height <= (Gdk.Screen.height() - style.GRID_CELL_SIZE)
 
     def _get_area_in_screen(self, rect):
         """Return area of rectangle visible in the screen"""
@@ -850,9 +848,9 @@ class Invoker(GObject.GObject):
         x1 = max(rect.x, self._screen_area.x)
         y1 = max(rect.y, self._screen_area.y)
         x2 = min(rect.x + rect.width,
-                self._screen_area.x + self._screen_area.width)
+                self._screen_area.x + Gdk.Screen.width() - style.GRID_CELL_SIZE)
         y2 = min(rect.y + rect.height,
-                self._screen_area.y + self._screen_area.height)
+                self._screen_area.y + Gdk.Screen.height() - style.GRID_CELL_SIZE)
 
         return (x2 - x1) * (y2 - y1)
 
@@ -882,8 +880,8 @@ class Invoker(GObject.GObject):
         rect.x = max(0, rect.x)
         rect.y = max(0, rect.y)
 
-        rect.x = min(rect.x, self._screen_area.width - rect.width)
-        rect.y = min(rect.y, self._screen_area.height - rect.height)
+        rect.x = min(rect.x, Gdk.Screen.width() - style.GRID_CELL_SIZE - rect.width)
+        rect.y = min(rect.y, Gdk.Screen.height()- style.GRID_CELL_SIZE - rect.height)
 
         return rect
 
@@ -913,7 +911,7 @@ class Invoker(GObject.GObject):
 
         if best_alignment in self.LEFT or best_alignment in self.RIGHT:
             dtop = rect.y - screen_area.y
-            dbottom = screen_area.y + screen_area.height - rect.y - rect.width
+            dbottom = screen_area.y + Gdk.Screen.height() - style.GRID_CELL_SIZE - rect.y - rect.width
 
             iv = 0
 
@@ -928,7 +926,7 @@ class Invoker(GObject.GObject):
 
         elif best_alignment in self.TOP or best_alignment in self.BOTTOM:
             dleft = rect.x - screen_area.x
-            dright = screen_area.x + screen_area.width - rect.x - rect.width
+            dright = screen_area.x + Gdk.Screen.width() - style.GRID_CELL_SIZE - rect.x - rect.width
 
             ih = 0
 
-- 
1.7.11.7



More information about the Sugar-devel mailing list