Re: New key-binding system
- From: Owen Taylor <otaylor redhat com>
- To: gtk-list redhat com
- Subject: Re: New key-binding system
- Date: 14 Jul 1998 13:00:12 -0400
Tom Tromey <tromey@cygnus.com> writes:
> I have a couple questions about the new key binding scheme.
>
> Owen> bind "<Control>c" { "cut-clipboard" () }
>
> Can you have multi-key bindings? E.g., to emulate Emacs I'd like to
> have all my apps map "C-x C-c" to "quit()". Is this possible?
As of right now, it is not. It wouldn't be impossible to add
(and is present, for instance, in Tk, and I think also in Xt),
but my initial guess was that it was more trouble than it was
worth.
[ There are some slighlty sticky issues to worry about - on
the matching side - for instance, we do have key-release bindings
as well (or I think we decided to add them), so you need
to make
"<control>x;<control>c"
match a sequence like
"<control>" "<control>x" "<release><control>" "<release>x"
"<control>" "<control>c"
Which is the actual sequence of bindable events that
GTK+ will see ]
I suppose it would help with pseudo-vi bindings as well
as pseudo-emacs bindings, though. You could get things like
'dd' to work, though not 'y4w'.
As far as getting anything to map to quit(), I suppose the
way to do it would be:
bind "xyz" { "activate-menu" ("File/Quit") }
> How is localization handled? For instance, what will the default
> binding for the left arrow key be? It either has to be different for
> l-to-r and r-to-l locales, or it has to have a strange -- physical and
> not logical -- functional mapping. I suppose each right/left-motion
> action signal could have both a physical and a logical variant, so
> that both "C-f" and "right arrow" could be sensibly bound by default
> in a locale-independent way (this presumes that C-f would always be
> "logical forward"). This seems baroque, though.
Hmmm, I didn't think about that. I see to ways to handle it:
The gross, but functional hack:
If the widget has the "mirror" flag set, then before matching
any bindings for that widget, swap the Left and Right keysyms.
The complicated but "clean" solution:
Add a mechanism for conditional keybindings to the setup
so that different bindings for Left and Right can be specified
for mirrored and non-mirrored widgets.
I think for widgets like Entry or Text where the logical
forward direction can change, the only thing to do is to
have separate physical and logical actions.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]