Search code examples
c++linuxraw-input

Getting device input (mouse, keyboard ...) on LINUX


I am building cross-platform game engine and now I am focused on Input system.

I have written an abstract Input system which passes the messages up and is beeing fed by platform dependent modules, running in separate thread.

In windows I have created "Message-only" window, which feed Input system with messages (translated to platform independent) from RAWINPUT.

Now I am having troubles to figure out how to do similar thing on unix based system. Is there any convenient way to get input (keyup, keydown, mousemove...) from kernel? Or any other way without need showing any window?

EDIT

I do not want to my Input System be dependent on my Renderer. Renderer should just notify input when app focus changed... So I want Input system to run on different thread than renderer.


Solution

  • Under X Window system there is a concept of input-only windows, which is more or less parallel to that of message-only window under Windows.