From 95fc20978b57903ec7534b685f3d91b912c3ecce Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Fri, 29 Apr 2005 17:37:30 +0000 Subject: [PATCH] Initial ARGB client support (Rajsekar Manokaran). SVN revision: 14501 --- AUTHORS | 3 +++ src/E.h | 3 +++ src/ewins.c | 22 ++++++++++++++++++++-- src/x.c | 31 ++++++++++++++++++++++++++++++- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 917705f2..b10b67ff 100644 --- a/AUTHORS +++ b/AUTHORS @@ -228,5 +228,8 @@ Hor Andreas Volz Icons in focus list +Rajsekar Manokaran + Patch for ARGB client support + And others whose names we probably forgot to add (email us and we'll put you in here) diff --git a/src/E.h b/src/E.h index 68d44c56..cc57ce65 100644 --- a/src/E.h +++ b/src/E.h @@ -2263,6 +2263,9 @@ void EventCallbacksProcess(XEvent * ev); Window ECreateWindow(Window parent, int x, int y, int w, int h, int saveunder); +Window ECreateVisualWindow(Window parent, int x, int y, int w, + int h, int saveunder, + XWindowAttributes * child_attr); Window ECreateEventWindow(Window parent, int x, int y, int w, int h); Window ECreateFocusWindow(Window parent, int x, int y, int w, diff --git a/src/ewins.c b/src/ewins.c index 78b4458c..405d8811 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -66,7 +66,10 @@ EwinCreate(Window win, int type) EWin *ewin; XSetWindowAttributes att; Window frame; + int require_argb; + XWindowAttributes win_attr; + require_argb = 0; ewin = Ecalloc(1, sizeof(EWin)); ewin->type = type; @@ -107,7 +110,18 @@ EwinCreate(Window win, int type) ewin->ewmh.opacity = 0; /* If 0, ignore */ - frame = ECreateWindow(VRoot.win, -10, -10, 1, 1, 1); + { + Status s = XGetWindowAttributes(disp, win, &win_attr); + + if (s != BadDrawable && s != BadWindow && win_attr.depth == 32) + { + frame = ECreateVisualWindow(VRoot.win, -10, -10, 1, 1, 1, &win_attr); + require_argb = 1; + } + else + frame = ECreateWindow(VRoot.win, -10, -10, 1, 1, 1); + } + ewin->o.stacked = -1; /* Not placed on desk yet */ EobjInit(&ewin->o, EOBJ_TYPE_EWIN, frame, -10, -10, -1, -1, NULL); EoSetDesk(ewin, DesksGetCurrent()); @@ -115,7 +129,11 @@ EwinCreate(Window win, int type) EoSetShadow(ewin, 1); EobjListFocusAdd(&ewin->o, 0); - ewin->win_container = ECreateWindow(EoGetWin(ewin), 0, 0, 1, 1, 0); + if (require_argb) + ewin->win_container = + ECreateVisualWindow(EoGetWin(ewin), 0, 0, 1, 1, 0, &win_attr); + else + ewin->win_container = ECreateWindow(EoGetWin(ewin), 0, 0, 1, 1, 0); att.event_mask = EWIN_CONTAINER_EVENT_MASK; att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask; EChangeWindowAttributes(ewin->win_container, diff --git a/src/x.c b/src/x.c index 9bb794bd..9227dcc3 100644 --- a/src/x.c +++ b/src/x.c @@ -266,7 +266,36 @@ ECreateWindow(Window parent, int x, int y, int w, int h, int saveunder) else attr.save_under = False; win = XCreateWindow(disp, parent, x, y, w, h, 0, - CopyFromParent, InputOutput, CopyFromParent, + VRoot.depth, InputOutput, VRoot.vis, + CWOverrideRedirect | CWSaveUnder | CWBackingStore | + CWColormap | CWBackPixmap | CWBorderPixel, &attr); + EXidSet(win, parent, x, y, w, h, VRoot.depth); + + return win; +} + +/* Creates a window, but takes the visual, depth and the colormap from c_attr. */ +Window +ECreateVisualWindow(Window parent, int x, int y, int w, int h, int saveunder, + XWindowAttributes * c_attr) +{ + Window win; + XSetWindowAttributes attr; + + attr.backing_store = NotUseful; + attr.override_redirect = True; + attr.border_pixel = 0; + attr.colormap = c_attr->colormap; +/* attr.background_pixel = 0; */ + attr.background_pixmap = None; + if ((saveunder == 1) && (Conf.save_under)) + attr.save_under = True; + else if (saveunder == 2) + attr.save_under = True; + else + attr.save_under = False; + win = XCreateWindow(disp, parent, x, y, w, h, 0, + c_attr->depth, InputOutput, c_attr->visual, CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWColormap | CWBackPixmap | CWBorderPixel, &attr); EXidSet(win, parent, x, y, w, h, VRoot.depth);