#ifndef _EVENTS_
#define _EVENTS_

#include <X11/Xlib.h>
#include "windows.hh"

struct Event
{
	XEvent x;
	SWindow *sw;
	int handled;
	int button;
	int context;
	Rect r;
	KeySym keysym;

	int next ();
	int mask (long);
	int check_mask (long);
	int window (Window, long);
	int prepare ();
	int handle ();
	int handle_Expose ();
	int handle_UnmapNotify ();
	int handle_DestroyNotify ();
	int handle_EnterNotify ();
	int handle_ConfigureRequest ();
	int handle_ConfigureNotify ();
	int handle_ClientMessage ();
	int handle_KeyPress ();
	int handle_ButtonPress ();
	int handle_ButtonRelease ();
};

// event contexts
#define C_NO_CONTEXT	(0)
#define C_WINDOW	(1 << 0)
#define C_ROOT		(1 << 1)
#define C_DECOR		(1 << 2)
#define C_DBL_DECOR	(1 << 3)
#define C_ANY		(C_WINDOW | C_ROOT | C_DECOR)

//********************************************************************

extern Event *event;

#endif
