Re: Removing shadows underneath windows when using xcompmgr | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Well, I tried first to just draw the four sides of the shadow with four different XRenderComposite() calls. I was then going to proceed to use that information to set a clip on the root window for drawing the shadow (and returning to a single XRenderComposite() call, as before). Then I tried creating a clip region that only includes the shadow space of the window. That seems to work, in a way, but for some reason, now all the shadow edges are visible on top of all the windows. So you see these little ghost shadows all over the screen, even if the windows they belong to are obscured. I have attached a diff of what I have done to the current xcompmgr source. There are a lot of commented out parts where I have been trying various things. You* can ignore those. *By "you", I mean anyone who happens to want to take a look at this, not the parent in particular. � wrote: > Joel Feiner a �crit : >> Has anybody tried to fix this bug/misfeature with any success? Or >> perhaps someone has some insight into how all the offset and scalings >> work so that I can implement it myself. > > Maybe setting some clipping on the original window region before drawing > the shadow? The code to do this seems to be be simpler than changing the > shadow code. > > I think the relevant bits are around the XRenderComposite call on line 1051. > > Cheers >
diff --git a/xcompmgr.c b/xcompmgr.c
index ad076a5..24ee84b 100644
--- a/xcompmgr.c
+++ b/xcompmgr.c
@@ -43,6 +43,7 @@
#include <X11/extensions/Xcomposite.h>
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xrender.h>
+#include <X11/extensions/shape.h>
#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2
#define HAS_NAME_WINDOW_PIXMAP 1
@@ -85,6 +86,8 @@ typedef struct _win {
/* for drawing translucent windows */
XserverRegion borderClip;
+ XserverRegion shadowClip;
+
struct _win *prev_trans;
} win;
@@ -832,6 +835,7 @@ win_extents (Display *dpy, win *w)
r.height = w->a.height + w->a.border_width * 2;
if (compMode != CompSimple && !(w->windowType == winDockAtom && excludeDockShadows))
{
+ XserverRegion reg1,reg2,dst;
if (compMode == CompServerShadows || w->mode != WINDOW_ARGB)
{
XRectangle sr;
@@ -992,6 +996,11 @@ paint_all (Display *dpy, XserverRegion region)
XFixesDestroyRegion (dpy, w->borderClip);
w->borderClip = None;
}
+ if(w->shadowClip)
+ {
+ XFixesDestroyRegion(dpy, w->shadowClip);
+ w->shadowClip = None;
+ }
}
if (!w->borderSize)
w->borderSize = border_size (dpy, w);
@@ -1022,7 +1031,25 @@ paint_all (Display *dpy, XserverRegion region)
if (!w->borderClip)
{
w->borderClip = XFixesCreateRegion (dpy, 0, 0);
- XFixesCopyRegion (dpy, w->borderClip, region);
+ XFixesCopyRegion (dpy, w->borderClip, region);
+// w->borderClip = XFixesCreateRegionFromWindow(dpy, w->id);
+ }
+ if(!w->shadowClip)
+ {
+ XRectangle r;
+ XserverRegion tmp;
+ r.x = w->a.x + w->shadow_dx;
+ r.y = w->a.y + w->shadow_dy;
+ r.width = w->shadow_width; //root_width;
+ r.height = w->shadow_height; //root_height;
+// w->shadowClip = XFixesCreateRegion(dpy, &r, 1);
+// XFixesSubtractRegion(dpy, w->shadowClip, w->shadowClip, w->borderClip);
+ w->shadowClip = XFixesCreateRegionFromWindow(dpy, w->id, ShapeClip);
+ XFixesTranslateRegion(dpy, w->shadowClip, w->a.x, w->a.y);
+ tmp = XFixesCreateRegion(dpy, &r, 1);
+ XFixesSubtractRegion(dpy, w->shadowClip, tmp, w->shadowClip);//, tmp);
+ XFixesDestroyRegion(dpy, tmp);
+// XFixesInvertRegion(dpy, w->shadowClip, &r, w->shadowClip);
}
w->prev_trans = t;
t = w;
@@ -1060,11 +1087,20 @@ paint_all (Display *dpy, XserverRegion region)
/* don't bother drawing shadows on desktop windows */
if (w->shadow && w->windowType != winDesktopAtom)
{
- XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow, rootBuffer,
- 0, 0, 0, 0,
- w->a.x + w->shadow_dx,
- w->a.y + w->shadow_dy,
- w->shadow_width, w->shadow_height);
+// if(w->mode != WINDOW_TRANS) {
+ if(w->shadowClip) {
+ XFixesSetPictureClipRegion(dpy, rootBuffer, 0, 0, w->shadowClip);
+ }
+ XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow,
+ rootBuffer,
+ 0, 0, 0, 0,
+ w->a.x + w->shadow_dx,
+ w->a.y + w->shadow_dy,
+ w->shadow_width, w->shadow_height);
+ if(w->shadowClip) {
+ XFixesSetPictureClipRegion(dpy, rootBuffer, 0, 0, w->borderClip);
+ }
+ // }
}
break;
}
@@ -1089,6 +1125,34 @@ paint_all (Display *dpy, XserverRegion region)
XRenderComposite (dpy, PictOpOver, w->picture, w->alphaPict, rootBuffer,
0, 0, 0, 0,
x, y, wid, hei);
+ /*
+ // TODO: do this with a clip
+ // do the top first
+ XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow, rootBuffer,
+ 0, 0, 0, 0,
+ w->a.x + w->shadow_dx,
+ w->a.y + w->shadow_dy,
+ w->shadow_width, -w->shadow_dy);
+ // then the bottom
+ XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow, rootBuffer,
+ 0, 0, 0, w->a.height - w->shadow_dy,
+ w->a.x + w->shadow_dx,
+ w->a.y + w->a.height,
+ w->shadow_width, -w->shadow_dy);
+ // then the left
+ XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow, rootBuffer,
+ 0, 0, 0, -w->shadow_dy,
+ w->a.x + w->shadow_dx,
+ w->a.y,
+ -w->shadow_dx, w->a.height);
+ // then the right
+ XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow, rootBuffer,
+ 0, 0, w->a.width - w->shadow_dx, -w->shadow_dy,
+ w->a.x + w->a.width,
+ w->a.y,
+ -w->shadow_dx, w->a.height);
+ */
+
}
else if (w->mode == WINDOW_ARGB)
{
@@ -1111,6 +1175,8 @@ paint_all (Display *dpy, XserverRegion region)
}
XFixesDestroyRegion (dpy, w->borderClip);
w->borderClip = None;
+ XFixesDestroyRegion(dpy, w->shadowClip);
+ w->shadowClip = None;
}
XFixesDestroyRegion (dpy, region);
if (rootBuffer != rootPicture)
_______________________________________________ xorg mailing list xorg@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/xorg
[X Forum] [Devices] [XFree86] [XFree86 Newbie] [Site Home] [IETF Annouce] [Security] [Fontconfig] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Video for Linux] [Linux RAID] [Linux Resources]