I believe I have found the solution here in the form of libgii which wraps raw keyboard input into a nice, modular and extensible abstraction library. Thanks for everyone who participated, I gained much valuable information from the thread which culminated in finding the right library! Carlo