Ticket #3833: 0001-Palette-update-position-when-the-screen-size-changes.patch

File 0001-Palette-update-position-when-the-screen-size-changes.patch, 2.3 KB (added by manuq, 8 years ago)
  • src/sugar3/graphics/palettewindow.py

    From e982600b0e355316a458a77d094fcab650bcb249 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Sat, 24 Nov 2012 11:28:06 -0300
    Subject: [PATCH toolkit] Palette: update position when the screen size
     changes - SL #3833
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    This is the same issue as seen in shell commit b6a30769 .
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/sugar3/graphics/palettewindow.py | 24 +++++++++++++++++++++---
     1 file changed, 21 insertions(+), 3 deletions(-)
    
    diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py
    index 7063681..951a6e2 100644
    a b class PaletteWindow(GObject.GObject): 
    501501
    502502        self._mouse_detector = MouseSpeedDetector(200, 5)
    503503
     504        screen = Gdk.Screen.get_default()
     505        screen.connect('size-changed', self.__size_changed_cb)
     506
     507    def __size_changed_cb(self, screen):
     508        self.update_position()
     509
    504510    def _setup_widget(self):
    505511        self._widget.connect('show', self.__show_cb)
    506512        self._widget.connect('hide', self.__hide_cb)
    class Invoker(GObject.GObject): 
    770776        self.parent = None
    771777
    772778        self._screen_area = Gdk.Rectangle()
    773         self._screen_area.x = self._screen_area.y = 0
    774         self._screen_area.width = Gdk.Screen.width()
    775         self._screen_area.height = Gdk.Screen.height()
     779        self._screen_area.x = 0
     780        self._screen_area.y = 0
     781
     782        screen = Gdk.Screen.get_default()
     783        screen.connect('size-changed', self.__size_changed_cb)
     784        self._update_screen_size(screen)
     785
    776786        self._position_hint = self.ANCHORED
    777787        self._cursor_x = -1
    778788        self._cursor_y = -1
    class Invoker(GObject.GObject): 
    782792        self._lock_palette = False
    783793        self.locked = False
    784794
     795
     796    def __size_changed_cb(self, screen):
     797        self._update_screen_size(screen)
     798
     799    def _update_screen_size(self, screen):
     800        self._screen_area.width = screen.width()
     801        self._screen_area.height = screen.height()
     802
    785803    def attach(self, parent):
    786804        self.parent = parent
    787805