2 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
3 * Copyright (C) 2004-2008 Kim Woelders
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies of the Software, its documentation and marketing & publicity
14 * materials, and acknowledgment shall be given in the documentation, materials
15 * and software packages that this Software was used.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 unsigned int pixel_black;
37 unsigned int pixel_white;
39 Win rroot; /* Real root window */
40 Win vroot; /* Virtual root window */
44 unsigned char last_error_code;
47 __EXPORT__ extern EDisplay Dpy;
50 #define RROOT Dpy.rroot
51 #define VROOT Dpy.vroot
55 int EDisplayOpen(const char *dstr, int scr);
56 void EDisplayClose(void);
57 void EDisplayDisconnect(void);
58 void EDisplaySetErrorHandlers(void (*fatal) (void));
60 void EGrabServer(void);
61 void EUngrabServer(void);
62 int EServerIsGrabbed(void);
65 #define ESYNC_MAIN 0x0001
66 #define ESYNC_DESKS 0x0002
67 #define ESYNC_MENUS 0x0004
68 #define ESYNC_MOVRES 0x0008
69 #define ESYNC_FOCUS 0x0010
70 #define ESYNC_TLOOP 0x0040
71 #define ESYNC_SLIDEOUT 0x0080
72 #define ESYNC_STARTUP 0x0100
73 void ESync(unsigned int mask);
76 int EVisualIsARGB(Visual * vis);
77 Visual *EVisualFindARGB(void);
80 Time EGetTimestamp(void);
82 typedef void (EventCallbackFunc) (Win win, XEvent * ev, void *prm);
85 #if EXPOSE_WIN || DECLARE_WIN
87 EventCallbackFunc *func;
93 EventCallbackItem *lst;
99 EventCallbackList cbl;
110 signed char bg_owned; /* bgpmap "owned" by Win */
121 Win ELookupXwin(Window xwin);
124 #define WinGetXwin(win) ((win)->xwin)
125 #define WinGetPmap(win) ((win)->bgpmap)
126 #define WinGetX(win) ((win)->x)
127 #define WinGetY(win) ((win)->y)
128 #define WinGetW(win) ((win)->w)
129 #define WinGetH(win) ((win)->h)
130 #define WinGetBorderWidth(win) ((win)->bw)
131 #define WinGetDepth(win) ((win)->depth)
132 #define WinGetVisual(win) ((win)->visual)
133 #define WinGetCmap(win) ((win)->cmap)
134 #define WinIsShaped(win) ((win)->num_rect != 0)
136 Window WinGetXwin(const Win win);
137 int WinGetX(const Win win);
138 int WinGetY(const Win win);
139 int WinGetW(const Win win);
140 int WinGetH(const Win win);
141 int WinGetBorderWidth(const Win win);
142 int WinGetDepth(const Win win);
143 Visual *WinGetVisual(const Win win);
144 Colormap WinGetCmap(const Win win);
147 Win ECreateWinFromXwin(Window xwin);
148 void EDestroyWin(Win win);
150 Win ERegisterWindow(Window xwin, XWindowAttributes * pxwa);
151 void EUnregisterWindow(Win win);
152 void EUnregisterXwin(Window xwin);
153 void EventCallbackRegister(Win win, int type,
154 EventCallbackFunc * func, void *prm);
155 void EventCallbackUnregister(Win win, int type,
156 EventCallbackFunc * func,
158 void EventCallbacksProcess(Win win, XEvent * ev);
160 Win ECreateWindow(Win parent, int x, int y, int w, int h,
162 Win ECreateArgbWindow(Win parent, int x, int y, int w, int h,
164 Win ECreateWindowVD(Win parent, int x, int y, int w, int h,
165 Visual * vis, unsigned int depth);
166 Win ECreateClientWindow(Win parent, int x, int y, int w, int h);
168 #define WIN_TYPE_CLIENT 0
169 #define WIN_TYPE_INTERNAL 1
170 #define WIN_TYPE_NO_ARGB 2
171 #define WIN_TYPE_GLX 3
172 Win ECreateObjectWindow(Win parent, int x, int y, int w,
173 int h, int saveunder, int type,
175 Win ECreateEventWindow(Win parent, int x, int y, int w, int h);
176 Win ECreateFocusWindow(Win parent, int x, int y, int w, int h);
177 void EWindowSync(Win win);
178 void EWindowSetGeometry(Win win, int x, int y, int w, int h,
180 void EWindowSetMapped(Win win, int mapped);
181 void ESelectInputChange(Win win, unsigned long set,
182 unsigned long clear);
184 void EMoveWindow(Win win, int x, int y);
185 void EResizeWindow(Win win, int w, int h);
186 void EMoveResizeWindow(Win win, int x, int y, int w, int h);
187 void EDestroyWindow(Win win);
188 void EMapWindow(Win win);
189 void EMapRaised(Win win);
190 void EUnmapWindow(Win win);
191 void EReparentWindow(Win win, Win parent, int x, int y);
192 int EGetGeometry(Win win, Window * root_return,
193 int *x, int *y, int *w, int *h, int *bw,
195 void EGetWindowAttributes(Win win, XWindowAttributes * pxwa);
196 void EConfigureWindow(Win win, unsigned int mask,
197 XWindowChanges * wc);
198 void ESetWindowBackgroundPixmap(Win win, Pixmap pmap);
199 Pixmap EGetWindowBackgroundPixmap(Win win);
200 void EFreeWindowBackgroundPixmap(Win win);
201 void ESetWindowBackground(Win win, unsigned int col);
202 int ETranslateCoordinates(Win src_w, Win dst_w,
203 int src_x, int src_y,
206 Window * child_return);
207 int EDrawableCheck(Drawable draw, int grab);
209 void ESelectInput(Win win, unsigned int event_mask);
210 void EChangeWindowAttributes(Win win, unsigned int mask,
211 XSetWindowAttributes * attr);
212 void ESetWindowBorderWidth(Win win, unsigned int bw);
213 void ERaiseWindow(Win win);
214 void ELowerWindow(Win win);
215 void EClearWindow(Win win);
216 void EClearArea(Win win, int x, int y,
217 unsigned int w, unsigned int h);
219 Pixmap ECreatePixmap(Win win, unsigned int width,
220 unsigned int height, unsigned int depth);
221 void EFreePixmap(Pixmap pixmap);
223 void EShapeSetMask(Win win, int x, int y, Pixmap mask);
224 void EShapeUnionMask(Win win, int x, int y, Pixmap mask);
225 void EShapeSetMaskTiled(Win win, int x, int y, Pixmap mask,
227 void EShapeSetRects(Win win, int x, int y,
228 XRectangle * rect, int n_rects);
229 void EShapeUnionRects(Win win, int x, int y,
230 XRectangle * rect, int n_rects);
231 int EShapeSetShape(Win win, int x, int y, Win src_win);
232 int EShapePropagate(Win win);
233 int EShapeCheck(Win win);
234 Pixmap EWindowGetShapePixmap(Win win);
236 Bool EQueryPointer(Win win, int *px, int *py,
237 Window * pchild, unsigned int *pmask);
241 unsigned char alpha, red, green, blue;
244 void EAllocColor(Colormap cmap, EColor * pec);
245 void EAllocXColor(Colormap cmap, XColor * pxc, EColor * pec);
247 #define SET_COLOR(xc, _r, _g, _b) \
248 do { (xc)->red = _r; (xc)->green = _g; (xc)->blue = _b; } while(0)
250 #define GET_COLOR(xc, _r, _g, _b) \
251 do { _r = (xc)->red; _g = (xc)->green; _b = (xc)->blue; } while(0)
253 Window EXWindowGetParent(Window xwin);
254 int EXGetGeometry(Window xwin, Window * root_return,
255 int *x, int *y, int *w, int *h, int *bw,
258 void EXRestackWindows(Window * windows, int nwindows);
260 void EXCopyArea(Drawable src, Drawable dst, int sx, int sy,
261 unsigned int w, unsigned int h, int dx, int dy);
262 void EXCopyAreaTiled(Drawable src, Pixmap mask, Drawable dst,
264 unsigned int w, unsigned int h,
267 void EXWarpPointer(Window xwin, int x, int y);
269 Pixmap EXCreatePixmapCopy(Pixmap src, unsigned int w,
270 unsigned int h, unsigned int depth);
272 GC EXCreateGC(Drawable draw, unsigned long mask,
276 void EXSendEvent(Window xwin, long event_mask, XEvent * ev);
278 KeyCode EKeysymToKeycode(KeySym keysym);
279 KeyCode EKeynameToKeycode(const char *name);
280 const char *EKeycodeToString(KeyCode keycode, int index);
282 Atom EInternAtom(const char *name);
291 void FreePmapMask(PmapMask * pmm);
293 #endif /* _XWIN_H_ */