Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugargame
diff options
context:
space:
mode:
authorWade Brainerd <wadetb@gmail.com>2009-11-21 17:17:08 (GMT)
committer Wade Brainerd <wadetb@gmail.com>2009-11-21 17:17:08 (GMT)
commit7f8f78bfbce3406981c203c878a892e1065e4e4d (patch)
tree5214d6c8da366c98c399bcf708ce215fc98f4b76 /sugargame
parente02b66129dc1b6450d357b9df29de10bf35c42fe (diff)
Make Pygame display size match the widget size.
Also rename _canvas member to _pygamecanvas to avoid conflict with Sugar.
Diffstat (limited to 'sugargame')
-rw-r--r--sugargame/event.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sugargame/event.py b/sugargame/event.py
index 42fca1e..b315c1c 100644
--- a/sugargame/event.py
+++ b/sugargame/event.py
@@ -70,6 +70,12 @@ class Translator(object):
self._inner_evb.connect('expose-event', self._expose_cb)
self._inner_evb.connect('configure-event', self._resize_cb)
+ # Fake the first VIDEORESIZE event to set the initial screen dimensions.
+ r = self._inner_evb.get_allocation()
+ evt = pygame.event.Event(pygame.VIDEORESIZE,
+ size=(r.width,r.height), width=r.width, height=r.height)
+ pygame.event.post(evt)
+
# Internal data
self.__stopped = False
self.__keystate = [0] * 323
@@ -92,7 +98,7 @@ class Translator(object):
return True
def _resize_cb(self, widget, event):
- evt = pygame.event.Event(pygame.event.VIDEORESIZE,
+ evt = pygame.event.Event(pygame.VIDEORESIZE,
size=(event.width,event.height), width=event.width, height=event.height)
pygame.event.post(evt)
return False # continue processing