forked from e16/e16
1
0
Fork 0

Remove old window handling API fallback stuff.

SVN revision: 22481
This commit is contained in:
Kim Woelders 2006-05-07 15:08:01 +00:00
parent 0e2b840e3e
commit e20179630c
3 changed files with 95 additions and 111 deletions

View File

@ -244,8 +244,6 @@ AC_CHECK_LIB(Fridge,mass_quantities_of_any_ale,, [
echo " We highly suggest that you rectify this situation immediately." echo " We highly suggest that you rectify this situation immediately."
]) ])
AC_DEFINE(USE_NEW_WIN_API, 1, [Use new window handling API])
AC_ARG_ENABLE(gcc-warnings, AC_ARG_ENABLE(gcc-warnings,
[ --enable-gcc-warnings enable GCC compiler warnings @<:@default=no@:>@],, [ --enable-gcc-warnings enable GCC compiler warnings @<:@default=no@:>@],,
enable_gcc_warnings=no) enable_gcc_warnings=no)

175
src/x.c
View File

@ -49,8 +49,8 @@ struct _xwin
struct _xwin *next; struct _xwin *next;
struct _xwin *prev; struct _xwin *prev;
EventCallbackList cbl; EventCallbackList cbl;
Window xwin;
Window parent; Window parent;
Window win;
int x, y, w, h; int x, y, w, h;
char mapped; char mapped;
char in_use; char in_use;
@ -71,13 +71,11 @@ static XContext xid_context = 0;
static EXID *xid_first = NULL; static EXID *xid_first = NULL;
static EXID *xid_last = NULL; static EXID *xid_last = NULL;
#if USE_NEW_WIN_API
Window Window
Xwin(const Win win) WinGetXwin(const Win win)
{ {
return win->win; return win->xwin;
} }
#endif
static EXID * static EXID *
EXidCreate(void) EXidCreate(void)
@ -94,7 +92,7 @@ static void
EXidDestroy(EXID * xid) EXidDestroy(EXID * xid)
{ {
#if DEBUG_XWIN #if DEBUG_XWIN
Eprintf("EXidDestroy: %p %#lx\n", xid, xid->win); Eprintf("EXidDestroy: %p %#lx\n", xid, xid->xwin);
#endif #endif
if (xid->rects) if (xid->rects)
XFree(xid->rects); XFree(xid->rects);
@ -107,12 +105,12 @@ static void
EXidAdd(EXID * xid) EXidAdd(EXID * xid)
{ {
#if DEBUG_XWIN #if DEBUG_XWIN
Eprintf("EXidAdd: %p %#lx\n", xid, xid->win); Eprintf("EXidAdd: %p %#lx\n", xid, xid->xwin);
#endif #endif
if (!xid_context) if (!xid_context)
xid_context = XUniqueContext(); xid_context = XUniqueContext();
XSaveContext(disp, xid->win, xid_context, (XPointer) xid); XSaveContext(disp, xid->xwin, xid_context, (XPointer) xid);
if (!xid_first) if (!xid_first)
{ {
@ -130,7 +128,7 @@ static void
EXidDel(EXID * xid) EXidDel(EXID * xid)
{ {
#if DEBUG_XWIN #if DEBUG_XWIN
Eprintf("EXidDel: %p %#lx\n", xid, xid->win); Eprintf("EXidDel: %p %#lx\n", xid, xid->xwin);
#endif #endif
if (xid == xid_first) if (xid == xid_first)
{ {
@ -155,20 +153,16 @@ EXidDel(EXID * xid)
xid->next->prev = xid->prev; xid->next->prev = xid->prev;
} }
XDeleteContext(disp, xid->win, xid_context); XDeleteContext(disp, xid->xwin, xid_context);
if (xid->in_use) if (xid->in_use)
xid->do_del = 1; xid->do_del = 1;
else else
EXidDestroy(xid); EXidDestroy(xid);
} }
#if USE_NEW_WIN_API
#define EXidFind(win) (win) #define EXidFind(win) (win)
#define EXidLookup ELookupXwin #define EXidLookup ELookupXwin
#else
#define EXidFind EXidLookup
EXID *EXidLookup(Window xwin);
#endif
EXID * EXID *
EXidLookup(Window xwin) EXidLookup(Window xwin)
{ {
@ -187,20 +181,20 @@ EXidLookup(Window xwin)
} }
static EXID * static EXID *
EXidSet(Window win, Window parent, int x, int y, int w, int h, int depth) EXidSet(Window xwin, Window parent, int x, int y, int w, int h, int depth)
{ {
EXID *xid; EXID *xid;
xid = EXidCreate(); xid = EXidCreate();
xid->parent = parent; xid->parent = parent;
xid->win = win; xid->xwin = xwin;
xid->x = x; xid->x = x;
xid->y = y; xid->y = y;
xid->w = w; xid->w = w;
xid->h = h; xid->h = h;
xid->depth = depth; xid->depth = depth;
#if DEBUG_XWIN #if DEBUG_XWIN
Eprintf("EXidSet: %#lx\n", xid->win); Eprintf("EXidSet: %#lx\n", xid->xwin);
#endif #endif
EXidAdd(xid); EXidAdd(xid);
@ -287,11 +281,7 @@ EventCallbacksProcess(Win win, XEvent * ev)
if (EventDebug(EDBUG_TYPE_DISPATCH)) if (EventDebug(EDBUG_TYPE_DISPATCH))
Eprintf("EventDispatch: type=%d win=%#lx func=%p prm=%p\n", Eprintf("EventDispatch: type=%d win=%#lx func=%p prm=%p\n",
ev->type, ev->xany.window, eci->func, eci->prm); ev->type, ev->xany.window, eci->func, eci->prm);
#if USE_NEW_WIN_API
eci->func(xid, ev, eci->prm); eci->func(xid, ev, eci->prm);
#else
eci->func(xid->win, ev, eci->prm);
#endif
if (xid->do_del) if (xid->do_del)
{ {
EXidDestroy(xid); EXidDestroy(xid);
@ -321,18 +311,14 @@ ECreateWindow(Win parent, int x, int y, int w, int h, int saveunder)
else else
attr.save_under = False; attr.save_under = False;
xpar = (parent != NoWin) ? Xwin(parent) : VRoot.xwin; xpar = (parent != NoWin) ? parent->xwin : VRoot.xwin;
xwin = XCreateWindow(disp, xpar, x, y, w, h, 0, xwin = XCreateWindow(disp, xpar, x, y, w, h, 0,
VRoot.depth, InputOutput, VRoot.vis, VRoot.depth, InputOutput, VRoot.vis,
CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixmap | CWBorderPixel, &attr); CWColormap | CWBackPixmap | CWBorderPixel, &attr);
win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth); win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth);
#if USE_NEW_WIN_API
return win; return win;
#else
return xwin;
#endif
} }
/* Creates a window, but takes the visual, depth and the colormap from c_attr. */ /* Creates a window, but takes the visual, depth and the colormap from c_attr. */
@ -357,18 +343,14 @@ ECreateVisualWindow(Win parent, int x, int y, int w, int h, int saveunder,
else else
attr.save_under = False; attr.save_under = False;
xpar = (parent != NoWin) ? Xwin(parent) : VRoot.xwin; xpar = (parent != NoWin) ? parent->xwin : VRoot.xwin;
xwin = XCreateWindow(disp, xpar, x, y, w, h, 0, xwin = XCreateWindow(disp, xpar, x, y, w, h, 0,
c_attr->depth, InputOutput, c_attr->visual, c_attr->depth, InputOutput, c_attr->visual,
CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixmap | CWBorderPixel, &attr); CWColormap | CWBackPixmap | CWBorderPixel, &attr);
win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth); win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth);
#if USE_NEW_WIN_API
return win; return win;
#else
return xwin;
#endif
} }
Win Win
@ -380,16 +362,12 @@ ECreateEventWindow(Win parent, int x, int y, int w, int h)
attr.override_redirect = False; attr.override_redirect = False;
xpar = (parent != NoWin) ? Xwin(parent) : VRoot.xwin; xpar = (parent != NoWin) ? parent->xwin : VRoot.xwin;
xwin = XCreateWindow(disp, xpar, x, y, w, h, 0, 0, InputOnly, xwin = XCreateWindow(disp, xpar, x, y, w, h, 0, 0, InputOnly,
CopyFromParent, CWOverrideRedirect, &attr); CopyFromParent, CWOverrideRedirect, &attr);
win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth); win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth);
#if USE_NEW_WIN_API
return win; return win;
#else
return xwin;
#endif
} }
#if 0 /* Not used */ #if 0 /* Not used */
@ -437,7 +415,7 @@ EMoveWindow(Win win, int x, int y)
{ {
#if 0 #if 0
Eprintf("EMoveWindow: %p %#lx: %d,%d %dx%d -> %d,%d\n", Eprintf("EMoveWindow: %p %#lx: %d,%d %dx%d -> %d,%d\n",
xid, xid->win, xid->x, xid->y, xid->w, xid->h, x, y); xid, xid->xwin, xid->x, xid->y, xid->w, xid->h, x, y);
#endif #endif
if ((x == xid->x) && (y == xid->y)) if ((x == xid->x) && (y == xid->y))
return; return;
@ -445,7 +423,7 @@ EMoveWindow(Win win, int x, int y)
xid->x = x; xid->x = x;
xid->y = y; xid->y = y;
} }
XMoveWindow(disp, Xwin(win), x, y); XMoveWindow(disp, win->xwin, x, y);
} }
void void
@ -462,7 +440,7 @@ EResizeWindow(Win win, int w, int h)
xid->w = w; xid->w = w;
xid->h = h; xid->h = h;
} }
XResizeWindow(disp, Xwin(win), w, h); XResizeWindow(disp, win->xwin, w, h);
} }
void void
@ -475,7 +453,7 @@ EMoveResizeWindow(Win win, int x, int y, int w, int h)
{ {
#if 0 #if 0
Eprintf("EMoveResizeWindow: %p %#lx: %d,%d %dx%d -> %d,%d %dx%d\n", Eprintf("EMoveResizeWindow: %p %#lx: %d,%d %dx%d -> %d,%d %dx%d\n",
xid, xid->win, xid->x, xid->y, xid->w, xid->h, x, y, w, h); xid, xid->xwin, xid->x, xid->y, xid->w, xid->h, x, y, w, h);
#endif #endif
if ((w == xid->w) && (h == xid->h) && (x == xid->x) && (y == xid->y)) if ((w == xid->w) && (h == xid->h) && (x == xid->x) && (y == xid->y))
return; return;
@ -485,22 +463,22 @@ EMoveResizeWindow(Win win, int x, int y, int w, int h)
xid->w = w; xid->w = w;
xid->h = h; xid->h = h;
} }
XMoveResizeWindow(disp, Xwin(win), x, y, w, h); XMoveResizeWindow(disp, win->xwin, x, y, w, h);
} }
static int static int
ExDelTree(EXID * xid) ExDelTree(EXID * xid)
{ {
Window win; Window xwin;
int nsub; int nsub;
xid->do_del = -1; xid->do_del = -1;
nsub = 0; nsub = 0;
win = xid->win; xwin = xid->xwin;
for (xid = xid_first; xid; xid = xid->next) for (xid = xid_first; xid; xid = xid->next)
{ {
if (xid->parent != win) if (xid->parent != xwin)
continue; continue;
ExDelTree(xid); ExDelTree(xid);
nsub++; nsub++;
@ -516,10 +494,10 @@ ExDestroyWindow(EXID * xid)
int nsub; int nsub;
#if DEBUG_XWIN #if DEBUG_XWIN
Eprintf("ExDestroyWindow: %p %#lx\n", xid, xid->win); Eprintf("ExDestroyWindow: %p %#lx\n", xid, xid->xwin);
#endif #endif
if (xid->parent != None) if (xid->parent != None)
XDestroyWindow(disp, xid->win); XDestroyWindow(disp, xid->xwin);
/* Mark the ones to be deleted */ /* Mark the ones to be deleted */
nsub = ExDelTree(xid); nsub = ExDelTree(xid);
@ -548,7 +526,7 @@ EDestroyWindow(Win win)
if (xid) if (xid)
ExDestroyWindow(xid); ExDestroyWindow(xid);
else else
XDestroyWindow(disp, Xwin(win)); XDestroyWindow(disp, win->xwin);
} }
void void
@ -563,10 +541,10 @@ EWindowSync(Win win)
if (!xid) if (!xid)
return; return;
XGetGeometry(disp, Xwin(win), &rr, &x, &y, &w, &h, &bw, &depth); XGetGeometry(disp, win->xwin, &rr, &x, &y, &w, &h, &bw, &depth);
#if 0 #if 0
Eprintf("EWindowSync: %p %#lx: %d,%d %dx%d -> %d,%d %dx%d\n", Eprintf("EWindowSync: %p %#lx: %d,%d %dx%d -> %d,%d %dx%d\n",
xid, xid->win, xid->x, xid->y, xid->w, xid->h, x, y, w, h); xid, xid->xwin, xid->x, xid->y, xid->w, xid->h, x, y, w, h);
#endif #endif
xid->x = x; xid->x = x;
xid->y = y; xid->y = y;
@ -608,7 +586,6 @@ EXWindowGetParent(Window xwin)
return parent; return parent;
} }
#if USE_NEW_WIN_API
Win Win
ECreateWinFromXwin(Window xwin) ECreateWinFromXwin(Window xwin)
{ {
@ -623,7 +600,7 @@ ECreateWinFromXwin(Window xwin)
win = EXidCreate(); win = EXidCreate();
if (!win) if (!win)
return NULL; return NULL;
win->win = xwin; win->xwin = xwin;
win->x = x; win->x = x;
win->y = y; win->y = y;
win->w = w; win->w = w;
@ -631,7 +608,12 @@ ECreateWinFromXwin(Window xwin)
win->depth = depth; win->depth = depth;
return win; return win;
} }
#endif
void
EDestroyWin(Win win)
{
Efree(win);
}
Win Win
ERegisterWindow(Window xwin) ERegisterWindow(Window xwin)
@ -653,11 +635,7 @@ ERegisterWindow(Window xwin)
xid->attached = 1; xid->attached = 1;
done: done:
#if USE_NEW_WIN_API
return xid; return xid;
#else
return xwin;
#endif
} }
void void
@ -698,7 +676,7 @@ EMapWindow(Win win)
return; return;
xid->mapped = 1; xid->mapped = 1;
} }
XMapWindow(disp, Xwin(win)); XMapWindow(disp, win->xwin);
} }
void void
@ -713,7 +691,7 @@ EUnmapWindow(Win win)
return; return;
xid->mapped = 0; xid->mapped = 0;
} }
XUnmapWindow(disp, Xwin(win)); XUnmapWindow(disp, win->xwin);
} }
void void
@ -727,27 +705,27 @@ EReparentWindow(Win win, Win parent, int x, int y)
#if 0 #if 0
Eprintf Eprintf
("EReparentWindow: %p %#lx: %d %#lx->%#lx %d,%d %dx%d -> %d,%d\n", ("EReparentWindow: %p %#lx: %d %#lx->%#lx %d,%d %dx%d -> %d,%d\n",
xid, xid->win, xid->mapped, xid->parent, parent->win, xid, xid->xwin, xid->mapped, xid->parent, parent->xwin,
xid->x, xid->y, xid->w, xid->h, x, y); xid->x, xid->y, xid->w, xid->h, x, y);
#endif #endif
if (Xwin(parent) == xid->parent) if (parent->xwin == xid->parent)
{ {
if ((x != xid->x) || (y != xid->y)) if ((x != xid->x) || (y != xid->y))
{ {
xid->x = x; xid->x = x;
xid->y = y; xid->y = y;
XMoveWindow(disp, Xwin(win), x, y); XMoveWindow(disp, win->xwin, x, y);
} }
return; return;
} }
else else
{ {
xid->parent = Xwin(parent); xid->parent = parent->xwin;
xid->x = x; xid->x = x;
xid->y = y; xid->y = y;
} }
} }
XReparentWindow(disp, Xwin(win), Xwin(parent), x, y); XReparentWindow(disp, win->xwin, parent->xwin, x, y);
} }
void void
@ -760,7 +738,7 @@ EMapRaised(Win win)
{ {
if (xid->mapped) if (xid->mapped)
{ {
XRaiseWindow(disp, Xwin(win)); XRaiseWindow(disp, win->xwin);
return; return;
} }
else else
@ -768,7 +746,7 @@ EMapRaised(Win win)
xid->mapped = 1; xid->mapped = 1;
} }
} }
XMapRaised(disp, Xwin(win)); XMapRaised(disp, win->xwin);
} }
int int
@ -835,7 +813,7 @@ EGetGeometry(Win win, Window * root_return, int *x, int *y,
} }
else else
{ {
ok = EXGetGeometry(Xwin(win), root_return, x, y, w, h, bw, depth); ok = EXGetGeometry(win->xwin, root_return, x, y, w, h, bw, depth);
} }
return ok; return ok;
} }
@ -871,11 +849,11 @@ EConfigureWindow(Win win, unsigned int mask, XWindowChanges * wc)
doit = 1; doit = 1;
} }
if ((doit) || (mask & (CWBorderWidth | CWSibling | CWStackMode))) if ((doit) || (mask & (CWBorderWidth | CWSibling | CWStackMode)))
XConfigureWindow(disp, Xwin(win), mask, wc); XConfigureWindow(disp, win->xwin, mask, wc);
} }
else else
{ {
XConfigureWindow(disp, Xwin(win), mask, wc); XConfigureWindow(disp, win->xwin, mask, wc);
} }
} }
@ -890,7 +868,7 @@ ESetWindowBackgroundPixmap(Win win, Pixmap pmap)
xid->bgpmap = pmap; xid->bgpmap = pmap;
xid->bgcol = 0xffffffff; /* Hmmm.. */ xid->bgcol = 0xffffffff; /* Hmmm.. */
} }
XSetWindowBackgroundPixmap(disp, Xwin(win), pmap); XSetWindowBackgroundPixmap(disp, win->xwin, pmap);
} }
void void
@ -913,7 +891,7 @@ ESetWindowBackground(Win win, int col)
else else
return; return;
} }
XSetWindowBackground(disp, Xwin(win), col); XSetWindowBackground(disp, win->xwin, col);
} }
int int
@ -927,7 +905,7 @@ ETranslateCoordinates(Win src_w, Win dst_w,
if (!child_return) if (!child_return)
child_return = &child; child_return = &child;
return XTranslateCoordinates(disp, Xwin(src_w), Xwin(dst_w), src_x, src_y, return XTranslateCoordinates(disp, src_w->xwin, dst_w->xwin, src_x, src_y,
dest_x_return, dest_y_return, child_return); dest_x_return, dest_y_return, child_return);
} }
@ -966,9 +944,9 @@ ESelectInputAdd(Win win, long mask)
{ {
XWindowAttributes xwa; XWindowAttributes xwa;
XGetWindowAttributes(disp, Xwin(win), &xwa); XGetWindowAttributes(disp, win->xwin, &xwa);
xwa.your_event_mask |= mask; xwa.your_event_mask |= mask;
XSelectInput(disp, Xwin(win), xwa.your_event_mask); XSelectInput(disp, win->xwin, xwa.your_event_mask);
} }
int int
@ -1016,7 +994,7 @@ ExShapeUpdate(EXID * xid)
} }
xid->rects = xid->rects =
XShapeGetRectangles(disp, xid->win, ShapeBounding, &(xid->num_rect), XShapeGetRectangles(disp, xid->xwin, ShapeBounding, &(xid->num_rect),
&(xid->ord)); &(xid->ord));
if (xid->rects) if (xid->rects)
{ {
@ -1029,7 +1007,7 @@ ExShapeUpdate(EXID * xid)
xid->num_rect = 0; xid->num_rect = 0;
XFree(xid->rects); XFree(xid->rects);
xid->rects = NULL; xid->rects = NULL;
XShapeCombineMask(disp, xid->win, ShapeBounding, 0, 0, XShapeCombineMask(disp, xid->xwin, ShapeBounding, 0, 0,
None, ShapeSet); None, ShapeSet);
} }
} }
@ -1037,7 +1015,7 @@ ExShapeUpdate(EXID * xid)
{ {
Eprintf("*** ExShapeUpdate: nrect=%d - Not likely, ignoring.\n", Eprintf("*** ExShapeUpdate: nrect=%d - Not likely, ignoring.\n",
xid->num_rect); xid->num_rect);
XShapeCombineMask(disp, xid->win, ShapeBounding, 0, 0, None, XShapeCombineMask(disp, xid->xwin, ShapeBounding, 0, 0, None,
ShapeSet); ShapeSet);
xid->num_rect = 0; xid->num_rect = 0;
XFree(xid->rects); XFree(xid->rects);
@ -1067,15 +1045,15 @@ ExShapeCombineMask(EXID * xid, int dest, int x, int y, Pixmap pmap, int op)
} }
#if DEBUG_SHAPE_OPS #if DEBUG_SHAPE_OPS
Eprintf("ExShapeCombineMask %#lx %d,%d %dx%d mask=%#lx wassh=%d\n", Eprintf("ExShapeCombineMask %#lx %d,%d %dx%d mask=%#lx wassh=%d\n",
xid->win, xid->x, xid->y, xid->w, xid->h, pmap, wasshaped); xid->xwin, xid->x, xid->y, xid->w, xid->h, pmap, wasshaped);
#endif #endif
if (pmap) if (pmap)
{ {
XShapeCombineMask(disp, xid->win, dest, x, y, pmap, op); XShapeCombineMask(disp, xid->xwin, dest, x, y, pmap, op);
ExShapeUpdate(xid); ExShapeUpdate(xid);
} }
else if (wasshaped) else if (wasshaped)
XShapeCombineMask(disp, xid->win, dest, x, y, pmap, op); XShapeCombineMask(disp, xid->xwin, dest, x, y, pmap, op);
} }
void void
@ -1104,7 +1082,7 @@ ExShapeCombineRectangles(EXID * xid, int dest, int x, int y,
XRectangle * rect, int n_rects, int op, int ordering) XRectangle * rect, int n_rects, int op, int ordering)
{ {
#if DEBUG_SHAPE_OPS #if DEBUG_SHAPE_OPS
Eprintf("ExShapeCombineRectangles %#lx %d\n", xid->win, n_rects); Eprintf("ExShapeCombineRectangles %#lx %d\n", xid->xwin, n_rects);
#endif #endif
if (n_rects == 1 && op == ShapeSet) if (n_rects == 1 && op == ShapeSet)
@ -1115,11 +1093,11 @@ ExShapeCombineRectangles(EXID * xid, int dest, int x, int y,
xid->num_rect = 0; xid->num_rect = 0;
XFree(xid->rects); XFree(xid->rects);
xid->rects = NULL; xid->rects = NULL;
XShapeCombineMask(disp, xid->win, dest, x, y, None, op); XShapeCombineMask(disp, xid->xwin, dest, x, y, None, op);
return; return;
} }
} }
XShapeCombineRectangles(disp, xid->win, dest, x, y, rect, n_rects, op, XShapeCombineRectangles(disp, xid->xwin, dest, x, y, rect, n_rects, op,
ordering); ordering);
if (n_rects > 1) if (n_rects > 1)
{ {
@ -1129,7 +1107,7 @@ ExShapeCombineRectangles(EXID * xid, int dest, int x, int y,
r.x = r.y = 0; r.x = r.y = 0;
r.width = xid->w; r.width = xid->w;
r.height = xid->h; r.height = xid->h;
XShapeCombineRectangles(disp, xid->win, ShapeBounding, 0, 0, &r, XShapeCombineRectangles(disp, xid->xwin, ShapeBounding, 0, 0, &r,
1, ShapeIntersect, Unsorted); 1, ShapeIntersect, Unsorted);
} }
ExShapeUpdate(xid); ExShapeUpdate(xid);
@ -1139,7 +1117,7 @@ static void
ExShapeCombineShape(EXID * xdst, int dest, int x, int y, ExShapeCombineShape(EXID * xdst, int dest, int x, int y,
EXID * xsrc, int src_kind, int op) EXID * xsrc, int src_kind, int op)
{ {
XShapeCombineShape(disp, xdst->win, dest, x, y, xsrc->win, src_kind, op); XShapeCombineShape(disp, xdst->xwin, dest, x, y, xsrc->xwin, src_kind, op);
ExShapeUpdate(xdst); ExShapeUpdate(xdst);
} }
@ -1174,7 +1152,7 @@ EShapeGetRectangles(Win win, int dest, int *rn, int *ord)
#if DEBUG_SHAPE_OPS #if DEBUG_SHAPE_OPS
Eprintf("EShapeGetRectangles-B %#lx nr=%d\n", win, xid->num_rect); Eprintf("EShapeGetRectangles-B %#lx nr=%d\n", win, xid->num_rect);
#endif #endif
r = XShapeGetRectangles(disp, Xwin(win), dest, rn, ord); r = XShapeGetRectangles(disp, win->xwin, dest, rn, ord);
if (r) if (r)
{ {
rr = Emalloc(sizeof(XRectangle) * *rn); rr = Emalloc(sizeof(XRectangle) * *rn);
@ -1253,7 +1231,7 @@ ExShapePropagate(EXID * xid)
xid->h); xid->h);
#endif #endif
XQueryTree(disp, xid->win, &rt, &par, &list, &num); XQueryTree(disp, xid->xwin, &rt, &par, &list, &num);
if (!list) if (!list)
return 0; return 0;
@ -1351,7 +1329,7 @@ EShapeCombineMask(Win win, int dest, int x, int y, Pixmap pmap, int op)
if (xid) if (xid)
ExShapeCombineMask(xid, dest, x, y, pmap, op); ExShapeCombineMask(xid, dest, x, y, pmap, op);
else else
XShapeCombineMask(disp, Xwin(win), dest, x, y, pmap, op); XShapeCombineMask(disp, win->xwin, dest, x, y, pmap, op);
} }
void void
@ -1364,7 +1342,7 @@ EShapeCombineRectangles(Win win, int dest, int x, int y,
if (xid) if (xid)
ExShapeCombineRectangles(xid, dest, x, y, rect, n_rects, op, ordering); ExShapeCombineRectangles(xid, dest, x, y, rect, n_rects, op, ordering);
else else
XShapeCombineRectangles(disp, Xwin(win), dest, x, y, rect, n_rects, op, XShapeCombineRectangles(disp, win->xwin, dest, x, y, rect, n_rects, op,
ordering); ordering);
} }
@ -1374,7 +1352,7 @@ EShapeCombineShape(Win win, int dest, int x, int y,
{ {
EXID *xid; EXID *xid;
XShapeCombineShape(disp, Xwin(win), dest, x, y, Xwin(src_win), src_kind, op); XShapeCombineShape(disp, win->xwin, dest, x, y, src_win->xwin, src_kind, op);
xid = EXidFind(win); xid = EXidFind(win);
if (xid) if (xid)
ExShapeUpdate(xid); ExShapeUpdate(xid);
@ -1413,6 +1391,21 @@ EShapeCheck(Win win)
return xid->num_rect; return xid->num_rect;
} }
Pixmap
ECreatePixmap(Win win, unsigned int width, unsigned int height,
unsigned int depth)
{
if (depth == 0)
depth = win->depth;
return XCreatePixmap(disp, win->xwin, width, height, depth);
}
void
EFreePixmap(Pixmap pmap)
{
XFreePixmap(disp, pmap);
}
Pixmap Pixmap
EXCreatePixmapCopy(Pixmap src, unsigned int w, unsigned int h, EXCreatePixmapCopy(Pixmap src, unsigned int w, unsigned int h,
unsigned int depth) unsigned int depth)
@ -1498,7 +1491,7 @@ EWindowGetShapePixmap(Win win)
XSetForeground(disp, gc, 0); XSetForeground(disp, gc, 0);
rect = rect =
XShapeGetRectangles(disp, Xwin(win), ShapeBounding, &rect_num, &rect_ord); XShapeGetRectangles(disp, win->xwin, ShapeBounding, &rect_num, &rect_ord);
XFillRectangle(disp, mask, gc, 0, 0, w, h); XFillRectangle(disp, mask, gc, 0, 0, w, h);
if (rect) if (rect)
{ {

View File

@ -24,23 +24,17 @@
#ifndef _XWIN_H_ #ifndef _XWIN_H_
#define _XWIN_H_ #define _XWIN_H_
#if USE_NEW_WIN_API
typedef struct _xwin *Win; typedef struct _xwin *Win;
Window Xwin(const Win win);
Win ECreateWinFromXwin(Window xwin);
#define EDestroyWin(win) Efree(win)
Win ELookupXwin(Window xwin);
#define NoWin ((Win)0) #define NoWin ((Win)0)
#else
#define Win Window Win ELookupXwin(Window xwin);
#define Xwin(win) (win)
#define ECreateWinFromXwin(xwin) (xwin) #define Xwin(win) WinGetXwin(win)
#define EDestroyWin(xwin) Window WinGetXwin(const Win win);
#define ELookupXwin(xwin) (xwin)
#define NoWin None Win ECreateWinFromXwin(Window xwin);
#endif void EDestroyWin(Win win);
Display *EDisplayOpen(const char *dstr, int scr); Display *EDisplayOpen(const char *dstr, int scr);
void EDisplayClose(void); void EDisplayClose(void);
@ -116,10 +110,9 @@ int EDrawableCheck(Drawable draw, int grab);
#define EClearArea(win, x, y, w, h, exp) \ #define EClearArea(win, x, y, w, h, exp) \
XClearArea(disp, Xwin(win), x, y, w, h, exp) XClearArea(disp, Xwin(win), x, y, w, h, exp)
#define ECreatePixmap(win, w, h, d) \ Pixmap ECreatePixmap(Win win, unsigned int width,
XCreatePixmap(disp, Xwin(win), w, h, d) unsigned int height, unsigned int depth);
#define EFreePixmap(pmap) \ void EFreePixmap(Pixmap pixmap);
XFreePixmap(disp, pmap)
void EShapeCombineMask(Win win, int dest, int x, int y, void EShapeCombineMask(Win win, int dest, int x, int y,
Pixmap pmap, int op); Pixmap pmap, int op);