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