Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Levenson <alexlevenson@laptop.org>2008-07-10 22:10:16 (GMT)
committer Alex Levenson <alexlevenson@laptop.org>2008-07-10 22:10:16 (GMT)
commit3889f644d5fb387c5abc6373315c2b1c2263bb45 (patch)
tree7d6cc8d4729c52bbe3b10b2311b781c30318630e
parent9d9aaef068147e022b4075bdf00defa3dc3c648a (diff)
(hopefully) fixed focus issues
-rw-r--r--[-rwxr-xr-x]olpcgames/activity.py0
-rw-r--r--physics.py1
-rw-r--r--tools.py10
3 files changed, 7 insertions, 4 deletions
diff --git a/olpcgames/activity.py b/olpcgames/activity.py
index 538ba13..538ba13 100755..100644
--- a/olpcgames/activity.py
+++ b/olpcgames/activity.py
diff --git a/physics.py b/physics.py
index 2987d1f..48d9464 100644
--- a/physics.py
+++ b/physics.py
@@ -31,6 +31,7 @@ class PhysicsGame:
# get everything set up
self.clock = pygame.time.Clock()
self.font = pygame.font.Font(None, 24) # font object
+ self.canvas = olpcgames.ACTIVITY.canvas
# setup tools
self.tools = {
diff --git a/tools.py b/tools.py
index 1fbb32f..b0c83c4 100644
--- a/tools.py
+++ b/tools.py
@@ -12,6 +12,7 @@ class Tool(object):
self.game = gameInstance
self.name = "Tool"
def handleEvents(self,event):
+ handled = True
# default event handling
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
# bye bye! Hope you had fun!
@@ -39,11 +40,12 @@ class Tool(object):
elif event.type == USEREVENT:
if hasattr(event,"action"):
if self.game.tools.has_key(event.action): self.game.setTool(event.action)
-
+ elif event.type == MOUSEBUTTONDOWN and event.button == 1:
+ self.game.canvas.grab_focus()
+ handled = False
else:
- # let the subclasses know that no events were handled yet
- return False
- return True
+ handled = False
+ return handled
def draw(self):
# default drawing method is don't draw anything
pass