[Sugar-devel] [PATCH v2 Terminal] Prevent Sugar capture <Ctrl>z and <Ctrl>q send them to vte SL #3222 OLPC #11836

Rafael Ortiz rafael at activitycentral.com
Thu May 10 16:59:31 EDT 2012


On Thu, May 10, 2012 at 5:21 PM, Manuel Quiñones <manuq at laptop.org> wrote:

> The latest is the one, sorry for the mistake.
>
> /me thinks this proccess is too error-prone.
>
> 2012/5/10 Manuel Quiñones <manuq at laptop.org>:
> > Used the same approach than the solution for the Escape
> > capture when the activity is fullscreen mode.  Refactored the
> > method to allow this keystrokes.
> >
> > This fixes http://dev.laptop.org/ticket/11836 and
> > http://bugs.sugarlabs.org/ticket/3222 .
> >
> > Signed-off-by: Manuel Quiñones <manuq at laptop.org>
> > Reviewed-by: James Cameron <quozl at laptop.org>
> > Tested-by: James Cameron <quozl at 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/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):
> > --
> > 1.7.7.6
> >
>
>
>
>
Applied as


http://git.sugarlabs.org/terminal/mainline/commit/ffd25f6841295a956d7fab921e49cbbd99f820ec

Should be in next version.

--
> .. manuq ..
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120510/0c80bb48/attachment-0001.html>


More information about the Sugar-devel mailing list