[Y-devel] Logical input devices

Mikko Rantalainen mira at cc.jyu.fi
Sat Feb 28 12:03:33 GMT 2004


Brent Gulanowski wrote at 2004-02-26 00:02:
> I want to double check on a point of terminology. I think there is some 
> confusion between a _logical_ device and a _virtual_ device -- they are 
> very different. A virtual device is something that simulates a hardware 
> device. A logical device abstracts a hardware device -- it can abstract 

Fair enough. I don't agree with your view that logical devices must 
be built out of hardware devices. As far as Y is interested, the 
closest the hardware input thingy we have should be a logical 
device. Input drivers should take care of handling the little details.

As I've thought about these logical devices a little more, I think 
the most abstract method is to represent them as a group of axis. A 
regular keyboard has 101 axis, a keyboard with some multimedia 
buttons and a scroll wheel has, for example, 115 axis. A tree button 
mouse with a scroll wheel has 6 axis (x,y,left,middle,right,wheel). 
Logical input device should be able to provide value of every axis 
*and* granularity of that axis *and* information if the axis is 
relative (like mouse movement, no limits) or absolute (like joystick 
movement, physical movement +/- 45 degrees). This allows us to be 
forward compatible with future keyboards where every button is 
"analog" or keyboards with sliders and/or wheels. Plus, the output 
API will be truly abstract as every input event looks the same. Why 
mess with "buttons" and "wheels" when it really doesn't matter.

For example, a basic ENTER button would be an axis with only two 
states, so it could only have status of 0 or 1. However, if the user 
so decides, he could use another input driver for that keyboard and 
the driver could emulate the missing states. Pressing the button 
shortly would result to 0.1, keeping it down for a longer time would 
result to 1.0.

On top of this logical device (which some applications, like games, 
would use directly) would reside the logical character input driver 
which would constantly get events from logical device and output 
characters. This layer would be pretty similar to keymap, but it 
could do a bit more. For example, somebody said that X cannot handle 
keyboard shortcuts in case the character map is modified because 
those keyboard shortcuts are designed for some special keyboard 
layout. Character input driver of Y should be allowed to generate 
multiple "characters" for a single keypress. If somebody has 
remapped the keyboard to give "compose+non-breaking-space" charcter 
for some combination of keypresses, this layer should be able to 
output Ctrl+Shift+AltGr+Y in addition to that special character 
above, which only a few selected applications could handle. 
Applications could then decide to read character input or handle key 
combination instead.

Some things to consider:
1) which level should handle repeating of characters when the key 
has been pressed for some time?
2) I think we should allow any key to work as a modificator (instead 
of simply Ctrl, Alt, AltGr, Shift, Meta, Super, Hyper). However, 
current keyboards give output of "a" and "b" in case of the 
following key sequence: "a down", "b down", "b up", "a up". Should 
Y's logical character driver generate characters "a","b","a+b" or 
"a","a+b","b" (I think it should be the latter). Does it matter?
3) How should the characters be outputted from the driver. If we 
allow any key combination, we cannot output a character with a full 
mod key bitmap like X does. Perhaps an array of all currently 
pressed keys?
4) Should the user be able to customize behavior of logical input 
device (emulation of different key emulations). Probably yes? If so, 
should the customization have some kind of API or should this be 
driver dependant? The same issue needs to be decided for the 
character input driver too.

-- 
Mikko



More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved