Mouse input in console application

I am working with an application written using SDL. I did not create the application. It’s usually run in a windowing environment, but I’d like to run it from the console in Linux. It loads fine as a full screen app, and I can see all the visuals. I’m trying to figure out how to provide SDL the proper mouse setup in Linux so that a pointer appears on screen and SDL can process mouse events.

I believe this is possible, but I’m getting lost in the various Linux options. I’ve played with permissions and adding my user to the input group, but this has not succeeded. I assume I need to configure gpm or some other package appropriately. Any pointers (ha) here?

I’ve answered my own question.

Most Linux systems rely on udev these days for keyboard and mouse event handling (plus much more). SDL builds for Linux generally rely on udev. You may need to do some permissions work but probably not.

In the case of running a GUI application based on SDL from the console without a window manager, mouse events are processed. Without a window manager, though, there may be nothing to draw the mouse pointer! I discovered the app I was working with was responding to the mouse just fine. I simply didn’t realize it until I tried interacting with it using an invisible mouse.


If you compiled or are using a version of SDL with udev support (and you should!)…