aboutsummaryrefslogtreecommitdiff
path: root/src/libdraw/x11-memdraw.h
blob: 1e84b92638553d829c764a46a9a95480f6c1189a (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
 * Structure pointed to by X field of Memimage
 */

typedef struct Xmem Xmem;
typedef struct Xprivate Xprivate;

enum
{
	PMundef = ~0
};

struct Xmem
{
	int		pixmap;	/* pixmap id */
	XImage		*xi;	/* local image */
	int		dirty;	/* is the X server ahead of us?  */
	Rectangle	dirtyr;	/* which pixels? */
	Rectangle	r;	/* size of image */
};

struct Xprivate {
	u32int		black;
	u32int		chan;
	XColormap	cmap;
	XCursor		cursor;
	XDisplay	*display;
	int		depth;				/* of screen */
	XDrawable	drawable;
	XColor		map[256];
	XColor		map7[128];
	uchar		map7to8[128][2];
	XGC		gccopy;
	XGC		gccopy0;
	XGC		gcfill;
	u32int		gcfillcolor;
	XGC		gcfill0;
	u32int		gcfill0color;
	XGC		gcreplsrc;
	u32int		gcreplsrctile;
	XGC		gcreplsrc0;
	u32int		gcreplsrc0tile;
	XGC		gcsimplesrc;
	u32int		gcsimplesrccolor;
	u32int		gcsimplesrcpixmap;
	XGC		gcsimplesrc0;
	u32int		gcsimplesrc0color;
	u32int		gcsimplesrc0pixmap;
	XGC		gczero;
	u32int		gczeropixmap;
	XGC		gczero0;
	u32int		gczero0pixmap;
	XDisplay	*kbdcon;
	XDisplay	*mousecon;
	Rectangle	newscreenr;
	Memimage*	screenimage;
	QLock		screenlock;
	XDrawable	screenpm;
	XDrawable	nextscreenpm;
	Rectangle	screenr;
	XDisplay	*snarfcon;
	int		toplan9[256];
	int		tox11[256];
	int		usetable;
	XVisual		*vis;
	u32int		white;
	Atom		clipboard;
	Atom		utf8string;
	Atom		targets;
	Atom		text;
	Atom		compoundtext;
	uint		putsnarf;
	uint		assertsnarf;
	int		destroyed;
};

extern Xprivate _x;

extern Memimage *_xallocmemimage(Rectangle, u32int, int);
extern XImage	*_xallocxdata(Memimage*, Rectangle);
extern void	_xdirtyxdata(Memimage*, Rectangle);
extern void	_xfillcolor(Memimage*, Rectangle, u32int);
extern void	_xfreexdata(Memimage*);
extern XImage	*_xgetxdata(Memimage*, Rectangle);
extern void	_xputxdata(Memimage*, Rectangle);
extern void	_initdisplaymemimage(Display*, Memimage*);

struct Mouse;
extern int	_xtoplan9mouse(XDisplay*, XEvent*, struct Mouse*);
extern int	_xtoplan9kbd(XEvent*);
extern void	_xexpose(XEvent*, XDisplay*);
extern int	_xselect(XEvent*, XDisplay*);
extern int	_xconfigure(XEvent*, XDisplay*);
extern int	_xdestroy(XEvent*, XDisplay*);
extern void	_flushmemscreen(Rectangle);
extern void	_xmoveto(Point);
struct Cursor;
extern void	_xsetcursor(struct Cursor*);

#define MouseMask (\
	ButtonPressMask|\
	ButtonReleaseMask|\
	PointerMotionMask|\
	Button1MotionMask|\
	Button2MotionMask|\
	Button3MotionMask)