Re: [gtk-list] Re: gdkkeysyms.h question





Havoc Pennington wrote:
> 
> On Fri, 17 Sep 1999, Andreas Leitner wrote:
> >
> > I have no idea about any road map for GTK, but do you consider that this
> > additional abstraction is a valuable goal for one of the next versions?
> >
> 
> It might be reasonable to mash all the Tab variants into GDK_Tab,
> that makes sense to me. I don't make the decisions though. :-)
> 
> We did see a keyboard with a separate tab key on the keypad today at the
> computer store, so go figure. Maybe someone out there would like to have
> that key do something different from the regular tab key. It does make me
> a little nervous to keep them from doing that.

I see. But my suggestion was not only for tab, but for all those other
common keys CAPS-LOCK, SHIFT, ...

>From my point of view, things like GLIB or even XLib should hide details
like that from the customer. The Xlib keyboard routines are there, so I
do not need to programm for every keyboard out there, but only for one
(abstract) keyboard. Of course one has to think hard to find a good
abstraction, that does not prevent using all the features of some
esoteric keyboards. But the current apporach seems to me pretty much
like a hack.

If there is a keyboard that has a 2 different tab keys, we should find a
way to distinguish those keys for those applications that really need to
take care of that fact. But we must also find a clean and easy way for
all the other 99.9% (; of applications to deal with just TAB keys
(mostly they don't care which TAB has been pressed, they are only
interested in the fact that TAB _has_ been pressed). 

One way to do that would be:

Declare a certain set of constants from the keysyms file as the basic
set. This set must not have redundant keys. Then provide a function that
takes a keyval and if the given value is not in the basic set, return
the corresponding value from the basic set.

Ie (pseudo code): 

int translate_keysm (int keyval)
{
	// translate keyval into one of the keys in basic set
	switch (keyval)
	{
		GDK_Tab:
		GDK_KP_Tab:
		GDK_ISO_Left_Tab:
		GDK_3270_BackTab:
			return GDK_Tab;
		...
	}
}

	

For example: if we declare a certain set of constants from the keysyms
table as standard, and the provide a function that takes a keyval and
converts it for all values that are not in the basic set into a value
from the basic set.

This way applications _may_ choose between all the information or the
simpler abstraction.

best regards,
Andreas



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