Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        x.c xwin.h 


Log Message:
Save colormap in Win struct.
New normal windows now get parent (not root) window attributes.

===================================================================
RCS file: /cvs/e/e16/e/src/x.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -3 -r1.139 -r1.140
--- x.c 14 May 2006 10:47:50 -0000      1.139
+++ x.c 14 May 2006 16:00:20 -0000      1.140
@@ -59,8 +59,9 @@
    int                 num_rect;
    int                 ord;
    XRectangle         *rects;
-   int                 depth;
    Visual             *visual;
+   int                 depth;
+   Colormap            cmap;
    Pixmap              bgpmap;
    int                 bgcol;
 };
@@ -84,6 +85,12 @@
    return win->visual;
 }
 
+Colormap
+WinGetCmap(const Win win)
+{
+   return win->cmap;
+}
+
 static EXID        *
 EXidCreate(void)
 {
@@ -188,7 +195,7 @@
 
 static EXID        *
 EXidSet(Window xwin, Win parent, int x, int y, int w, int h, int depth,
-       Visual * visual)
+       Visual * visual, Colormap cmap)
 {
    EXID               *xid;
 
@@ -201,6 +208,7 @@
    xid->h = h;
    xid->depth = depth;
    xid->visual = visual;
+   xid->cmap = cmap;
 #if DEBUG_XWIN
    Eprintf("EXidSet: %#lx\n", xid->xwin);
 #endif
@@ -300,12 +308,12 @@
 ECreateWindow(Win parent, int x, int y, int w, int h, int saveunder)
 {
    EXID               *win;
-   Window              xwin, xpar;
+   Window              xwin;
    XSetWindowAttributes attr;
 
    attr.backing_store = NotUseful;
    attr.override_redirect = False;
-   attr.colormap = VRoot.cmap;
+   attr.colormap = parent->cmap;
    attr.border_pixel = 0;
 /*   attr.background_pixel = 0; */
    attr.background_pixmap = None;
@@ -316,12 +324,12 @@
    else
       attr.save_under = False;
 
-   xpar = (parent) ? parent->xwin : VRoot.xwin;
-   xwin = XCreateWindow(disp, xpar, x, y, w, h, 0,
-                       VRoot.depth, InputOutput, VRoot.vis,
+   xwin = XCreateWindow(disp, parent->xwin, x, y, w, h, 0,
+                       CopyFromParent, InputOutput, CopyFromParent,
                        CWOverrideRedirect | CWSaveUnder | CWBackingStore |
                        CWColormap | CWBackPixmap | CWBorderPixel, &attr);
-   win = EXidSet(xwin, parent, x, y, w, h, VRoot.depth, VRoot.vis);
+   win = EXidSet(xwin, parent, x, y, w, h, parent->depth, parent->visual,
+                parent->cmap);
 
    return win;
 }
@@ -332,7 +340,7 @@
                    XWindowAttributes * c_attr)
 {
    EXID               *win;
-   Window              xwin, xpar;
+   Window              xwin;
    XSetWindowAttributes attr;
 
    attr.backing_store = NotUseful;
@@ -348,12 +356,12 @@
    else
       attr.save_under = False;
 
-   xpar = (parent) ? parent->xwin : VRoot.xwin;
-   xwin = XCreateWindow(disp, xpar, x, y, w, h, 0,
+   xwin = XCreateWindow(disp, parent->xwin, x, y, w, h, 0,
                        c_attr->depth, InputOutput, c_attr->visual,
                        CWOverrideRedirect | CWSaveUnder | CWBackingStore |
                        CWColormap | CWBackPixmap | CWBorderPixel, &attr);
-   win = EXidSet(xwin, parent, x, y, w, h, c_attr->depth, c_attr->visual);
+   win = EXidSet(xwin, parent, x, y, w, h, c_attr->depth, c_attr->visual,
+                c_attr->colormap);
 
    return win;
 }
@@ -362,15 +370,14 @@
 ECreateEventWindow(Win parent, int x, int y, int w, int h)
 {
    EXID               *win;
-   Window              xwin, xpar;
+   Window              xwin;
    XSetWindowAttributes attr;
 
    attr.override_redirect = False;
 
-   xpar = (parent) ? parent->xwin : VRoot.xwin;
-   xwin = XCreateWindow(disp, xpar, x, y, w, h, 0, 0, InputOnly,
+   xwin = XCreateWindow(disp, parent->xwin, x, y, w, h, 0, 0, InputOnly,
                        CopyFromParent, CWOverrideRedirect, &attr);
-   win = EXidSet(xwin, parent, x, y, w, h, 0, parent->visual);
+   win = EXidSet(xwin, parent, x, y, w, h, 0, NULL, None);
 
    return win;
 }
@@ -604,6 +611,7 @@
    win->h = h;
    win->depth = depth;
    win->visual = VRoot.vis;
+   win->cmap = VRoot.cmap;
 
    return win;
 }
@@ -629,7 +637,7 @@
    Eprintf("ERegisterWindow %#lx %d+%d %dx%d\n", win, x, y, w, h);
 #endif
    xid = EXidSet(xwin, None, xwa.x, xwa.y, xwa.width, xwa.height, xwa.depth,
-                xwa.visual);
+                xwa.visual, xwa.colormap);
    xid->attached = 1;
 
  done:
@@ -1413,6 +1421,12 @@
 EXFreeGC(GC gc)
 {
    return XFreeGC(disp, gc);
+}
+
+void
+EAllocColor(Colormap cmap, XColor * pxc)
+{
+   XAllocColor(disp, cmap, pxc);
 }
 
 void
===================================================================
RCS file: /cvs/e/e16/e/src/xwin.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- xwin.h      10 May 2006 20:44:15 -0000      1.18
+++ xwin.h      14 May 2006 16:00:20 -0000      1.19
@@ -33,6 +33,7 @@
 #define Xwin(win) WinGetXwin(win)
 Window              WinGetXwin(const Win win);
 Visual             *WinGetVisual(const Win win);
+Colormap            WinGetCmap(const Win win);
 
 Win                 ECreateWinFromXwin(Window xwin);
 void                EDestroyWin(Win win);
@@ -130,8 +131,7 @@
 int                 EShapeCheck(Win win);
 Pixmap              EWindowGetShapePixmap(Win win);
 
-#define EAllocColor(pxc) \
-       XAllocColor(disp, VRoot.cmap, pxc)
+void                EAllocColor(Colormap colormap, XColor * pxc);
 void                ESetColor(XColor * pxc, int r, int g, int b);
 void                EGetColor(const XColor * pxc, int *pr, int *pg, int *pb);
 




-------------------------------------------------------
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

Reply via email to