Here's a system that I'm pretty happy with: http://code.google.com/p/ferox-gl/source/browse/#svn%2Ftrunk%2Fferox-core%2Fsrc%2Fcom%2Fferox%2Finput%2Flogic
It tracks the entire state of the keyboard and mouse (i.e. which keys are down, which mouse buttons are down, where the mouse is). Every event gets processed in order, creating a new state to match what the event did (i.e. release a key). This creates a list of states that then get processed on request in the main loop. This lets processing happen in the main loop but will not miss events (which can happen if you just use a single state and frame rates are low).
When processing the states, there are triggers that take the previous and current state that can be used to build conditionals, such as "run X when 'A' is pressed the first time and the mouse is dragging". This design has been heavily influenced by the input system in the Ardor3D engine, so I don't mean to take credit for it.