Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/terminal.py
diff options
context:
space:
mode:
authorRafael Ortiz <rafael@activitycentral.com>2012-05-10 20:32:36 (GMT)
committer Rafael Ortiz <rafael@activitycentral.com>2012-05-10 20:47:21 (GMT)
commit2ee6c30ff5d98e381f5eef6caa5bb1c73cd6a035 (patch)
treea73854c98b073ac130c56eab60e1745db8b08d83 /terminal.py
parenta12a16b70eaa819b41733a911c0718484f79965c (diff)
Used the same approach than the solution for the Escape
capture when the activity is fullscreen mode. Refactored the method to allow these keystrokes. It prevents sugar to capture-Ctrl-z-and-Ctrl-q and send them to vte This fixes http://dev.laptop.org/ticket/11836 and http://bugs.sugarlabs.org/ticket/3222 .
Diffstat (limited to 'terminal.py')
-rw-r--r--terminal.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/terminal.py b/terminal.py
index 6de7500..ee46fdc 100644
--- a/terminal.py
+++ b/terminal.py
@@ -380,15 +380,30 @@ class TerminalActivity(activity.Activity):
vt.fork_command("/bin/su", ('/bin/su', '-'))
def __key_press_cb(self, window, event):
- # Escape keypresses are routed directly to the vte and then dropped.
- # This hack prevents Sugar from hijacking them and canceling
- # fullscreen mode.
- if gtk.gdk.keyval_name(event.keyval) == 'Escape':
+ """Route some keypresses directly to the vte and then drop them.
+
+ This prevents Sugar from hijacking events that are useful in
+ the vte.
+
+ """
+
+ def event_to_vt(event):
current_page = self._notebook.get_current_page()
vt = self._notebook.get_nth_page(current_page).vt
vt.event(event)
+
+ key_name = gtk.gdk.keyval_name(event.keyval)
+
+ # Escape is used in Sugar to cancel fullscreen mode.
+ if key_name == 'Escape':
+ event_to_vt(event)
return True
+ elif event.get_state() & gtk.gdk.CONTROL_MASK:
+ if key_name in ['z', 'q']:
+ event_to_vt(event)
+ return True
+
return False
def read_file(self, file_path):