Re: key snoopers



In message <y5wbspugjk2 fsf icon labs redhat com>you write:
>
>srlytle_list yahoo com writes: 
>> my feeling is that the gtk focus model is great for quickly throwing
>> together something that sort of works (if you try, you can usually
>> convince the focus to go where you want it) but that it is extremely
>> difficult to make it work smoothly and intuitively.
>> 
>
>The focus model is basically the same as Windows, Qt, Swing, etc.,
>it's hardly an oddness of GTK.
>
>I don't really understand what you guys are suggesting as an
>alternative.

There is no alternative as a general formulation. The comparable GUI's
under Windows and Qt do the same thing: they completely disable or
short-circuit the toolkit focus model. Take a look (in my case) at
Samplitude, ProTools, Cubase and others, and you won't find much (if
any) evidence of this "standard" focus model.

The point is simply that the idea of keyboard focus being something
that should respond to "other" interactions (e.g. mouse clicks, TAB
keys) is not useful for programs with much more complex GUI's. We need
focus to remain where the program puts it until the program changes
it. Yes, you can do that within GTK+, but only with a lot of effort to
catch focus-in and focus-out events and cancel their effects and/or
removing the CAN_FOCUS flag from almost every widget.

GTK+ provides the key snooper, which is perfect for the alternative:
we catch key events before the rest of GTK even gets to see them. Then
we feed them to the widget chosen by the program at that time. Mouse
clicks, TAB keys and other methods of "navigating" cease to have any
effect, because they make no sense in a GUI with many many widgets and
complex ways of using the keys. 

and note: using gtk_set_focus() doesn't work if CAN_FOCUS is turned
off; if its not turned off, then certain widgets can grab focus and
prevent a top-level window handler from ever dealing with the key
events to start with (the code in gtkwindow.c does this; we discussed
it a couple of months ago).

--p





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