[Haskell-cafe] Suggestion: define a standard keyboard codes library?
Several libraries define their own codes for they keyboard (GLFW, GTK, GLUT, etc) Maybe it would be nice to agree on a standard datatype for keys? This might also include digital buttons on a joystick, etc... The Windows API has virtual key codes for this. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?
Peter Verswyvelen wrote: Several libraries define their own codes for they keyboard (GLFW, GTK, GLUT, etc) Maybe it would be nice to agree on a standard datatype for keys? This might also include digital buttons on a joystick, etc... The Windows API has virtual key codes for this. X windows key symbols are used extensively in XMonad. They are found in the X11 package, in the modules Graphics.X11.Types and Graphics.X11.ExtraTypes. -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?
But should we use X11 as the standard library then, even on Windows or Mac? It surely is better than nothing, but it feels a bit weird to install X11 just for using the key codes. Maybe splitting these keys into a separate package would be a good idea? On Wed, Aug 26, 2009 at 12:42 PM, Yitzchak Gale g...@sefer.org wrote: Peter Verswyvelen wrote: Several libraries define their own codes for they keyboard (GLFW, GTK, GLUT, etc) Maybe it would be nice to agree on a standard datatype for keys? This might also include digital buttons on a joystick, etc... The Windows API has virtual key codes for this. X windows key symbols are used extensively in XMonad. They are found in the X11 package, in the modules Graphics.X11.Types and Graphics.X11.ExtraTypes. -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?
Peter Verswyvelen wrote: Several libraries define their own codes for they keyboard (GLFW, GTK, GLUT, etc) Maybe it would be nice to agree on a standard datatype for keys? ...The Windows API has virtual key codes for this. I wrote: X windows key symbols... are found in the X11 package But should we use X11 as the standard library then, even on Windows or Mac? Certainly not. X11 has its own philosophy of key virtualization. You would likely encounter serious impedance mismatch on other platforms. Maybe splitting these keys into a separate package would be a good idea? No, they are an integral part of X. I would assume the same is true for WinAPI VKeys, and whatever the corresponding thing is on the Mac. That probably explains why each graphics framework defines its own concept of key mapping, to match its own concept of platform dependence. Here's an example: suppose you want ^C to be copy in your app. Well, what if the user currently has a Dvorak layout - do you really want ^C, or do you want the third physical key to the right of the left shift key? And what if the current keyboard layout is Russian - which Cyrillic letter should be copy? And what if we happen to be on a mobile device or a tablet? Etc. Each platform addresses these issues in its own way, so the concept of a key code doesn't necessarily translate directly from one to the other. I don't think that key binding is so complicated that it's impossible to come up with a reasonable one ring that binds them all library. But it's not so simple as just lining up key code charts with one another. -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?
Excerpts from Peter Verswyvelen's message of Wed Aug 26 12:15:14 +0200 2009: Maybe it would be nice to agree on a standard datatype for keys? This might also include digital buttons on a joystick, etc... The synergy project (sourceforge) already does some mapping from Windows - Linux - Mac AFAIK. It forwards key input to the other system over network. This could be a source of additional information. However I haven't looked at the code yet. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?
I would already be happy with a low level library that holds the union of all keys, assigning them unique codes. So you would have keys like Apple, Amiga, Windows, Start, Popup, LeftControl, RightControl, etc... No mapping is done at the low level. Then one would need an OS dependent interface to figure out which keys are available. Which keyboard bindings (like CTRL+C or CTRL+INSERT) are assigned to which user interface commands is a high level binding, which in the perfect UI is configurable anyway, although the OS dependent interface should provide a lot of defaults (again different on each system) However I only have experience with Windows, Amiga, a bit of OSX and tiny bit of Linux, so I don't know all the details of all esoteric systems. For now I will just use the bindings in the GLFW package. On Wed, Aug 26, 2009 at 3:34 PM, Marc Weber marco-owe...@gmx.de wrote: Excerpts from Peter Verswyvelen's message of Wed Aug 26 12:15:14 +0200 2009: Maybe it would be nice to agree on a standard datatype for keys? This might also include digital buttons on a joystick, etc... The synergy project (sourceforge) already does some mapping from Windows - Linux - Mac AFAIK. It forwards key input to the other system over network. This could be a source of additional information. However I haven't looked at the code yet. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe