changeset 96197:3c914bd3d4a1

(x_set_frame_alpha): Add x_catch_errors for bug#437.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 22 Jun 2008 14:02:07 +0000
parents 568f14ebb684
children 0c1619dd6a24
files src/ChangeLog src/xterm.c
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Jun 22 13:57:28 2008 +0000
+++ b/src/ChangeLog	Sun Jun 22 14:02:07 2008 +0000
@@ -1,3 +1,8 @@
+2008-06-21  Seiji Zenitani  <zenitani@mac.com>
+            Ryo Yoshitake  <ryo@shiftmode.net>
+
+	* xterm.c (x_set_frame_alpha): Add x_catch_errors for bug#437.
+
 2008-06-22  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* Makefile.in (${lisp} ${SOME_MACHINE_LISP}, ../lisp/loaddefs.el):
--- a/src/xterm.c	Sun Jun 22 13:57:28 2008 +0000
+++ b/src/xterm.c	Sun Jun 22 14:02:07 2008 +0000
@@ -497,26 +497,32 @@
   {
     unsigned char *data;
     Atom actual;
-    int format;
+    int rc, format;
     unsigned long n, left;
 
-    XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False),
-		       0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left,
-		       &data);
-    if (actual != None)
+    x_catch_errors (dpy);
+    rc = XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False),
+			    0L, 1L, False, XA_CARDINAL,
+			    &actual, &format, &n, &left,
+			    &data);
+
+    if (rc == Success && actual != None)
       if (*(unsigned long *)data == opac)
 	{
 	  XFree ((void *) data);
+	  x_uncatch_errors ();
 	  return;
 	}
       else
 	XFree ((void *) data);
+    x_uncatch_errors ();
   }
 
+  x_catch_errors (dpy);
   XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False),
 		   XA_CARDINAL, 32, PropModeReplace,
 		   (unsigned char *) &opac, 1L);
-  XSync (dpy, False);
+  x_uncatch_errors ();
 }