Sign in to follow this  
fimdan

Mouse/keyboard libraries for Linux -suggestions needed

Recommended Posts

Hello I have been recently looking at topics related to glx and X programming. Mouse and keyboard handling in X seems to be done largly trough XEvents (a feature present also in MS Windows). I am sure this is fine but I am was thinking: Is there another way of handling mouse and keybaord? I know about libraries such as SDL, SVGAlib but I am looking for something that would be the equivalent of (or similar to) DirectInput from MS. Does anybody know what recent 3D games (Doom3, Quake 3) ported to Linux used for mouse/keyboard? Any ideas? FimDan

Share this post


Link to post
Share on other sites
You can't separate input from Window management. X handles the window management, hence X will be handling the input.

SDL and GLFW wrap the X events for you in the same way as they do in Windows and other OS - thus sparing you the need to write platform-specific code.

It is pretty low level, and should do what you want. Ultimately, it's the same as on Windows - you get a message when keys go up, down, mouse buttons are pressed, move etc.

Mark

Share this post


Link to post
Share on other sites
Another thing maybe worth a look is the DGA X extension (XF86DGA or simply XDGA --> man XF86DGA). I stumbled over it by chance, when trying to find out how to chance the bit depth on a running X server. The Direct Graphics Access extension doesn't only allow you to mess with the frame buffer, but it also allows you to access a keyboard and mouse event queue, which is not dependant on your window (I hope I got that right).

Another thing: Afterwards I found out that Quake III Arena uses the DGA extension at least for mouse access, I don't know what it uses for keyboard access, though.

Hope that helps!

Cheers,
Drag0n

Share this post


Link to post
Share on other sites
Another framework/engine you might want to try is Daedalus (direct download here). It's built on top of GLFW and add a C++ layer over it. In addition to allowing you to get a window up and running with minimal code (see here for an example) it also has a task queue, and a resource system. More functionality is added to this every week. It currently runs on Windows and on Linux, but other platforms are planned.

Share this post


Link to post
Share on other sites
Quote:
Original post by Drag0n
Another thing maybe worth a look is the DGA X extension (XF86DGA or simply XDGA --> man XF86DGA).
Cheers,
Drag0n


Hey

Actually, I was looking at that too. What I discovered was that the fglx driver from ATI needs to have this extension disabled (look at xorg.conf). I am using an ATI card with my Emachines 6810 and the driver has been working ok for me (about 2000 fps on glxgears).

Overall DGA looks like an interesting piece to work with. Let me know if you have any idea how to make DGA and fglx coexist peacefully:)

Thanks

FimDan

Share this post


Link to post
Share on other sites
Hi,

I have a NVIDIA card, so no trouble at all. What I read in the DGA manual though is:

Quote:

Most of the reasons for the XFree86-DGA extension's existence are now
better served in other ways. Further development of this extension is
not expected, and it may be deprecated in a future release. The fea-
tures that continue to be useful will either be provided through other
existing mechanisms, or through an extension that address those needs
more specifically.


I don't need the graphics stuff anyways, all I need is to access the X servers keyboard and mouse event queue directly (that is, not through the normal event mechanism). :)

Cheers,
Drag0n

Share this post


Link to post
Share on other sites
Sign in to follow this