2005-07-16 09:57:45 -07:00
|
|
|
/*
|
2006-01-06 23:20:58 -08:00
|
|
|
* Copyright (C) 2000-2006 Carsten Haitzler, Geoff Harrison and various contributors
|
|
|
|
* Copyright (C) 2004-2006 Kim Woelders
|
2005-07-16 09:57:45 -07:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
#ifndef _XWIN_H_
|
|
|
|
#define _XWIN_H_
|
|
|
|
|
2006-06-01 13:18:40 -07:00
|
|
|
Display *EDisplayOpen(const char *dstr, int scr);
|
|
|
|
void EDisplayClose(void);
|
|
|
|
void EDisplayDisconnect(void);
|
|
|
|
|
|
|
|
void EGrabServer(void);
|
|
|
|
void EUngrabServer(void);
|
|
|
|
int EServerIsGrabbed(void);
|
|
|
|
void EFlush(void);
|
|
|
|
void ESync(void);
|
|
|
|
|
|
|
|
#if USE_COMPOSITE
|
|
|
|
int EVisualIsARGB(Visual * vis);
|
|
|
|
Visual *EVisualFindARGB(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Time EGetTimestamp(void);
|
|
|
|
|
2006-09-08 16:13:57 -07:00
|
|
|
typedef struct _xwin *Win;
|
|
|
|
typedef void (EventCallbackFunc) (Win win, XEvent * ev, void *prm);
|
|
|
|
|
|
|
|
#define NoWin ((Win)0)
|
|
|
|
|
|
|
|
#define EXPOSE_WIN 1
|
|
|
|
#if EXPOSE_WIN || DECLARE_WIN
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
EventCallbackFunc *func;
|
|
|
|
void *prm;
|
|
|
|
} EventCallbackItem;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int num;
|
|
|
|
EventCallbackItem *lst;
|
|
|
|
} EventCallbackList;
|
|
|
|
|
|
|
|
struct _xwin
|
|
|
|
{
|
|
|
|
struct _xwin *next;
|
|
|
|
struct _xwin *prev;
|
|
|
|
EventCallbackList cbl;
|
|
|
|
Window xwin;
|
|
|
|
Win parent;
|
|
|
|
int x, y, w, h;
|
|
|
|
int bw;
|
|
|
|
char mapped;
|
|
|
|
char in_use;
|
|
|
|
signed char do_del;
|
|
|
|
char attached;
|
|
|
|
int num_rect;
|
|
|
|
int ord;
|
|
|
|
XRectangle *rects;
|
|
|
|
Visual *visual;
|
|
|
|
int depth;
|
|
|
|
Colormap cmap;
|
|
|
|
Pixmap bgpmap;
|
|
|
|
unsigned int bgcol;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
Win ELookupXwin(Window xwin);
|
|
|
|
|
2006-09-08 16:13:57 -07:00
|
|
|
#if EXPOSE_WIN
|
|
|
|
#define WinGetXwin(win) ((win)->xwin)
|
|
|
|
#define WinGetX(win) ((win)->x)
|
|
|
|
#define WinGetY(win) ((win)->y)
|
|
|
|
#define WinGetW(win) ((win)->w)
|
|
|
|
#define WinGetH(win) ((win)->h)
|
|
|
|
#define WinGetBorderWidth(win) ((win)->bw)
|
|
|
|
#define WinGetDepth(win) ((win)->depth)
|
|
|
|
#define WinGetVisual(win) ((win)->visual)
|
|
|
|
#define WinGetCmap(win) ((win)->cmap)
|
|
|
|
#else
|
2006-05-07 08:08:01 -07:00
|
|
|
Window WinGetXwin(const Win win);
|
2006-09-08 16:13:57 -07:00
|
|
|
int WinGetX(const Win win);
|
|
|
|
int WinGetY(const Win win);
|
|
|
|
int WinGetW(const Win win);
|
|
|
|
int WinGetH(const Win win);
|
2006-05-21 05:09:14 -07:00
|
|
|
int WinGetBorderWidth(const Win win);
|
|
|
|
int WinGetDepth(const Win win);
|
2006-05-10 13:44:15 -07:00
|
|
|
Visual *WinGetVisual(const Win win);
|
2006-05-14 09:00:20 -07:00
|
|
|
Colormap WinGetCmap(const Win win);
|
2006-09-08 16:13:57 -07:00
|
|
|
#endif
|
2006-05-07 08:08:01 -07:00
|
|
|
|
|
|
|
Win ECreateWinFromXwin(Window xwin);
|
|
|
|
void EDestroyWin(Win win);
|
2006-04-29 12:39:21 -07:00
|
|
|
|
2006-05-21 05:09:14 -07:00
|
|
|
Win ERegisterWindow(Window xwin, XWindowAttributes * pxwa);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EUnregisterWindow(Win win);
|
|
|
|
void EUnregisterXwin(Window xwin);
|
|
|
|
void EventCallbackRegister(Win win, int type,
|
2005-07-16 09:57:45 -07:00
|
|
|
EventCallbackFunc * func, void *prm);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EventCallbackUnregister(Win win, int type,
|
2005-07-16 09:57:45 -07:00
|
|
|
EventCallbackFunc * func,
|
|
|
|
void *prm);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EventCallbacksProcess(Win win, XEvent * ev);
|
2005-07-16 09:57:45 -07:00
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
Win ECreateWindow(Win parent, int x, int y, int w, int h,
|
2005-07-16 09:57:45 -07:00
|
|
|
int saveunder);
|
2006-06-03 07:11:34 -07:00
|
|
|
Win ECreateArgbWindow(Win parent, int x, int y, int w, int h,
|
|
|
|
Win cwin);
|
|
|
|
Win ECreateClientWindow(Win parent, int x, int y, int w, int h);
|
|
|
|
Win ECreateObjectWindow(Win parent, int x, int y, int w,
|
|
|
|
int h, int saveunder, int type,
|
|
|
|
Win cwin, char *argb);
|
2006-04-29 12:39:21 -07:00
|
|
|
Win ECreateEventWindow(Win parent, int x, int y, int w, int h);
|
|
|
|
Win ECreateFocusWindow(Win parent, int x, int y, int w, int h);
|
|
|
|
void EWindowSync(Win win);
|
2006-09-08 16:13:57 -07:00
|
|
|
void EWindowSetGeometry(Win win, int x, int y, int w, int h,
|
|
|
|
int bw);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EWindowSetMapped(Win win, int mapped);
|
|
|
|
void ESelectInputAdd(Win win, long mask);
|
|
|
|
|
|
|
|
void EMoveWindow(Win win, int x, int y);
|
|
|
|
void EResizeWindow(Win win, int w, int h);
|
|
|
|
void EMoveResizeWindow(Win win, int x, int y, int w, int h);
|
|
|
|
void EDestroyWindow(Win win);
|
|
|
|
void EMapWindow(Win win);
|
|
|
|
void EMapRaised(Win win);
|
|
|
|
void EUnmapWindow(Win win);
|
|
|
|
void EReparentWindow(Win win, Win parent, int x, int y);
|
|
|
|
int EGetGeometry(Win win, Window * root_return,
|
2005-07-16 09:57:45 -07:00
|
|
|
int *x, int *y, int *w, int *h, int *bw,
|
|
|
|
int *depth);
|
2006-05-21 05:09:14 -07:00
|
|
|
void EGetWindowAttributes(Win win, XWindowAttributes * pxwa);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EConfigureWindow(Win win, unsigned int mask,
|
2005-07-16 09:57:45 -07:00
|
|
|
XWindowChanges * wc);
|
2006-04-29 12:39:21 -07:00
|
|
|
void ESetWindowBackgroundPixmap(Win win, Pixmap pmap);
|
2006-05-21 11:44:18 -07:00
|
|
|
void ESetWindowBackground(Win win, unsigned int col);
|
2006-04-29 12:39:21 -07:00
|
|
|
int ETranslateCoordinates(Win src_w, Win dst_w,
|
2005-07-16 09:57:45 -07:00
|
|
|
int src_x, int src_y,
|
|
|
|
int *dest_x_return,
|
|
|
|
int *dest_y_return,
|
|
|
|
Window * child_return);
|
2005-11-20 14:47:41 -08:00
|
|
|
int EDrawableCheck(Drawable draw, int grab);
|
2005-07-16 09:57:45 -07:00
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
#define ESelectInput(win, event_mask) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XSelectInput(disp, WinGetXwin(win), event_mask)
|
2006-04-29 12:39:21 -07:00
|
|
|
|
|
|
|
#define EChangeWindowAttributes(win, mask, attr) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XChangeWindowAttributes(disp, WinGetXwin(win), mask, attr)
|
2006-04-29 12:39:21 -07:00
|
|
|
#define ESetWindowBorderWidth(win, bw) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XSetWindowBorderWidth(disp, WinGetXwin(win), bw)
|
2006-04-29 12:39:21 -07:00
|
|
|
|
|
|
|
#define ERaiseWindow(win) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XRaiseWindow(disp, WinGetXwin(win))
|
2006-04-29 12:39:21 -07:00
|
|
|
#define ELowerWindow(win) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XLowerWindow(disp, WinGetXwin(win))
|
2006-04-29 12:39:21 -07:00
|
|
|
|
|
|
|
#define EClearWindow(win) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XClearWindow(disp, WinGetXwin(win))
|
2006-04-29 12:39:21 -07:00
|
|
|
#define EClearArea(win, x, y, w, h, exp) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XClearArea(disp, WinGetXwin(win), x, y, w, h, exp)
|
2005-07-16 09:57:45 -07:00
|
|
|
|
2006-05-07 08:08:01 -07:00
|
|
|
Pixmap ECreatePixmap(Win win, unsigned int width,
|
|
|
|
unsigned int height, unsigned int depth);
|
|
|
|
void EFreePixmap(Pixmap pixmap);
|
2006-04-29 12:39:21 -07:00
|
|
|
|
|
|
|
void EShapeCombineMask(Win win, int dest, int x, int y,
|
2005-07-16 09:57:45 -07:00
|
|
|
Pixmap pmap, int op);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EShapeCombineMaskTiled(Win win, int dest, int x, int y,
|
2005-07-16 09:57:45 -07:00
|
|
|
Pixmap pmap, int op, int w, int h);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EShapeCombineRectangles(Win win, int dest, int x, int y,
|
2005-07-16 09:57:45 -07:00
|
|
|
XRectangle * rect, int n_rects,
|
|
|
|
int op, int ordering);
|
2006-04-29 12:39:21 -07:00
|
|
|
void EShapeCombineShape(Win win, int dest, int x, int y,
|
|
|
|
Win src_win, int src_kind, int op);
|
|
|
|
XRectangle *EShapeGetRectangles(Win win, int dest, int *rn, int *ord);
|
|
|
|
int EShapeCopy(Win dst, Win src);
|
|
|
|
int EShapePropagate(Win win);
|
|
|
|
int EShapeCheck(Win win);
|
|
|
|
Pixmap EWindowGetShapePixmap(Win win);
|
|
|
|
|
2006-08-24 14:52:28 -07:00
|
|
|
Bool EQueryPointer(Win win, int *px, int *py,
|
|
|
|
Window * pchild, unsigned int *pmask);
|
|
|
|
|
2006-05-14 09:00:20 -07:00
|
|
|
void EAllocColor(Colormap colormap, XColor * pxc);
|
2006-04-29 12:39:21 -07:00
|
|
|
void ESetColor(XColor * pxc, int r, int g, int b);
|
|
|
|
void EGetColor(const XColor * pxc, int *pr, int *pg, int *pb);
|
|
|
|
|
|
|
|
Window EXWindowGetParent(Window xwin);
|
|
|
|
int EXGetGeometry(Window xwin, Window * root_return,
|
|
|
|
int *x, int *y, int *w, int *h, int *bw,
|
|
|
|
int *depth);
|
2006-05-21 05:09:14 -07:00
|
|
|
#define EXGetWindowAttributes(win, xwa) \
|
2006-08-07 13:47:12 -07:00
|
|
|
XGetWindowAttributes(disp, WinGetXwin(win), xwa)
|
2006-04-29 12:39:21 -07:00
|
|
|
|
2006-04-25 15:40:06 -07:00
|
|
|
void EXCopyArea(Drawable src, Drawable dst, int sx, int sy,
|
|
|
|
unsigned int w, unsigned int h, int dx, int dy);
|
2005-10-16 09:27:48 -07:00
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
void EXWarpPointer(Window xwin, int x, int y);
|
|
|
|
|
|
|
|
#define EXCreatePixmap(win, w, h, d) \
|
|
|
|
XCreatePixmap(disp, win, w, h, d)
|
|
|
|
#define EXFreePixmap(pmap) \
|
|
|
|
XFreePixmap(disp, pmap)
|
|
|
|
Pixmap EXCreatePixmapCopy(Pixmap src, unsigned int w,
|
|
|
|
unsigned int h, unsigned int depth);
|
2006-04-23 16:18:23 -07:00
|
|
|
|
2006-04-17 14:55:34 -07:00
|
|
|
GC EXCreateGC(Drawable draw, unsigned long mask,
|
|
|
|
XGCValues * val);
|
|
|
|
int EXFreeGC(GC gc);
|
2005-07-16 09:57:45 -07:00
|
|
|
|
2005-09-26 10:32:10 -07:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char type;
|
|
|
|
Pixmap pmap;
|
|
|
|
Pixmap mask;
|
|
|
|
int w, h;
|
|
|
|
} PmapMask;
|
|
|
|
|
|
|
|
void FreePmapMask(PmapMask * pmm);
|
|
|
|
|
2005-07-16 09:57:45 -07:00
|
|
|
#endif /* _XWIN_H_ */
|