Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-07-12 12:11:19 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-07-12 12:11:19 (GMT)
commit05405976ad96aabfe21785faee694015e9b5a069 (patch)
tree77d1068d37412e4e2867880ef0368e80d75fd634
parent59f230ca6470d5ab4d0546d0a9f4745753c3cf8c (diff)
Pass the event timestamp to window management operations
-rw-r--r--src/jarabe/view/keyhandler.py58
-rw-r--r--src/jarabe/view/tabbinghandler.py35
2 files changed, 48 insertions, 45 deletions
diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py
index 1f75851..5634ef4 100644
--- a/src/jarabe/view/keyhandler.py
+++ b/src/jarabe/view/keyhandler.py
@@ -166,69 +166,69 @@ class KeyHandler(object):
self._get_speech_proxy().SayText(text, reply_handler=lambda: None, \
error_handler=self._on_speech_err)
- def handle_say_text(self):
+ def handle_say_text(self, event_time):
clipboard = gtk.clipboard_get(selection="PRIMARY")
clipboard.request_text(self._primary_selection_cb)
- def handle_previous_window(self):
- self._tabbing_handler.previous_activity()
+ def handle_previous_window(self, event_time):
+ self._tabbing_handler.previous_activity(event_time)
- def handle_next_window(self):
- self._tabbing_handler.next_activity()
+ def handle_next_window(self, event_time):
+ self._tabbing_handler.next_activity(event_time)
- def handle_close_window(self):
+ def handle_close_window(self, event_time):
active_activity = shell.get_model().get_active_activity()
if active_activity.is_journal():
return
active_activity.get_window().close()
- def handle_zoom_mesh(self):
+ def handle_zoom_mesh(self, event_time):
shell.get_model().zoom_level = ShellModel.ZOOM_MESH
- def handle_zoom_group(self):
+ def handle_zoom_group(self, event_time):
shell.get_model().zoom_level = ShellModel.ZOOM_GROUP
- def handle_zoom_home(self):
+ def handle_zoom_home(self, event_time):
shell.get_model().zoom_level = ShellModel.ZOOM_HOME
- def handle_zoom_activity(self):
+ def handle_zoom_activity(self, event_time):
shell.get_model().zoom_level = ShellModel.ZOOM_ACTIVITY
- def handle_brightness_max(self):
+ def handle_brightness_max(self, event_time):
self._change_brightness(value=_BRIGHTNESS_MAX)
- def handle_brightness_min(self):
+ def handle_brightness_min(self, event_time):
self._change_brightness(value=0)
- def handle_volume_max(self):
+ def handle_volume_max(self, event_time):
self._change_volume(value=_VOLUME_MAX)
- def handle_volume_min(self):
+ def handle_volume_min(self, event_time):
self._change_volume(value=0)
- def handle_brightness_up(self):
+ def handle_brightness_up(self, event_time):
self._change_brightness(step=_BRIGHTNESS_STEP)
- def handle_brightness_down(self):
+ def handle_brightness_down(self, event_time):
self._change_brightness(step=-_BRIGHTNESS_STEP)
- def handle_volume_mute(self):
+ def handle_volume_mute(self, event_time):
if sound.get_muted() is True:
sound.set_muted(False)
else:
sound.set_muted(True)
- def handle_volume_up(self):
+ def handle_volume_up(self, event_time):
self._change_volume(step=_VOLUME_STEP)
- def handle_volume_down(self):
+ def handle_volume_down(self, event_time):
self._change_volume(step=-_VOLUME_STEP)
- def handle_frame(self):
+ def handle_frame(self, event_time):
self._frame.notify_key_press()
- def handle_rotate(self):
+ def handle_rotate(self, event_time):
"""
Handles rotation of the display (using xrandr) and of the d-pad.
@@ -268,13 +268,13 @@ class KeyHandler(object):
if e.errno != errno.EINTR:
raise
- def handle_quit_emulator(self):
+ def handle_quit_emulator(self, event_time):
session.get_session_manager().shutdown()
- def handle_open_search(self):
+ def handle_open_search(self, event_time):
journalactivity.get_journal().focus_search()
- def _key_pressed_cb(self, grabber, keycode, state):
+ def _key_pressed_cb(self, grabber, keycode, state, event_time):
key = grabber.get_key(keycode, state)
logging.debug('_key_pressed_cb: %i %i %s' % (keycode, state, key))
if key:
@@ -287,14 +287,14 @@ class KeyHandler(object):
# Only accept window tabbing events, everything else
# cancels the tabbing operation.
if not action in ["next_window", "previous_window"]:
- self._tabbing_handler.stop()
+ self._tabbing_handler.stop(event_time)
return True
if hasattr(action, 'handle_key_press'):
action.handle_key_press(key)
elif isinstance(action, basestring):
method = getattr(self, 'handle_' + action)
- method()
+ method(event_time)
else:
raise TypeError('Invalid action %r' % action)
@@ -303,17 +303,17 @@ class KeyHandler(object):
# If this is not a registered key, then cancel tabbing.
if self._tabbing_handler.is_tabbing():
if not grabber.is_modifier(keycode):
- self._tabbing_handler.stop()
+ self._tabbing_handler.stop(event_time)
return True
return False
- def _key_released_cb(self, grabber, keycode, state):
+ def _key_released_cb(self, grabber, keycode, state, event_time):
if self._tabbing_handler.is_tabbing():
# We stop tabbing and switch to the new window as soon as the
# modifier key is raised again.
if grabber.is_modifier(keycode, mask=_TABBING_MODIFIER):
- self._tabbing_handler.stop()
+ self._tabbing_handler.stop(event_time)
return True
return False
diff --git a/src/jarabe/view/tabbinghandler.py b/src/jarabe/view/tabbinghandler.py
index b1c85c6..0cb053e 100644
--- a/src/jarabe/view/tabbinghandler.py
+++ b/src/jarabe/view/tabbinghandler.py
@@ -15,8 +15,10 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import logging
-import gtk
+import time
+
import gobject
+import gtk
from jarabe.model import shell
@@ -57,27 +59,28 @@ class TabbingHandler(object):
else:
self._frame.show(self._frame.MODE_NON_INTERACTIVE)
- def __timeout_cb(self):
- self._activate_current()
+ def __timeout_cb(self, event_time):
+ self._activate_current(event_time)
self._timeout = None
return False
- def _start_timeout(self):
+ def _start_timeout(self, event_time):
self._cancel_timeout()
- self._timeout = gobject.timeout_add(_RAISE_DELAY, self.__timeout_cb)
+ self._timeout = gobject.timeout_add(_RAISE_DELAY,
+ lambda: self.__timeout_cb(event_time))
def _cancel_timeout(self):
if self._timeout:
gobject.source_remove(self._timeout)
self._timeout = None
- def _activate_current(self):
+ def _activate_current(self, event_time):
home_model = shell.get_model()
activity = home_model.get_tabbing_activity()
if activity and activity.get_window():
- activity.get_window().activate(1)
+ activity.get_window().activate(event_time)
- def next_activity(self):
+ def next_activity(self, event_time):
if not self._tabbing:
first_switch = True
self._start_tabbing()
@@ -96,11 +99,11 @@ class TabbingHandler(object):
activity = shell_model.get_next_activity(current=activity)
shell_model.set_tabbing_activity(activity)
- self._start_timeout()
+ self._start_timeout(event_time)
else:
- self._activate_next_activity()
+ self._activate_next_activity(event_time)
- def previous_activity(self):
+ def previous_activity(self, event_time):
if not self._tabbing:
first_switch = True
self._start_tabbing()
@@ -121,14 +124,14 @@ class TabbingHandler(object):
shell_model.set_tabbing_activity(activity)
self._start_timeout()
else:
- self._activate_next_activity()
+ self._activate_next_activity(event_time)
- def _activate_next_activity(self):
+ def _activate_next_activity(self, event_time):
next_activity = shell.get_model().get_next_activity()
if next_activity:
- next_activity.get_window().activate(gtk.get_current_event_time())
+ next_activity.get_window().activate(event_time)
- def stop(self):
+ def stop(self, event_time):
gtk.gdk.keyboard_ungrab()
gtk.gdk.pointer_ungrab()
self._tabbing = False
@@ -136,7 +139,7 @@ class TabbingHandler(object):
self._frame.hide()
self._cancel_timeout()
- self._activate_current()
+ self._activate_current(event_time)
home_model = shell.get_model()
home_model.set_tabbing_activity(None)