1 module x11.extensions.Xfixes;
2 
3 public import
4 	x11.X,
5 	x11.Xlib;
6 
7 extern(C):
8 
9 	/+
10 	#include <X11/extensions/xfixeswire.h>
11 
12 	#include <X11/Xfuncproto.h>
13 	#include <X11/Xlib.h>
14 
15 	#define XFIXES_REVISION	1
16 	#define XFIXES_VERSION	((XFIXES_MAJOR * 10000) + (XFIXES_MINOR * 100) + (XFIXES_REVISION))
17 	+/
18 
19 	enum XFIXES_MAJOR = 5;
20 
21 	struct XFixesSelectionNotifyEvent {
22 	    int type;			/* event base */
23 	    ulong serial;
24 	    Bool send_event;
25 	    Display *display;
26 	    Window window;
27 	    int subtype;
28 	    Window owner;
29 	    Atom selection;
30 	    Time timestamp;
31 	    Time selection_timestamp;
32 	}
33 
34 	struct XFixesCursorNotifyEvent {
35 	    int type;			/* event base */
36 	    ulong serial;
37 	    Bool send_event;
38 	    Display *display;
39 	    Window window;
40 	    int subtype;
41 	    ulong cursor_serial;
42 	    Time timestamp;
43 	    Atom cursor_name;
44 	}
45 
46 	struct XFixesCursorImage {
47 	    short	    x, y;
48 	    ushort  width, height;
49 	    ushort  xhot, yhot;
50 	    ulong   cursor_serial;
51 	    ulong   *pixels;
52 		static if(XFIXES_MAJOR >= 2){
53 		    Atom	    atom;		    /* Version >= 2 only */
54 		    const char	    *name;		    /* Version >= 2 only */
55 		}
56 	}
57 
58 	static if(XFIXES_MAJOR >= 2){
59 		/* Version 2 types */
60 
61 		alias XserverRegion = XID;
62 
63 		struct XFixesCursorImageAndName {
64 		    short	    x, y;
65 		    ushort  width, height;
66 		    ushort  xhot, yhot;
67 		    ulong   cursor_serial;
68 		    ulong   *pixels;
69 		    Atom	    atom;
70 		    const char	    *name;
71 		}
72 	}
73 
74 	Bool XFixesQueryExtension (Display *dpy,
75 				    int *event_base_return,
76 				    int *error_base_return);
77 	Status XFixesQueryVersion (Display *dpy,
78 				    int     *major_static,
79 				    int     *minor_static);
80 
81 	int XFixesVersion();
82 
83 	void
84 	XFixesChangeSaveSet (Display	*dpy,
85 			     Window	win,
86 			     int	mode,
87 			     int	target,
88 			     int	map);
89 
90 	void
91 	XFixesSelectSelectionInput (Display	    *dpy,
92 				    Window	    win,
93 				    Atom	    selection, 
94 				    ulong   eventMask);
95 
96 	void
97 	XFixesSelectCursorInput (Display	*dpy,
98 				 Window		win,
99 				 ulong	eventMask);
100 
101 	XFixesCursorImage *
102 	XFixesGetCursorImage (Display *dpy);
103 
104 	static if(XFIXES_MAJOR >= 2){
105 		/* Version 2 functions */
106 
107 		XserverRegion
108 		XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles);
109 
110 		XserverRegion
111 		XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap);
112 
113 		XserverRegion
114 		XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind);
115 
116 		XserverRegion
117 		XFixesCreateRegionFromGC (Display *dpy, GC gc);
118 
119 		XserverRegion
120 		XFixesCreateRegionFromPicture (Display *dpy, XID picture);
121 
122 		void
123 		XFixesDestroyRegion (Display *dpy, XserverRegion region);
124 
125 		void
126 		XFixesSetRegion (Display *dpy, XserverRegion region,
127 				 XRectangle *rectangles, int nrectangles);
128 
129 		void
130 		XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src);
131 
132 		void
133 		XFixesUnionRegion (Display *dpy, XserverRegion dst,
134 				   XserverRegion src1, XserverRegion src2);
135 
136 		void
137 		XFixesIntersectRegion (Display *dpy, XserverRegion dst,
138 				       XserverRegion src1, XserverRegion src2);
139 
140 		void
141 		XFixesSubtractRegion (Display *dpy, XserverRegion dst,
142 				      XserverRegion src1, XserverRegion src2);
143 
144 		void
145 		XFixesInvertRegion (Display *dpy, XserverRegion dst,
146 				    XRectangle *rect, XserverRegion src);
147 
148 		void
149 		XFixesTranslateRegion (Display *dpy, XserverRegion region, int dx, int dy);
150 
151 		void
152 		XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src);
153 
154 		XRectangle *
155 		XFixesFetchRegion (Display *dpy, XserverRegion region, int *nrectanglesRet);
156 
157 		XRectangle *
158 		XFixesFetchRegionAndBounds (Display *dpy, XserverRegion region, 
159 					    int *nrectanglesRet,
160 					    XRectangle *bounds);
161 
162 		void
163 		XFixesSetGCClipRegion (Display *dpy, GC gc, 
164 				       int clip_x_origin, int clip_y_origin,
165 				       XserverRegion region);
166 
167 		void
168 		XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind,
169 					    int x_off, int y_off, XserverRegion region);
170 
171 		void
172 		XFixesSetPictureClipRegion (Display *dpy, XID picture,
173 					    int clip_x_origin, int clip_y_origin,
174 					    XserverRegion region);
175 
176 		void
177 		XFixesSetCursorName (Display *dpy, Cursor cursor, const(char)* name);
178 
179 		const(char)*
180 		XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom);
181 
182 		void
183 		XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination);
184 
185 		void
186 		XFixesChangeCursorByName (Display *dpy, Cursor source, const(char)* name);
187 
188 	}
189 
190 	static if(XFIXES_MAJOR >= 3){
191 
192 		void
193 		XFixesExpandRegion (Display *dpy, XserverRegion dst, XserverRegion src,
194 				    uint left, uint uright,
195 				    uint utop, uint ubottom);
196 
197 	}
198 
199 	static if(XFIXES_MAJOR >= 4){
200 		/* Version 4.0 externs */
201 
202 		void
203 		XFixesHideCursor (Display *dpy, Window win);
204 
205 		void
206 		XFixesShowCursor (Display *dpy, Window win);
207 
208 	}
209 
210 	static if(XFIXES_MAJOR >= 5){
211 
212 		alias PointerBarrier = XID;
213 
214 		PointerBarrier
215 		XFixesCreatePointerBarrier(Display *dpy, Window w, int x1, int y1,
216 					   int x2, int y2, int directions,
217 					   int num_devices, int *devices);
218 
219 		void
220 		XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b);
221 
222 	}