diff options
author | flavio <fdanesse@gmail.com> | 2012-07-01 19:10:27 (GMT) |
---|---|---|
committer | flavio <fdanesse@gmail.com> | 2012-07-01 19:10:27 (GMT) |
commit | 4281808b1e911a43ceaaade9ade8f4a7ac9de4f0 (patch) | |
tree | a8b5f20c93f29157a351febe9d637232df11fdcf | |
parent | 6b1703e85294c3d686dba1d77afef7453cd70bc2 (diff) |
Correcciones sobre los Eventos
-rwxr-xr-x | activity.py | 10 | ||||
-rw-r--r-- | olpcgames/canvas.py | 2 | ||||
-rw-r--r-- | olpcgames/gtkEvent.py | 16 |
3 files changed, 11 insertions, 17 deletions
diff --git a/activity.py b/activity.py index 2d7e0df..4868ea8 100755 --- a/activity.py +++ b/activity.py @@ -55,11 +55,9 @@ class MazeActivity(olpcgames.PyGameActivity): return toolbar_box def _easier_button_cb(self, button): - #pygame.event.post(olpcgames.eventwrap.Event( - # pygame.USEREVENT, action='easier_button')) - pass + pygame.event.post(olpcgames.eventwrap.Event( + pygame.USEREVENT, action='easier_button')) def _harder_button_cb(self, button): - #pygame.event.post(olpcgames.eventwrap.Event( - # pygame.USEREVENT, action='harder_button')) - pass + pygame.event.post(olpcgames.eventwrap.Event( + pygame.USEREVENT, action='harder_button')) diff --git a/olpcgames/canvas.py b/olpcgames/canvas.py index 4f0096e..9ccc476 100644 --- a/olpcgames/canvas.py +++ b/olpcgames/canvas.py @@ -38,10 +38,8 @@ class PygameCanvas(Gtk.Layout): # Build the main widget log.info( 'Creating the pygame canvas' ) super(PygameCanvas,self).__init__() - #self.set_flags(Gtk.CAN_FOCUS) # Build the sub-widgets - #self._align = Gtk.Alignment(0.5, 0.5) self._align = Gtk.Alignment() self._inner_evb = Gtk.EventBox() self._socket = Gtk.Socket() diff --git a/olpcgames/gtkEvent.py b/olpcgames/gtkEvent.py index 13304af..6be38ca 100644 --- a/olpcgames/gtkEvent.py +++ b/olpcgames/gtkEvent.py @@ -229,21 +229,19 @@ class Translator(GObject.Object): # From http://www.learningpython.com/2006/07/25/writing-a-custom-widget-using-pygtk/ # if this is a hint, then let's get all the necessary # information, if not it's all we need. - if event.is_hint: - x, y, state = event.window.get_pointer() - else: - x = event.x - y = event.y - state = event.state + + x = event.x + y = event.y + state = event.state rel = (x - self.__mouse_pos[0], y - self.__mouse_pos[1]) self.__mouse_pos = (x, y) self.__button_state = [ - state & Gdk.EventMask.BUTTON1_MASK and 1 or 0, - state & Gdk.EventMask.BUTTON2_MASK and 1 or 0, - state & Gdk.EventMask.BUTTON3_MASK and 1 or 0, + state & Gdk.EventMask.BUTTON1_MOTION_MASK and 1 or 0, + state & Gdk.EventMask.BUTTON2_MOTION_MASK and 1 or 0, + state & Gdk.EventMask.BUTTON3_MOTION_MASK and 1 or 0, ] evt = eventwrap.Event(pygame.MOUSEMOTION, |