aboutsummaryrefslogtreecommitdiff
path: root/include/mouse.h
blob: 3d5c975fe452796d089434d66f0424fd4da1340f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _MOUSE_H_
#define _MOUSE_H_ 1
#if defined(__cplusplus)
extern "C" { 
#endif
typedef struct	Menu Menu;
typedef struct 	Mousectl Mousectl;

struct	Mouse
{
	int	buttons;	/* bit array: LMR=124 */
	Point	xy;
	ulong	msec;
};

struct Mousectl
{
	Mouse	m;
	struct Channel	*c;	/* chan(Mouse) */
	struct Channel	*resizec;	/* chan(int)[2] */
			/* buffered in case client is waiting for a mouse action before handling resize */

	Display		*display;	/* associated display */
};

struct Menu
{
	char	**item;
	char	*(*gen)(int);
	int	lasthit;
};

/*
 * Mouse
 */
extern Mousectl*	initmouse(char*, Image*);
extern void		moveto(Mousectl*, Point);
extern int			readmouse(Mousectl*);
extern void		closemouse(Mousectl*);
struct Cursor;
extern void		setcursor(Mousectl*, struct Cursor*);
extern void		drawgetrect(Rectangle, int);
extern Rectangle	getrect(int, Mousectl*);
extern int	 		menuhit(int, Mousectl*, Menu*, Screen*);

extern void		bouncemouse(Mouse*);
extern int			_windowhasfocus;	/* XXX do better */
extern int			_wantfocuschanges;

#if defined(__cplusplus)
}
#endif
#endif