Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Martin <gary@garycmartin.com>2010-10-13 14:29:17 (GMT)
committer Gary Martin <gary@garycmartin.com>2010-10-13 14:29:17 (GMT)
commit2e2acd9b55e23010c93021b9690aebec744cd88a (patch)
treeffca8e4d19ec7c96fb795cc41d109d897a620a38
parent5c972a0dd761226e3e83c85f00eaded79570e5c2 (diff)
Fixed special case where switching to a Sugar desktop view did not trigger a low cpu idle.
-rw-r--r--activity.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/activity.py b/activity.py
index 477303d..e9e847a 100644
--- a/activity.py
+++ b/activity.py
@@ -45,6 +45,7 @@ class PhysicsActivity(olpcgames.PyGameActivity):
super(PhysicsActivity, self).__init__(handle)
self.metadata['mime_type'] = 'application/x-physics-activity'
self.connect('visibility-notify-event', self._focus_event)
+ self.connect('window-state-event', self._window_event)
def get_preview(self):
"""Custom preview code to get image from pygame.
@@ -183,3 +184,10 @@ class PhysicsActivity(olpcgames.PyGameActivity):
else:
pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT,
action="focus_in"))
+
+ def _window_event(self, window, event):
+ """Send focus out event to pygame when switching to a desktop view.
+ """
+ if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
+ pygame.event.post(olpcgames.eventwrap.Event(pygame.USEREVENT,
+ action="focus_out"))