Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: x.c xwin.h Log Message: Remove old window handling API fallback stuff. =================================================================== RCS file: /cvs/e/e16/e/src/x.c,v retrieving revision 1.131 retrieving revision 1.132 diff -u -3 -r1.131 -r1.132 --- x.c 3 May 2006 22:50:52 -0000 1.131 +++ x.c 7 May 2006 15:08:01 -0000 1.132 @@ -49,8 +49,8 @@ struct _xwin *next; struct _xwin *prev; EventCallbackList cbl; + Window xwin; Window parent; - Window win; int x, y, w, h; char mapped; char in_use; @@ -71,13 +71,11 @@ static EXID *xid_first = NULL; static EXID *xid_last = NULL; -#if USE_NEW_WIN_API Window -Xwin(const Win win) +WinGetXwin(const Win win) { - return win->win; + return win->xwin; } -#endif static EXID * EXidCreate(void) @@ -94,7 +92,7 @@ EXidDestroy(EXID * xid) { #if DEBUG_XWIN - Eprintf("EXidDestroy: %p %#lx\n", xid, xid->win); + Eprintf("EXidDestroy: %p %#lx\n", xid, xid->xwin); #endif if (xid->rects) XFree(xid->rects); @@ -107,12 +105,12 @@ EXidAdd(EXID * xid) { #if DEBUG_XWIN - Eprintf("EXidAdd: %p %#lx\n", xid, xid->win); + Eprintf("EXidAdd: %p %#lx\n", xid, xid->xwin); #endif if (!xid_context) xid_context = XUniqueContext(); - XSaveContext(disp, xid->win, xid_context, (XPointer) xid); + XSaveContext(disp, xid->xwin, xid_context, (XPointer) xid); if (!xid_first) { @@ -130,7 +128,7 @@ EXidDel(EXID * xid) { #if DEBUG_XWIN - Eprintf("EXidDel: %p %#lx\n", xid, xid->win); + Eprintf("EXidDel: %p %#lx\n", xid, xid->xwin); #endif if (xid == xid_first) { @@ -155,20 +153,16 @@ xid->next->prev = xid->prev; } - XDeleteContext(disp, xid->win, xid_context); + XDeleteContext(disp, xid->xwin, xid_context); if (xid->in_use) xid->do_del = 1; else EXidDestroy(xid); } -#if USE_NEW_WIN_API #define EXidFind(win) (win) #define EXidLookup ELookupXwin -#else -#define EXidFind EXidLookup -EXID *EXidLookup(Window xwin); -#endif + EXID * EXidLookup(Window xwin) { @@ -187,20 +181,20 @@ } 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; xid = EXidCreate(); xid->parent = parent; - xid->win = win; + xid->xwin = xwin; xid->x = x; xid->y = y; xid->w = w; xid->h = h; xid->depth = depth; #if DEBUG_XWIN - Eprintf("EXidSet: %#lx\n", xid->win); + Eprintf("EXidSet: %#lx\n", xid->xwin); #endif EXidAdd(xid); @@ -287,11 +281,7 @@ if (EventDebug(EDBUG_TYPE_DISPATCH)) Eprintf("EventDispatch: type=%d win=%#lx func=%p prm=%p\n", ev->type, ev->xany.window, eci->func, eci->prm); -#if USE_NEW_WIN_API eci->func(xid, ev, eci->prm); -#else - eci->func(xid->win, ev, eci->prm); -#endif if (xid->do_del) { EXidDestroy(xid); @@ -321,18 +311,14 @@ else 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, VRoot.depth, InputOutput, VRoot.vis, CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWColormap | CWBackPixmap | CWBorderPixel, &attr); win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth); -#if USE_NEW_WIN_API return win; -#else - return xwin; -#endif } /* Creates a window, but takes the visual, depth and the colormap from c_attr. */ @@ -357,18 +343,14 @@ else 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, c_attr->depth, InputOutput, c_attr->visual, CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWColormap | CWBackPixmap | CWBorderPixel, &attr); win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth); -#if USE_NEW_WIN_API return win; -#else - return xwin; -#endif } Win @@ -380,16 +362,12 @@ 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, CopyFromParent, CWOverrideRedirect, &attr); win = EXidSet(xwin, xpar, x, y, w, h, VRoot.depth); -#if USE_NEW_WIN_API return win; -#else - return xwin; -#endif } #if 0 /* Not used */ @@ -437,7 +415,7 @@ { #if 0 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 if ((x == xid->x) && (y == xid->y)) return; @@ -445,7 +423,7 @@ xid->x = x; xid->y = y; } - XMoveWindow(disp, Xwin(win), x, y); + XMoveWindow(disp, win->xwin, x, y); } void @@ -462,7 +440,7 @@ xid->w = w; xid->h = h; } - XResizeWindow(disp, Xwin(win), w, h); + XResizeWindow(disp, win->xwin, w, h); } void @@ -475,7 +453,7 @@ { #if 0 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 if ((w == xid->w) && (h == xid->h) && (x == xid->x) && (y == xid->y)) return; @@ -485,22 +463,22 @@ xid->w = w; xid->h = h; } - XMoveResizeWindow(disp, Xwin(win), x, y, w, h); + XMoveResizeWindow(disp, win->xwin, x, y, w, h); } static int ExDelTree(EXID * xid) { - Window win; + Window xwin; int nsub; xid->do_del = -1; nsub = 0; - win = xid->win; + xwin = xid->xwin; for (xid = xid_first; xid; xid = xid->next) { - if (xid->parent != win) + if (xid->parent != xwin) continue; ExDelTree(xid); nsub++; @@ -516,10 +494,10 @@ int nsub; #if DEBUG_XWIN - Eprintf("ExDestroyWindow: %p %#lx\n", xid, xid->win); + Eprintf("ExDestroyWindow: %p %#lx\n", xid, xid->xwin); #endif if (xid->parent != None) - XDestroyWindow(disp, xid->win); + XDestroyWindow(disp, xid->xwin); /* Mark the ones to be deleted */ nsub = ExDelTree(xid); @@ -548,7 +526,7 @@ if (xid) ExDestroyWindow(xid); else - XDestroyWindow(disp, Xwin(win)); + XDestroyWindow(disp, win->xwin); } void @@ -563,10 +541,10 @@ if (!xid) 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 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 xid->x = x; xid->y = y; @@ -608,7 +586,6 @@ return parent; } -#if USE_NEW_WIN_API Win ECreateWinFromXwin(Window xwin) { @@ -623,7 +600,7 @@ win = EXidCreate(); if (!win) return NULL; - win->win = xwin; + win->xwin = xwin; win->x = x; win->y = y; win->w = w; @@ -631,7 +608,12 @@ win->depth = depth; return win; } -#endif + +void +EDestroyWin(Win win) +{ + Efree(win); +} Win ERegisterWindow(Window xwin) @@ -653,11 +635,7 @@ xid->attached = 1; done: -#if USE_NEW_WIN_API return xid; -#else - return xwin; -#endif } void @@ -698,7 +676,7 @@ return; xid->mapped = 1; } - XMapWindow(disp, Xwin(win)); + XMapWindow(disp, win->xwin); } void @@ -713,7 +691,7 @@ return; xid->mapped = 0; } - XUnmapWindow(disp, Xwin(win)); + XUnmapWindow(disp, win->xwin); } void @@ -727,27 +705,27 @@ #if 0 Eprintf ("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); #endif - if (Xwin(parent) == xid->parent) + if (parent->xwin == xid->parent) { if ((x != xid->x) || (y != xid->y)) { xid->x = x; xid->y = y; - XMoveWindow(disp, Xwin(win), x, y); + XMoveWindow(disp, win->xwin, x, y); } return; } else { - xid->parent = Xwin(parent); + xid->parent = parent->xwin; xid->x = x; xid->y = y; } } - XReparentWindow(disp, Xwin(win), Xwin(parent), x, y); + XReparentWindow(disp, win->xwin, parent->xwin, x, y); } void @@ -760,7 +738,7 @@ { if (xid->mapped) { - XRaiseWindow(disp, Xwin(win)); + XRaiseWindow(disp, win->xwin); return; } else @@ -768,7 +746,7 @@ xid->mapped = 1; } } - XMapRaised(disp, Xwin(win)); + XMapRaised(disp, win->xwin); } int @@ -835,7 +813,7 @@ } 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; } @@ -871,11 +849,11 @@ doit = 1; } if ((doit) || (mask & (CWBorderWidth | CWSibling | CWStackMode))) - XConfigureWindow(disp, Xwin(win), mask, wc); + XConfigureWindow(disp, win->xwin, mask, wc); } else { - XConfigureWindow(disp, Xwin(win), mask, wc); + XConfigureWindow(disp, win->xwin, mask, wc); } } @@ -890,7 +868,7 @@ xid->bgpmap = pmap; xid->bgcol = 0xffffffff; /* Hmmm.. */ } - XSetWindowBackgroundPixmap(disp, Xwin(win), pmap); + XSetWindowBackgroundPixmap(disp, win->xwin, pmap); } void @@ -913,7 +891,7 @@ else return; } - XSetWindowBackground(disp, Xwin(win), col); + XSetWindowBackground(disp, win->xwin, col); } int @@ -927,7 +905,7 @@ if (!child_return) 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); } @@ -966,9 +944,9 @@ { XWindowAttributes xwa; - XGetWindowAttributes(disp, Xwin(win), &xwa); + XGetWindowAttributes(disp, win->xwin, &xwa); xwa.your_event_mask |= mask; - XSelectInput(disp, Xwin(win), xwa.your_event_mask); + XSelectInput(disp, win->xwin, xwa.your_event_mask); } int @@ -1016,7 +994,7 @@ } xid->rects = - XShapeGetRectangles(disp, xid->win, ShapeBounding, &(xid->num_rect), + XShapeGetRectangles(disp, xid->xwin, ShapeBounding, &(xid->num_rect), &(xid->ord)); if (xid->rects) { @@ -1029,7 +1007,7 @@ xid->num_rect = 0; XFree(xid->rects); xid->rects = NULL; - XShapeCombineMask(disp, xid->win, ShapeBounding, 0, 0, + XShapeCombineMask(disp, xid->xwin, ShapeBounding, 0, 0, None, ShapeSet); } } @@ -1037,7 +1015,7 @@ { Eprintf("*** ExShapeUpdate: nrect=%d - Not likely, ignoring.\n", xid->num_rect); - XShapeCombineMask(disp, xid->win, ShapeBounding, 0, 0, None, + XShapeCombineMask(disp, xid->xwin, ShapeBounding, 0, 0, None, ShapeSet); xid->num_rect = 0; XFree(xid->rects); @@ -1067,15 +1045,15 @@ } #if DEBUG_SHAPE_OPS 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 if (pmap) { - XShapeCombineMask(disp, xid->win, dest, x, y, pmap, op); + XShapeCombineMask(disp, xid->xwin, dest, x, y, pmap, op); ExShapeUpdate(xid); } else if (wasshaped) - XShapeCombineMask(disp, xid->win, dest, x, y, pmap, op); + XShapeCombineMask(disp, xid->xwin, dest, x, y, pmap, op); } void @@ -1104,7 +1082,7 @@ XRectangle * rect, int n_rects, int op, int ordering) { #if DEBUG_SHAPE_OPS - Eprintf("ExShapeCombineRectangles %#lx %d\n", xid->win, n_rects); + Eprintf("ExShapeCombineRectangles %#lx %d\n", xid->xwin, n_rects); #endif if (n_rects == 1 && op == ShapeSet) @@ -1115,11 +1093,11 @@ xid->num_rect = 0; XFree(xid->rects); xid->rects = NULL; - XShapeCombineMask(disp, xid->win, dest, x, y, None, op); + XShapeCombineMask(disp, xid->xwin, dest, x, y, None, op); return; } } - XShapeCombineRectangles(disp, xid->win, dest, x, y, rect, n_rects, op, + XShapeCombineRectangles(disp, xid->xwin, dest, x, y, rect, n_rects, op, ordering); if (n_rects > 1) { @@ -1129,7 +1107,7 @@ r.x = r.y = 0; r.width = xid->w; r.height = xid->h; - XShapeCombineRectangles(disp, xid->win, ShapeBounding, 0, 0, &r, + XShapeCombineRectangles(disp, xid->xwin, ShapeBounding, 0, 0, &r, 1, ShapeIntersect, Unsorted); } ExShapeUpdate(xid); @@ -1139,7 +1117,7 @@ ExShapeCombineShape(EXID * xdst, int dest, int x, int y, 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); } @@ -1174,7 +1152,7 @@ #if DEBUG_SHAPE_OPS Eprintf("EShapeGetRectangles-B %#lx nr=%d\n", win, xid->num_rect); #endif - r = XShapeGetRectangles(disp, Xwin(win), dest, rn, ord); + r = XShapeGetRectangles(disp, win->xwin, dest, rn, ord); if (r) { rr = Emalloc(sizeof(XRectangle) * *rn); @@ -1253,7 +1231,7 @@ xid->h); #endif - XQueryTree(disp, xid->win, &rt, &par, &list, &num); + XQueryTree(disp, xid->xwin, &rt, &par, &list, &num); if (!list) return 0; @@ -1351,7 +1329,7 @@ if (xid) ExShapeCombineMask(xid, dest, x, y, pmap, op); else - XShapeCombineMask(disp, Xwin(win), dest, x, y, pmap, op); + XShapeCombineMask(disp, win->xwin, dest, x, y, pmap, op); } void @@ -1364,7 +1342,7 @@ if (xid) ExShapeCombineRectangles(xid, dest, x, y, rect, n_rects, op, ordering); else - XShapeCombineRectangles(disp, Xwin(win), dest, x, y, rect, n_rects, op, + XShapeCombineRectangles(disp, win->xwin, dest, x, y, rect, n_rects, op, ordering); } @@ -1374,7 +1352,7 @@ { 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); if (xid) ExShapeUpdate(xid); @@ -1414,6 +1392,21 @@ } 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 EXCreatePixmapCopy(Pixmap src, unsigned int w, unsigned int h, unsigned int depth) { @@ -1498,7 +1491,7 @@ XSetForeground(disp, gc, 0); 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); if (rect) { =================================================================== RCS file: /cvs/e/e16/e/src/xwin.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- xwin.h 29 Apr 2006 19:39:21 -0000 1.16 +++ xwin.h 7 May 2006 15:08:01 -0000 1.17 @@ -24,23 +24,17 @@ #ifndef _XWIN_H_ #define _XWIN_H_ -#if USE_NEW_WIN_API typedef struct _xwin *Win; -Window Xwin(const Win win); -Win ECreateWinFromXwin(Window xwin); -#define EDestroyWin(win) Efree(win) +#define NoWin ((Win)0) + Win ELookupXwin(Window xwin); -#define NoWin ((Win)0) -#else -#define Win Window -#define Xwin(win) (win) -#define ECreateWinFromXwin(xwin) (xwin) -#define EDestroyWin(xwin) -#define ELookupXwin(xwin) (xwin) -#define NoWin None -#endif +#define Xwin(win) WinGetXwin(win) +Window WinGetXwin(const Win win); + +Win ECreateWinFromXwin(Window xwin); +void EDestroyWin(Win win); Display *EDisplayOpen(const char *dstr, int scr); void EDisplayClose(void); @@ -116,10 +110,9 @@ #define EClearArea(win, x, y, w, h, exp) \ XClearArea(disp, Xwin(win), x, y, w, h, exp) -#define ECreatePixmap(win, w, h, d) \ - XCreatePixmap(disp, Xwin(win), w, h, d) -#define EFreePixmap(pmap) \ - XFreePixmap(disp, pmap) +Pixmap ECreatePixmap(Win win, unsigned int width, + unsigned int height, unsigned int depth); +void EFreePixmap(Pixmap pixmap); void EShapeCombineMask(Win win, int dest, int x, int y, Pixmap pmap, int op); ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs