Re: Key bindings and subclasssing (was: Language bindings and popup_menu and show_help signals)



On Thu, 2006-04-20 at 18:56 -0500, Yevgen Muntyan wrote:
> On Thu, April 20, 2006 12:59 pm, Owen Taylor wrote:
> 
> > We've made no general attempt to make binding signals overriddable.
> > You might be able to do something cool by overriding one of them,
> > but that's not the intent of the API. When there is a binding signal
> > it means that we wanted to make the keybindings customizable by
> > the user or a key theme author. That's all.
> 
> Was it the intent or not, it is possible to override key bindings signals,
> and it works. Is it not supported use of those signals? If not, how
> one is supposed to customize what ctrl-arrows do in GtkTextView, for
> example?
> One can't just connect to key-press-event and hardcode keys, since there
> are gtk key bindings. One can't install new bindings (with new signal
> names) since they won't get overridden if user changes bindings for parent
> class. One can't create a signal with the same name. Overriding key
> binding signal is the only way to customize keyboard behaviour (not just
> screw it up to make Ctrl-Left do my special thing regardless of what user
> wrote in rc file or something). Or do I miss something?

IMO, there is no API in GtkTextView for customizing the cursor
navigation; anything you do ... whether overriding move-cursor,
connecting to key press events, etc, is a hack. Now, these hacks are
"ABI supported", in that we are very unlikely to remove the signal
or modify it, but they are inherently fragile and are not really
supportable at the level of behavioral details. If some new feature
is added to GtkTextView it may have strange and unpleasant interactions
with your hack.

In my further opinion, the right sort of API for customization here is
likely not at the level of user actions, but at the level of how
GtkTextView understands its contents. After all, if you customize
word navigation by overriding move-cursor, you've created a disconnect
between the word boundaries for keynav and the word boundaries the
users sees when they double-click to select words with the mouse.

Regards,
					Owen

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]