From 8449f907cb87063a75191ba91f1ff9af32e6c2cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
Date: Thu, 10 May 2012 10:59:30 -0300
Subject: [PATCH v2 Terminal] Prevent Sugar capture <Ctrl>z and <Ctrl>q send
them to vte SL #3222 OLPC #11836 Used the same
approach than the solution for the Escape
capture when the activity is fullscreen mode.
Refactored the method to allow this keystrokes.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
This fixes http://dev.laptop.org/ticket/11836 and
http://bugs.sugarlabs.org/ticket/3222 .
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Reviewed-by: James Cameron <quozl@laptop.org>
Tested-by: James Cameron <quozl@laptop.org>
---
terminal.py | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/terminal.py b/terminal.py
index 6de7500..ee46fdc 100644
a
|
b
|
class TerminalActivity(activity.Activity): |
380 | 380 | vt.fork_command("/bin/su", ('/bin/su', '-')) |
381 | 381 | |
382 | 382 | def __key_press_cb(self, window, event): |
383 | | # Escape keypresses are routed directly to the vte and then dropped. |
384 | | # This hack prevents Sugar from hijacking them and canceling |
385 | | # fullscreen mode. |
386 | | if gtk.gdk.keyval_name(event.keyval) == 'Escape': |
| 383 | """Route some keypresses directly to the vte and then drop them. |
| 384 | |
| 385 | This prevents Sugar from hijacking events that are useful in |
| 386 | the vte. |
| 387 | |
| 388 | """ |
| 389 | |
| 390 | def event_to_vt(event): |
387 | 391 | current_page = self._notebook.get_current_page() |
388 | 392 | vt = self._notebook.get_nth_page(current_page).vt |
389 | 393 | vt.event(event) |
| 394 | |
| 395 | key_name = gtk.gdk.keyval_name(event.keyval) |
| 396 | |
| 397 | # Escape is used in Sugar to cancel fullscreen mode. |
| 398 | if key_name == 'Escape': |
| 399 | event_to_vt(event) |
390 | 400 | return True |
391 | 401 | |
| 402 | elif event.get_state() & gtk.gdk.CONTROL_MASK: |
| 403 | if key_name in ['z', 'q']: |
| 404 | event_to_vt(event) |
| 405 | return True |
| 406 | |
392 | 407 | return False |
393 | 408 | |
394 | 409 | def read_file(self, file_path): |