So I thought I would develop tetris game in C on linux. Everything works fine, except I can't find a way to get input without interrupting whats going in my game. My game has main loop which I don't want to stop. So regular console input methods don't work. I also tried to open /dev/input/eventX and read keyboard state from there, but it doesn't seem to read anything, but if I do "cat /dev/input/eventX" it does show that it contains events.
I also tried using glut and glutKeyboardFunc, but that doesn't seem to work either. As it probably needs a focused X window to operate.
Does anyone have any ideas what could I try next?