4 * Copyright © 2003 Keith Packard
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
26 /* Modified by Matthew Hawn. I don't know what to say here so follow what it
27 says above. Not that I can really do anything about it
39 #include <X11/Xutil.h>
40 #include <X11/extensions/Xcomposite.h>
41 #include <X11/extensions/Xdamage.h>
42 #include <X11/extensions/Xrender.h>
52 XserverRegion borderSize;
53 XserverRegion extents;
60 unsigned long damage_sequence; /* sequence when damage was created */
62 /* for drawing translucent windows */
63 XserverRegion borderClip;
64 struct _win *prev_trans;
67 typedef struct _conv {
81 XserverRegion allDamage;
83 int root_height, root_width;
86 /* find these once and be done with it */
90 /* translucency property name */
91 #define TRANS_PROP "CM_TRANSLUCENCY"
95 #define WINDOW_SOLID 0
96 #define WINDOW_TRANS 1
99 #define TRANS_OPACITY 0.75
100 #define SHADOW_RADIUS 8
101 #define SHADOW_OPACITY 0.75
102 #define SHADOW_OFFSET_X (-SHADOW_RADIUS * 3 / 2)
103 #define SHADOW_OFFSET_Y (-SHADOW_RADIUS * 2 / 2)
105 #define DEBUG_REPAINT 0
106 #define DEBUG_EVENTS 0
107 #define MONITOR_REPAINT 0
110 gaussian (double r, double x, double y)
112 return ((1 / (sqrt (2 * M_PI * r))) *
113 exp ((- (x * x + y * y)) / (2 * r * r)));
118 make_gaussian_map (Display *dpy, double r)
121 int size = ((int) ceil ((r * 3)) + 1) & ~1;
122 int center = size / 2;
127 c = malloc (sizeof (conv) + size * size * sizeof (double));
129 c->data = (double *) (c + 1);
130 for (y = 0; y < size; y++)
131 for (x = 0; x < size; x++)
133 g = gaussian (r, (double) (x - center), (double) (y - center));
135 c->data[y * size + x] = g;
137 /* printf ("gaussian total %f\n", t); */
138 for (y = 0; y < size; y++)
139 for (x = 0; x < size; x++)
141 c->data[y*size + x] /= t;
147 * A picture will help
149 * -center 0 width width+center
150 * -center +-----+-------------------+-----+
153 * 0 +-----+-------------------+-----+
157 * height +-----+-------------------+-----+
160 * center +-----+-------------------+-----+
164 sum_gaussian (conv *map, double opacity, int x, int y, int width, int height)
168 double *g_line = map->data;
169 int g_size = map->size;
170 int center = g_size / 2;
171 int fx_start, fx_end;
172 int fy_start, fy_end;
176 * Compute set of filter values which are "in range",
177 * that's the set with:
178 * 0 <= x + (fx-center) && x + (fx-center) < width &&
179 * 0 <= y + (fy-center) && y + (fy-center) < height
181 * 0 <= x + (fx - center) x + fx - center < width
182 * center - x <= fx fx < width + center - x
185 fx_start = center - x;
188 fx_end = width + center - x;
192 fy_start = center - y;
195 fy_end = height + center - y;
199 g_line = g_line + fy_start * g_size + fx_start;
202 for (fy = fy_start; fy < fy_end; fy++)
207 for (fx = fx_start; fx < fx_end; fx++)
213 return ((unsigned char) (v * opacity * 255.0));
217 make_shadow (Display *dpy, double opacity, int width, int height)
221 int gsize = gaussianMap->size;
223 int swidth = width + gsize;
224 int sheight = height + gsize;
225 int center = gsize / 2;
230 data = malloc (swidth * sheight * sizeof (unsigned char));
231 ximage = XCreateImage (dpy,
232 DefaultVisual(dpy, DefaultScreen(dpy)),
237 swidth, sheight, 8, swidth * sizeof (unsigned char));
239 * Build the gaussian in sections
243 * center (fill the complete data array)
246 d = sum_gaussian (gaussianMap, opacity, center, center, width, height);
247 memset(data, d, sheight * swidth);
253 if (ylimit > sheight / 2)
254 ylimit = (sheight + 1) / 2;
256 if (xlimit > swidth / 2)
257 xlimit = (swidth + 1) / 2;
259 for (y = 0; y < ylimit; y++)
260 for (x = 0; x < xlimit; x++)
262 d = sum_gaussian (gaussianMap, opacity, x - center, y - center, width, height);
263 data[y * swidth + x] = d;
264 data[(sheight - y - 1) * swidth + x] = d;
265 data[(sheight - y - 1) * swidth + (swidth - x - 1)] = d;
266 data[y * swidth + (swidth - x - 1)] = d;
272 x_diff = swidth - (gsize * 2);
273 if (x_diff > 0 && ylimit > 0)
275 for (y = 0; y < ylimit; y++)
277 d = sum_gaussian (gaussianMap, opacity, center, y - center, width, height);
278 memset (&data[y * swidth + gsize], d, x_diff);
279 memset (&data[(sheight - y - 1) * swidth + gsize], d, x_diff);
281 for (x = gsize; x < swidth - gsize; x++)
283 data[y * swidth + x] = d;
284 data[(sheight - y - 1) * swidth + x] = d;
294 for (x = 0; x < xlimit; x++)
296 d = sum_gaussian (gaussianMap, opacity, x - center, center, width, height);
297 for (y = gsize; y < sheight - gsize; y++)
299 data[y * swidth + x] = d;
300 data[y * swidth + (swidth - x - 1)] = d;
308 d = sum_gaussian (gaussianMap, opacity, center, center, width, height);
309 for (y = ylimit; y < sheight - ylimit; y++)
310 for (x = xlimit; x < swidth - xlimit; x++)
311 data[y * swidth + x] = d;
317 shadow_picture (Display *dpy, double opacity, int width, int height, int *wp, int *hp)
319 XImage *shadowImage = make_shadow (dpy, opacity, width, height);
320 Pixmap shadowPixmap = XCreatePixmap (dpy, root,
324 Picture shadowPicture = XRenderCreatePicture (dpy, shadowPixmap,
325 XRenderFindStandardFormat (dpy, PictStandardA8),
327 GC gc = XCreateGC (dpy, shadowPixmap, 0, 0);
329 XPutImage (dpy, shadowPixmap, gc, shadowImage, 0, 0, 0, 0,
331 shadowImage->height);
332 *wp = shadowImage->width;
333 *hp = shadowImage->height;
335 XDestroyImage (shadowImage);
336 XFreePixmap (dpy, shadowPixmap);
337 return shadowPicture;
341 find_win (Display *dpy, Window id)
345 for (w = list; w; w = w->next)
351 static char *backgroundProps[] = {
358 root_tile (Display *dpy)
364 unsigned long nitems;
365 unsigned long bytes_after;
368 XRenderPictureAttributes pa;
372 for (p = 0; backgroundProps[p]; p++)
374 if (XGetWindowProperty (dpy, root, XInternAtom (dpy, backgroundProps[p], False),
375 0, 4, False, AnyPropertyType,
376 &actual_type, &actual_format, &nitems, &bytes_after, &prop) == Success &&
377 actual_type == XInternAtom (dpy, "PIXMAP", False) && actual_format == 32 && nitems == 1)
379 memcpy (&pixmap, prop, 4);
387 pixmap = XCreatePixmap (dpy, root, 1, 1, DefaultDepth (dpy, scr));
391 picture = XRenderCreatePicture (dpy, pixmap,
392 XRenderFindVisualFormat (dpy,
393 DefaultVisual (dpy, scr)),
399 c.red = c.green = c.blue = 0x8080;
401 XRenderFillRectangle (dpy, PictOpSrc, picture, &c,
408 paint_root (Display *dpy)
411 rootTile = root_tile (dpy);
413 XRenderComposite (dpy, PictOpSrc,
414 rootTile, None, rootBuffer,
415 0, 0, 0, 0, 0, 0, root_width, root_height);
419 win_extents (Display *dpy, win *w)
425 r.width = w->a.width + w->a.border_width * 2;
426 r.height = w->a.height + w->a.border_width * 2;
427 if (w->mode != WINDOW_ARGB)
433 double opacity = SHADOW_OPACITY;
434 if (w->mode == WINDOW_TRANS)
435 opacity = opacity * TRANS_OPACITY;
436 w->shadow = shadow_picture (dpy, opacity,
437 w->a.width + w->a.border_width * 2,
438 w->a.height + w->a.border_width * 2,
439 &w->shadow_width, &w->shadow_height);
440 w->shadow_dx = SHADOW_OFFSET_X;
441 w->shadow_dy = SHADOW_OFFSET_Y;
443 sr.x = w->a.x + w->shadow_dx;
444 sr.y = w->a.y + w->shadow_dy;
445 sr.width = w->shadow_width;
446 sr.height = w->shadow_height;
449 r.width = (r.x + r.width) - sr.x;
454 r.height = (r.y + r.height) - sr.y;
457 if (sr.width > r.width)
459 if (sr.height > r.height)
460 r.height = sr.height;
462 return XFixesCreateRegion (dpy, &r, 1);
466 border_size (Display *dpy, win *w)
468 XserverRegion border;
469 border = XFixesCreateRegionFromWindow (dpy, w->id, WindowRegionBounding);
471 XFixesTranslateRegion (dpy, border,
472 w->a.x + w->a.border_width,
473 w->a.y + w->a.border_width);
478 paint_all (Display *dpy, XserverRegion region)
488 r.width = root_width;
489 r.height = root_height;
490 region = XFixesCreateRegion (dpy, &r, 1);
493 rootBuffer = rootPicture;
497 Pixmap rootPixmap = XCreatePixmap (dpy, root, root_width, root_height,
498 DefaultDepth (dpy, scr));
499 rootBuffer = XRenderCreatePicture (dpy, rootPixmap,
500 XRenderFindVisualFormat (dpy,
501 DefaultVisual (dpy, scr)),
503 XFreePixmap (dpy, rootPixmap);
506 XFixesSetPictureClipRegion (dpy, rootPicture, 0, 0, region);
508 XRenderComposite (dpy, PictOpSrc, blackPicture, None, rootPicture,
509 0, 0, 0, 0, 0, 0, root_width, root_height);
514 for (w = list; w; w = w->next)
516 if (w->a.map_state != IsViewable)
518 /* never painted, ignore it */
524 printf (" 0x%x", w->id);
530 XFixesDestroyRegion (dpy, w->borderSize);
531 w->borderSize = None;
535 XFixesDestroyRegion (dpy, w->extents);
540 XFixesDestroyRegion (dpy, w->borderClip);
541 w->borderClip = None;
545 w->borderSize = border_size (dpy, w);
547 w->extents = win_extents (dpy, w);
548 if (w->mode == WINDOW_SOLID)
550 XFixesSetPictureClipRegion (dpy, rootBuffer, 0, 0, region);
551 XFixesSubtractRegion (dpy, region, region, w->borderSize);
552 XRenderComposite (dpy, PictOpSrc, w->picture, None, rootBuffer,
554 w->a.x + w->a.border_width,
555 w->a.y + w->a.border_width,
561 w->borderClip = XFixesCreateRegion (dpy, 0, 0);
562 XFixesCopyRegion (dpy, w->borderClip, region);
571 XFixesSetPictureClipRegion (dpy, rootBuffer, 0, 0, region);
573 for (w = t; w; w = w->prev_trans)
575 XFixesSetPictureClipRegion (dpy, rootBuffer, 0, 0, w->borderClip);
578 XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow, rootBuffer,
580 w->a.x + w->shadow_dx,
581 w->a.y + w->shadow_dy,
582 w->shadow_width, w->shadow_height);
584 if (w->mode == WINDOW_TRANS)
585 XRenderComposite (dpy, PictOpOver, w->picture, transPicture, rootBuffer,
587 w->a.x + w->a.border_width,
588 w->a.y + w->a.border_width,
591 else if (w->mode == WINDOW_ARGB)
592 XRenderComposite (dpy, PictOpOver, w->picture, None, rootBuffer,
594 w->a.x + w->a.border_width,
595 w->a.y + w->a.border_width,
598 XFixesDestroyRegion (dpy, w->borderClip);
599 w->borderClip = None;
601 XFixesDestroyRegion (dpy, region);
602 if (rootBuffer != rootPicture)
604 XFixesSetPictureClipRegion (dpy, rootBuffer, 0, 0, None);
605 XRenderComposite (dpy, PictOpSrc, rootBuffer, None, rootPicture,
606 0, 0, 0, 0, 0, 0, root_width, root_height);
611 add_damage (Display *dpy, XserverRegion damage)
615 XFixesUnionRegion (dpy, allDamage, allDamage, damage);
616 XFixesDestroyRegion (dpy, damage);
623 repair_win (Display *dpy, Window id)
625 win *w = find_win (dpy, id);
632 parts = win_extents (dpy, w);
633 XDamageSubtract (dpy, w->damage, None, None);
637 parts = XFixesCreateRegion (dpy, 0, 0);
638 XDamageSubtract (dpy, w->damage, None, parts);
639 XFixesTranslateRegion (dpy, parts,
640 w->a.x + w->a.border_width,
641 w->a.y + w->a.border_width);
643 add_damage (dpy, parts);
648 map_win (Display *dpy, Window id, unsigned long sequence)
650 win *w = find_win (dpy, id);
654 w->a.map_state = IsViewable;
656 /* make sure we know if property was changed */
657 XSelectInput(dpy, id, PropertyChangeMask);
664 unmap_win (Display *dpy, Window id)
666 win *w = find_win (dpy, id);
670 w->a.map_state = IsUnmapped;
672 if (w->extents != None)
674 add_damage (dpy, w->extents); /* destroys region */
678 /* don't care about properties anymore */
679 XSelectInput(dpy, id, 0);
685 /* Get the translucency prop from window
691 get_trans_prop(Display *dpy, win *w)
695 unsigned long n, left;
698 XGetWindowProperty(dpy, w->id, transPropAtom, 0L, 1L, False, intAtom, &actual, &format,
699 &n, &left, (unsigned char **) &data);
703 XFree( (void *) data);
710 /* determine mode for window all in one place.
711 Future might check for menu flag and other cool things
716 determine_mode(Display *dpy, win *w)
720 /* if trans prop == -1 fall back on previous tests*/
722 int p = get_trans_prop(dpy, w);
727 /* don't really care about the value as long as > 0 */
740 XRenderPictFormat *format;
741 if (w->a.class == InputOnly)
747 format = XRenderFindVisualFormat (dpy, w->a.visual);
752 if (format && format->type == PictTypeDirect && format->direct.alphaMask)
756 else if (w->a.override_redirect)
758 /* changed this as a lot of window managers set this for all top
771 add_win (Display *dpy, Window id, Window prev)
773 win *new = malloc (sizeof (win));
775 XRenderPictureAttributes pa;
776 XRenderPictFormat *format;
782 for (p = &list; *p; p = &(*p)->next)
783 if ((*p)->id == prev)
789 if (!XGetWindowAttributes (dpy, id, &new->a))
797 pa.subwindow_mode = IncludeInferiors;
798 if (new->a.class == InputOnly)
802 new->damage_sequence = 0;
806 format = XRenderFindVisualFormat (dpy, new->a.visual);
807 new->picture = XRenderCreatePicture (dpy, id,
811 new->damage_sequence = NextRequest (dpy);
812 new->damage = XDamageCreate (dpy, id, XDamageReportNonEmpty);
818 new->shadow_width = 0;
819 new->shadow_height = 0;
820 new->borderSize = None;
824 /* moved mode setting to one place */
825 new->mode = determine_mode(dpy, new);
829 if (new->a.map_state == IsViewable)
830 map_win (dpy, id, new->damage_sequence - 1);
834 restack_win (Display *dpy, win *w, Window new_above)
839 old_above = w->next->id;
842 if (old_above != new_above)
847 for (prev = &list; *prev; prev = &(*prev)->next)
853 for (prev = &list; *prev; prev = &(*prev)->next)
855 if ((*prev)->id == new_above)
864 configure_win (Display *dpy, XConfigureEvent *ce)
866 win *w = find_win (dpy, ce->window);
868 XserverRegion damage = None;
872 if (ce->window == root)
876 XRenderFreePicture (dpy, rootBuffer);
879 root_width = ce->width;
880 root_height = ce->height;
884 if (w->a.map_state == IsViewable)
886 damage = XFixesCreateRegion (dpy, 0, 0);
887 if (w->extents != None)
888 XFixesCopyRegion (dpy, damage, w->extents);
892 if (w->a.width != ce->width || w->a.height != ce->height)
895 XRenderFreePicture (dpy, w->shadow);
898 w->a.width = ce->width;
899 w->a.height = ce->height;
900 w->a.border_width = ce->border_width;
901 w->a.override_redirect = ce->override_redirect;
902 restack_win (dpy, w, ce->above);
905 XserverRegion extents = win_extents (dpy, w);
906 XFixesUnionRegion (dpy, damage, damage, extents);
907 XFixesDestroyRegion (dpy, extents);
908 add_damage (dpy, damage);
914 circulate_win (Display *dpy, XCirculateEvent *ce)
916 win *w = find_win (dpy, ce->window);
919 if (ce->place == PlaceOnTop)
920 new_above = list->id;
923 restack_win (dpy, w, new_above);
928 destroy_win (Display *dpy, Window id, Bool gone)
932 for (prev = &list; (w = *prev); prev = &w->next)
939 XRenderFreePicture (dpy, w->picture);
940 if (w->damage != None)
941 XDamageDestroy (dpy, w->damage);
951 printf ("\t%08lx: %d x %d + %d + %d (%d)\n", w->id,
952 w->a.width, w->a.height, w->a.x, w->a.y, w->a.border_width);
961 printf ("windows:\n");
962 for (w = list; w; w = w->next)
968 damage_win (Display *dpy, XDamageNotifyEvent *de)
970 repair_win (dpy, de->drawable);
974 error (Display *dpy, XErrorEvent *ev)
976 printf ("error %d request %d minor %d\n",
977 ev->error_code, ev->request_code, ev->minor_code);
983 expose_root (Display *dpy, Window root, XRectangle *rects, int nrects)
985 XserverRegion region = XFixesCreateRegion (dpy, rects, nrects);
987 add_damage (dpy, region);
992 ev_serial (XEvent *ev)
994 if (ev->type & 0x7f != KeymapNotify)
995 return ev->xany.serial;
996 return NextRequest (ev->xany.display);
999 int damage_event, damage_error;
1002 ev_name (XEvent *ev)
1004 static char buf[128];
1005 switch (ev->type & 0x7f) {
1012 case ReparentNotify:
1014 case CirculateNotify:
1017 if (ev->type == damage_event + XDamageNotify)
1019 sprintf (buf, "Event %d", ev->type);
1025 ev_window (XEvent *ev)
1029 return ev->xexpose.window;
1031 return ev->xmap.window;
1033 return ev->xunmap.window;
1034 case ReparentNotify:
1035 return ev->xreparent.window;
1036 case CirculateNotify:
1037 return ev->xcirculate.window;
1039 if (ev->type == damage_event + XDamageNotify)
1040 return ((XDamageNotifyEvent *) ev)->drawable;
1046 main (int argc, char **argv)
1049 int event_base, error_base;
1050 Window root_return, parent_return;
1054 unsigned int nchildren;
1056 int xfixes_event, xfixes_error;
1057 XRenderPictureAttributes pa;
1059 XRectangle *expose_rects = 0;
1060 int size_expose = 0;
1068 dpy = XOpenDisplay (0);
1071 fprintf (stderr, "Can't open display\n");
1074 XSetErrorHandler (error);
1076 XSynchronize (dpy, 1);
1078 scr = DefaultScreen (dpy);
1079 root = RootWindow (dpy, scr);
1082 transPropAtom = XInternAtom(dpy, TRANS_PROP, False);
1083 intAtom = XInternAtom(dpy, "INTEGER", True);
1085 pa.subwindow_mode = IncludeInferiors;
1087 gaussianMap = make_gaussian_map(dpy, SHADOW_RADIUS);
1089 transPixmap = XCreatePixmap (dpy, root, 1, 1, 8);
1091 transPicture = XRenderCreatePicture (dpy, transPixmap,
1092 XRenderFindStandardFormat (dpy, PictStandardA8),
1095 c.red = c.green = c.blue = 0;
1097 XRenderFillRectangle (dpy, PictOpSrc, transPicture, &c, 0, 0, 1, 1);
1099 root_width = DisplayWidth (dpy, scr);
1100 root_height = DisplayHeight (dpy, scr);
1102 rootPicture = XRenderCreatePicture (dpy, root,
1103 XRenderFindVisualFormat (dpy,
1104 DefaultVisual (dpy, scr)),
1107 blackPixmap = XCreatePixmap (dpy, root, 1, 1, 32);
1109 blackPicture = XRenderCreatePicture (dpy, blackPixmap,
1110 XRenderFindStandardFormat (dpy, PictStandardARGB32),
1113 c.red = c.green = c.blue = 0;
1115 XRenderFillRectangle (dpy, PictOpSrc, blackPicture, &c, 0, 0, 1, 1);
1116 if (!XCompositeQueryExtension (dpy, &event_base, &error_base))
1118 fprintf (stderr, "No composite extension\n");
1121 if (!XDamageQueryExtension (dpy, &damage_event, &damage_error))
1123 fprintf (stderr, "No damage extension\n");
1126 if (!XFixesQueryExtension (dpy, &xfixes_event, &xfixes_error))
1128 fprintf (stderr, "No XFixes extension\n");
1134 XCompositeRedirectSubwindows (dpy, root, CompositeRedirectManual);
1135 XSelectInput (dpy, root,
1136 SubstructureNotifyMask|
1138 StructureNotifyMask|
1139 PropertyChangeMask);
1140 XQueryTree (dpy, root, &root_return, &parent_return, &children, &nchildren);
1141 for (i = 0; i < nchildren; i++)
1142 add_win (dpy, children[i], i ? children[i-1] : None);
1144 XUngrabServer (dpy);
1145 paint_all (dpy, None);
1150 XNextEvent (dpy, &ev);
1152 printf ("event %10.10s serial 0x%08x window 0x%08x\n",
1153 ev_name(&ev), ev_serial (&ev), ev_window (&ev));
1157 add_win (dpy, ev.xcreatewindow.window, 0);
1159 case ConfigureNotify:
1160 configure_win (dpy, &ev.xconfigure);
1163 destroy_win (dpy, ev.xdestroywindow.window, True);
1166 map_win (dpy, ev.xmap.window, ev.xmap.serial);
1169 unmap_win (dpy, ev.xunmap.window);
1171 case ReparentNotify:
1172 if (ev.xreparent.parent == root)
1173 add_win (dpy, ev.xreparent.window, 0);
1175 destroy_win (dpy, ev.xreparent.window, False);
1177 case CirculateNotify:
1178 circulate_win (dpy, &ev.xcirculate);
1181 if (ev.xexpose.window == root)
1183 int more = ev.xexpose.count + 1;
1184 if (n_expose == size_expose)
1188 expose_rects = realloc (expose_rects,
1189 (size_expose + more) *
1190 sizeof (XRectangle));
1191 size_expose += more;
1195 expose_rects = malloc (more * sizeof (XRectangle));
1199 expose_rects[n_expose].x = ev.xexpose.x;
1200 expose_rects[n_expose].y = ev.xexpose.y;
1201 expose_rects[n_expose].width = ev.xexpose.width;
1202 expose_rects[n_expose].height = ev.xexpose.height;
1204 if (ev.xexpose.count == 0)
1206 expose_root (dpy, root, expose_rects, n_expose);
1211 case PropertyNotify:
1212 for (p = 0; backgroundProps[p]; p++)
1214 if (ev.xproperty.atom == XInternAtom (dpy, backgroundProps[p], False))
1218 XClearArea (dpy, root, 0, 0, 0, 0, True);
1219 XRenderFreePicture (dpy, rootTile);
1225 /* check if Trans property was changed */
1226 if (ev.xproperty.atom == transPropAtom)
1228 /* reset mode and redraw window */
1229 win * w = find_win(dpy, ev.xproperty.window);
1232 w->mode = determine_mode(dpy, w);
1235 XserverRegion damage;
1236 damage = XFixesCreateRegion (dpy, 0, 0);
1237 XFixesCopyRegion (dpy, damage, w->extents);
1238 add_damage (dpy, damage);
1244 if (ev.type == damage_event + XDamageNotify)
1245 damage_win (dpy, (XDamageNotifyEvent *) &ev);
1248 } while (QLength (dpy));
1252 paint_all (dpy, allDamage);
1256 clipChanged = False;