
#ifndef PLATFORM_UNIX_X11KEYBOARD_H
#define PLATFORM_UNIX_X11KEYBOARD_H

#include <Spectre/System/Event.h>
#include <Spectre/Input/Keyboard.h>
#include <X11/Xlib.h>

namespace sp {

class X11Keyboard : public Keyboard
{
public :
	X11Keyboard();
	~X11Keyboard();

	void init();

	bool isKeyDown(Keyboard::Key key);

	// Translate a XKeyEvent to sp::Event, Called from X11EventQueue
	static bool handleMessage(XKeyEvent* xkeyevent, Event& event);

protected :

	virtual void update(InputModule *input);

private :
	::Display* m_disp;
	::Window m_win; // Focused window

	// Cached keyboard state.
	char m_key_state[32];
};

} // namespace sp

#endif /* PLATFORM_UNIX_X11KEYBOARD_H */
