Fix bug when opening/closing keyboard and orientation is not determined yet.
authorStefanos Harhalakis <v13@v13.gr>
Fri, 16 Jul 2010 19:55:53 +0000 (19:55 +0000)
committerStefanos Harhalakis <v13@v13.gr>
Fri, 16 Jul 2010 19:55:53 +0000 (19:55 +0000)
Postpone redraws when the widget's desktop is not visible.

src/icongrid.py
src/portrait.py
src/widget.py

index 670c80f..5924031 100755 (executable)
@@ -58,6 +58,8 @@ class IconGrid(object):       #(gobject.GObject):
        self.icons=None
        self.lasticon=None  # The last icon that got selected
 
+       self.draw_pending=False
+
     def do_realize(self, config):
        self.config=config
 
@@ -82,8 +84,14 @@ class IconGrid(object):      #(gobject.GObject):
 
     def setMode(self, mode):
        self.mode=mode
-       if isinstance(self, gtk.Widget):
+       if not isinstance(self, gtk.Widget):
+           return
+
+       v=self.get_property('is-on-current-desktop')
+       if v:
            self.queue_draw()
+       else:
+           self.draw_pending=True
 
     def iconAt(self, x, y):
        """ Get icon at coordinates x,y. X and Y are in pixels """
@@ -107,6 +115,8 @@ class IconGrid(object):     #(gobject.GObject):
        return(ret)
 
     def _draw(self, cr, event):
+       self.draw_pending=False
+
        w=self.config.iconsize + self.config.iconspace
        for x,y in self.icons:
            if self.mode=='l' or self.config.getIndiv():
index c398e39..8e0b2e7 100644 (file)
@@ -136,6 +136,9 @@ class FremantleRotation(object):
             # Ignore repeated requests
             return
 
+       if orientation == None:
+           return
+
         flags = 0
 
         if orientation != self._LANDSCAPE:
index 409cb3c..0492501 100755 (executable)
@@ -123,10 +123,12 @@ class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
        self.connect('show-settings', self.slot_show_settings)
        self.connect('long-press', self.signalLongpress)
        self.connect('click', self.signalClick)
+       self.connect('notify', self.signalNotify)
 
        HomePluginItem.do_realize(self)
 
     def on_orientation_changed(self, orientation):
+       # Get the first character of the string (l/p)
        o=orientation[0]
        self.setMode(o)
 #      self.queue_draw()
@@ -179,6 +181,12 @@ class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
        if not config.getLongpress():
            self.handle_click(sender, icon)
 
+    def signalNotify(self, sender, property):
+       if property.name=='is-on-current-desktop':
+           v=self.get_property(property.name)
+           if v and self.draw_pending:
+               self.queue_draw()
+
     def resize(self):
        config=self.get_config()