Miscellaneous code cleanup and failed allocation checks.
This commit is contained in:
parent
26fd15f06b
commit
4d85ae8dbc
|
@ -1,3 +1,9 @@
|
||||||
|
2004-09-22 Dan Doel <dolio@case.edu>
|
||||||
|
|
||||||
|
* xcompmgr.c: (run_fades), (solid_picture), (get_opacity_prop),
|
||||||
|
(determine_wintype), (circulate_win):
|
||||||
|
Miscellaneous code cleanup and checks for failed allocations.
|
||||||
|
|
||||||
2004-09-21 Dan Doel <dolio@case.edu>
|
2004-09-21 Dan Doel <dolio@case.edu>
|
||||||
|
|
||||||
* xcompmgr.c: (presum_gaussian), (make_shadow), (main):
|
* xcompmgr.c: (presum_gaussian), (make_shadow), (main):
|
||||||
|
|
21
xcompmgr.c
21
xcompmgr.c
|
@ -677,11 +677,20 @@ solid_picture (Display *dpy, Bool argb, double a, double r, double g, double b)
|
||||||
XRenderColor c;
|
XRenderColor c;
|
||||||
|
|
||||||
pixmap = XCreatePixmap (dpy, root, 1, 1, argb ? 32 : 8);
|
pixmap = XCreatePixmap (dpy, root, 1, 1, argb ? 32 : 8);
|
||||||
|
if (!pixmap)
|
||||||
|
return None;
|
||||||
|
|
||||||
pa.repeat = True;
|
pa.repeat = True;
|
||||||
picture = XRenderCreatePicture (dpy, pixmap,
|
picture = XRenderCreatePicture (dpy, pixmap,
|
||||||
XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8),
|
XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8),
|
||||||
CPRepeat,
|
CPRepeat,
|
||||||
&pa);
|
&pa);
|
||||||
|
if (!picture)
|
||||||
|
{
|
||||||
|
XFreePixmap (dpy, pixmap);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
c.alpha = a * 0xffff;
|
c.alpha = a * 0xffff;
|
||||||
c.red = r * 0xffff;
|
c.red = r * 0xffff;
|
||||||
c.green = g * 0xffff;
|
c.green = g * 0xffff;
|
||||||
|
@ -1257,7 +1266,7 @@ get_opacity_prop(Display *dpy, win *w, unsigned int def)
|
||||||
int result = XGetWindowProperty(dpy, w->id, opacityAtom, 0L, 1L, False,
|
int result = XGetWindowProperty(dpy, w->id, opacityAtom, 0L, 1L, False,
|
||||||
XA_CARDINAL, &actual, &format,
|
XA_CARDINAL, &actual, &format,
|
||||||
&n, &left, &data);
|
&n, &left, &data);
|
||||||
if (result == Success && data != None)
|
if (result == Success && data != NULL)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
memcpy (&i, data, sizeof (unsigned int));
|
memcpy (&i, data, sizeof (unsigned int));
|
||||||
|
@ -1360,7 +1369,7 @@ static Atom
|
||||||
determine_wintype (Display *dpy, Window w)
|
determine_wintype (Display *dpy, Window w)
|
||||||
{
|
{
|
||||||
Window root_return, parent_return;
|
Window root_return, parent_return;
|
||||||
Window *children;
|
Window *children = NULL;
|
||||||
unsigned int nchildren, i;
|
unsigned int nchildren, i;
|
||||||
Atom type;
|
Atom type;
|
||||||
|
|
||||||
|
@ -1372,6 +1381,8 @@ determine_wintype (Display *dpy, Window w)
|
||||||
&nchildren))
|
&nchildren))
|
||||||
{
|
{
|
||||||
/* XQueryTree failed. */
|
/* XQueryTree failed. */
|
||||||
|
if (children)
|
||||||
|
XFree ((void *)children);
|
||||||
return winNormalAtom;
|
return winNormalAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,6 +1393,9 @@ determine_wintype (Display *dpy, Window w)
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (children)
|
||||||
|
XFree ((void *)children);
|
||||||
|
|
||||||
return winNormalAtom;
|
return winNormalAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1553,6 +1567,9 @@ circulate_win (Display *dpy, XCirculateEvent *ce)
|
||||||
win *w = find_win (dpy, ce->window);
|
win *w = find_win (dpy, ce->window);
|
||||||
Window new_above;
|
Window new_above;
|
||||||
|
|
||||||
|
if (!w)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ce->place == PlaceOnTop)
|
if (ce->place == PlaceOnTop)
|
||||||
new_above = list->id;
|
new_above = list->id;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue