struct _win *prev_trans;
} win;
-win *list;
+typedef struct _conv {
+ int size;
+ double *data;
+} conv;
+win *list;
Display *dpy;
int scr;
Window root;
Picture rootTile;
XserverRegion allDamage;
int root_height, root_width;
+conv *gussianMap;
#define BACKGROUND_PROP "_XROOTPMAP_ID"
exp ((- (x * x + y * y)) / (2 * r * r)));
}
-typedef struct _conv {
- int size;
- double *data;
-} conv;
conv *
make_gaussian_map (Display *dpy, double r)
}
XImage *
-make_shadow (Display *dpy, double opacity, double r, int width, int height)
+make_shadow (Display *dpy, double opacity, int width, int height)
{
- conv *map = make_gaussian_map (dpy, r);
XImage *ximage;
- double *gdata = map->data;
+ double *gdata = gussianMap->data;
unsigned char *data;
- int gsize = map->size;
+ int gsize = gussianMap->size;
int ylimit, xlimit;
int swidth = width + gsize;
int sheight = height + gsize;
for (y = 0; y < ylimit; y++)
for (x = 0; x < xlimit; x++)
{
- d = sum_gaussian (map, opacity, x - center, y - center, width, height);
+ d = sum_gaussian (gussianMap, opacity, x - center, y - center, width, height);
data[y * swidth + x] = d;
data[(sheight - y - 1) * swidth + x] = d;
data[(sheight - y - 1) * swidth + (swidth - x - 1)] = d;
*/
for (y = 0; y < ylimit; y++)
{
- d = sum_gaussian (map, opacity, center, y - center, width, height);
+ d = sum_gaussian (gussianMap, opacity, center, y - center, width, height);
for (x = gsize; x < swidth - gsize; x++)
{
data[y * swidth + x] = d;
for (x = 0; x < xlimit; x++)
{
- d = sum_gaussian (map, opacity, x - center, center, width, height);
+ d = sum_gaussian (gussianMap, opacity, x - center, center, width, height);
for (y = gsize; y < sheight - gsize; y++)
{
data[y * swidth + x] = d;
* center
*/
- d = sum_gaussian (map, opacity, center, center, width, height);
+ d = sum_gaussian (gussianMap, opacity, center, center, width, height);
for (y = ylimit; y < sheight - ylimit; y++)
for (x = xlimit; x < swidth - xlimit; x++)
data[y * swidth + x] = d;
- free (map);
return ximage;
}
Picture
-shadow_picture (Display *dpy, double opacity, double r, int width, int height, int *wp, int *hp)
+shadow_picture (Display *dpy, double opacity, int width, int height, int *wp, int *hp)
{
- XImage *shadowImage = make_shadow (dpy, opacity, r, width, height);
+ XImage *shadowImage = make_shadow (dpy, opacity, width, height);
Pixmap shadowPixmap = XCreatePixmap (dpy, root,
shadowImage->width,
shadowImage->height,
double opacity = SHADOW_OPACITY;
if (w->mode == WINDOW_TRANS)
opacity = opacity * TRANS_OPACITY;
- w->shadow = shadow_picture (dpy, opacity, SHADOW_RADIUS,
+ w->shadow = shadow_picture (dpy, opacity,
w->a.width, w->a.height,
&w->shadow_width, &w->shadow_height);
w->shadow_dx = SHADOW_OFFSET_X;
return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
}
-#define INTERVAL 30
+#define INTERVAL 0
main ()
{
int n;
int last_update;
int now;
+#if INTERVAL
int timeout;
+#endif
dpy = XOpenDisplay (0);
if (!dpy)
scr = DefaultScreen (dpy);
root = RootWindow (dpy, scr);
pa.subwindow_mode = IncludeInferiors;
+
+ gussianMap = make_gaussian_map(dpy, SHADOW_RADIUS);
+
transPixmap = XCreatePixmap (dpy, root, 1, 1, 8);
pa.repeat = True;
transPicture = XRenderCreatePicture (dpy, transPixmap,
XFree (children);
XUngrabServer (dpy);
paint_all (dpy, None);
+#if INTERVAL
last_update = time_in_millis ();
+#endif
for (;;)
{
+#if INTERVAL
int busy_start = 0;
+#endif
/* dump_wins (); */
do {
XNextEvent (dpy, &ev);
+#if INTERVAL
if (!busy_start)
busy_start = time_in_millis();
+#endif
/* printf ("event %d\n", ev.type); */
switch (ev.type) {
case CreateNotify:
break;
}
} while (XEventsQueued (dpy, QueuedAfterReading));
+#if INTERVAL
now = time_in_millis ();
/* printf ("\t\tbusy %d\n", now - busy_start); */
timeout = INTERVAL - (now - last_update);
if (n > 0 && (ufd.revents & POLLIN) && XEventsQueued (dpy, QueuedAfterReading))
continue;
}
+#endif
if (allDamage)
{
+#if INTERVAL
int old_update = last_update;
last_update = time_in_millis();
/* printf ("delta %d\n", last_update - old_update); */
+#endif
paint_all (dpy, allDamage);
allDamage = None;
}