
#ifndef PLATFORM_UNIX_X11MOUSE_H
#define PLATFORM_UNIX_X11MOUSE_H

#include <Spectre/Input/Mouse.h>
#include <X11/Xlib.h>

namespace sp {

class X11Mouse : public Mouse
{
public :
	X11Mouse();

	virtual void init();

	// Get mouse position
	virtual Vector2f getPosition() const;

	virtual Vector2f getAbsPosition() const;

	virtual bool isButtonDown(Mouse::Button button) const;

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

protected :

	virtual void update(InputModule *input);

	void updateFocusedWindow();

protected :
	::Window m_win; // Focused window.

	Vector2f m_position;

	Vector2f m_abs_position;

	unsigned int m_btn_state;
};

} // namespace sp

#endif /* PLATFORM_UNIX_X11MOUSE_H */
