From c120bcd309ba48133a6265e6880fff4dea210772 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Mon, 19 Mar 2007 05:37:57 +0000 Subject: [PATCH] Add some glx support stuff. SVN revision: 28810 --- src/ecompmgr.c | 4 +++- src/eobj.h | 21 ++++++++++++--------- src/x.c | 50 ++++++++++++++++++++++++++++++++++++-------------- src/xwin.h | 2 ++ 4 files changed, 53 insertions(+), 24 deletions(-) diff --git a/src/ecompmgr.c b/src/ecompmgr.c index 46113414..8fe03a5c 100644 --- a/src/ecompmgr.c +++ b/src/ecompmgr.c @@ -92,7 +92,9 @@ #define INV_GEOM (INV_POS | INV_SIZE) #define INV_ALL (INV_POS | INV_SIZE | INV_CLIP | INV_OPACITY | INV_SHADOW | INV_PIXMAP) -struct _eoci +typedef struct _cmhook ECmWinInfo; + +struct _cmhook { EObj *next; /* Paint order */ EObj *prev; /* Paint order */ diff --git a/src/eobj.h b/src/eobj.h index cb0f44f3..841e2bde 100644 --- a/src/eobj.h +++ b/src/eobj.h @@ -26,10 +26,6 @@ #include "etypes.h" #include "xwin.h" -#if USE_COMPOSITE -typedef struct _eoci ECmWinInfo; -#endif - typedef struct _eobj EObj; struct _eobj @@ -51,17 +47,20 @@ struct _eobj unsigned noredir:1; /* Do not redirect */ unsigned shadow:1; /* Enable shadows */ unsigned fade:1; /* Enable fading */ -#if USE_COMPOSITE - unsigned int opacity; - ECmWinInfo *cmhook; - unsigned int serial; -#endif struct { char *wm_name; char *wm_res_name; char *wm_res_class; } icccm; +#if USE_COMPOSITE + unsigned int serial; + unsigned int opacity; + struct _cmhook *cmhook; +#endif +#if USE_GLX + struct _glhook *glhook; +#endif }; #define EOBJ_TYPE_EWIN 0 @@ -165,6 +164,10 @@ int EobjLower(EObj * eo); void EobjShapeUpdate(EObj * eo, int propagate); void EobjsRepaint(void); Pixmap EobjGetPixmap(const EObj * eo); + +#if USE_GLX +struct _etexture *EobjGetTexture(EObj * eo); +#endif void EobjChangeOpacity(EObj * eo, unsigned int opacity); void EobjChangeShadow(EObj * eo, int shadow); void EobjSetLayer(EObj * eo, int layer); diff --git a/src/x.c b/src/x.c index 2766d3a9..111603a2 100644 --- a/src/x.c +++ b/src/x.c @@ -347,12 +347,33 @@ ECreateWindow(Win parent, int x, int y, int w, int h, int saveunder) } #if USE_COMPOSITE -Win -ECreateArgbWindow(Win parent, int x, int y, int w, int h, Win cwin) +static Win +ECreateWindowVDC(Win parent, int x, int y, int w, int h, + Visual * vis, unsigned int depth, Colormap cmap) { EXID *win; Window xwin; XSetWindowAttributes attr; + + attr.background_pixmap = None; + attr.border_pixel = 0; + attr.backing_store = NotUseful; + attr.save_under = False; + attr.override_redirect = False; + attr.colormap = cmap; + + xwin = XCreateWindow(disp, parent->xwin, x, y, w, h, 0, + depth, InputOutput, vis, + CWOverrideRedirect | CWSaveUnder | CWBackingStore | + CWColormap | CWBackPixmap | CWBorderPixel, &attr); + win = EXidSet(xwin, parent, x, y, w, h, depth, vis, cmap); + + return win; +} + +Win +ECreateArgbWindow(Win parent, int x, int y, int w, int h, Win cwin) +{ int depth; Visual *vis; Colormap cmap; @@ -376,23 +397,24 @@ ECreateArgbWindow(Win parent, int x, int y, int w, int h, Win cwin) cmap = argb_cmap; } - attr.background_pixmap = None; - attr.border_pixel = 0; - attr.backing_store = NotUseful; - attr.save_under = False; - attr.override_redirect = False; - attr.colormap = cmap; + return ECreateWindowVDC(parent, x, y, w, h, vis, depth, cmap); +} - xwin = XCreateWindow(disp, parent->xwin, x, y, w, h, 0, - depth, InputOutput, vis, - CWOverrideRedirect | CWSaveUnder | CWBackingStore | - CWColormap | CWBackPixmap | CWBorderPixel, &attr); - win = EXidSet(xwin, parent, x, y, w, h, depth, vis, cmap); +#if USE_GLX +Win +ECreateWindowVD(Win parent, int x, int y, int w, int h, + Visual * vis, unsigned int depth) +{ + Colormap cmap; - return win; + cmap = XCreateColormap(disp, VRoot.xwin, vis, AllocNone); + + return ECreateWindowVDC(parent, x, y, w, h, vis, depth, cmap); } #endif +#endif /* USE_COMPOSITE */ + Win ECreateObjectWindow(Win parent, int x, int y, int w, int h, int saveunder, int type, Win cwin, char *argb_ret) diff --git a/src/xwin.h b/src/xwin.h index 61cf0277..fd9115f2 100644 --- a/src/xwin.h +++ b/src/xwin.h @@ -125,6 +125,8 @@ Win ECreateWindow(Win parent, int x, int y, int w, int h, int saveunder); Win ECreateArgbWindow(Win parent, int x, int y, int w, int h, Win cwin); +Win ECreateWindowVD(Win parent, int x, int y, int w, int h, + Visual * vis, unsigned int depth); 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,