]> code.delx.au - gnu-emacs/commitdiff
Reduce some unnecessary X calls.
authorKen Raeburn <raeburn@raeburn.org>
Sun, 4 Oct 2015 13:54:44 +0000 (09:54 -0400)
committerKen Raeburn <raeburn@raeburn.org>
Thu, 8 Oct 2015 05:44:43 +0000 (01:44 -0400)
* src/xfns.c (x_real_pos_and_offsets): Remove a redundant XGetGeometry
call.  If border width is wanted, get it from the XGetGeometry call
instead of calling XGetWindowAttributes on the same window.  Skip some
X calls if we've already detected an error from the X server.
* src/xterm.c (x_wm_supports): Delete x_sync before x_had_errors_p.
(handle_one_xevent): Delete XSync call before x_uncatch_errors.

src/xfns.c
src/xterm.c

index 7a236e7d6b98edd82da725c8f6e4b84144a5007a..e4ec31597d9a26ea38cc95516cdb12bb7ed16f1e 100644 (file)
@@ -250,19 +250,15 @@ x_real_pos_and_offsets (struct frame *f,
 
   if (! had_errors)
     {
-      unsigned int ign;
+      unsigned int bw, ign;
       Window child, rootw;
 
       /* Get the real coordinates for the WM window upper left corner */
       XGetGeometry (FRAME_X_DISPLAY (f), win,
-                    &rootw, &real_x, &real_y, &ow, &oh, &ign, &ign);
+                    &rootw, &real_x, &real_y, &ow, &oh, &bw, &ign);
 
       if (outer_border)
-        {
-          XWindowAttributes atts;
-          XGetWindowAttributes (FRAME_X_DISPLAY (f), win, &atts);
-          *outer_border = atts.border_width;
-        }
+        *outer_border = bw;
 
       /* Translate real coordinates to coordinates relative to our
          window.  For our window, the upper left corner is 0, 0.
@@ -309,8 +305,7 @@ x_real_pos_and_offsets (struct frame *f,
       had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
     }
 
-
-  if (dpyinfo->root_window == f->output_data.x->parent_desc)
+  if (!had_errors && dpyinfo->root_window == f->output_data.x->parent_desc)
     {
       /* Try _NET_FRAME_EXTENTS if our parent is the root window.  */
       rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents,
@@ -321,20 +316,16 @@ x_real_pos_and_offsets (struct frame *f,
       if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy)
           && actual_size == 4 && actual_format == 32)
         {
-          unsigned int ign;
-          Window rootw;
           long *fe = (long *)tmp_data;
 
-          XGetGeometry (FRAME_X_DISPLAY (f), win,
-                        &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
           outer_x = -fe[0];
           outer_y = -fe[2];
           real_x -= fe[0];
           real_y -= fe[2];
         }
-    }
 
-  if (tmp_data) XFree (tmp_data);
+      if (tmp_data) XFree (tmp_data);
+    }
 
   x_uncatch_errors ();
 
index 8be893eca6f8f35c7d7a95ae31fca87f2c24c311..83ef89c5d990ed32f25d4b05d0e6d5c2bd03a8cb 100644 (file)
@@ -7541,9 +7541,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                                        the only valid choice.  */
                                     RevertToParent,
                                     event->xclient.data.l[1]);
-                    /* This is needed to detect the error
-                       if there is an error.  */
-                    XSync (d, False);
                     x_uncatch_errors ();
                   }
                 /* Not certain about handling scroll bars here */
@@ -9930,7 +9927,6 @@ x_wm_supports (struct frame *f, Atom want_atom)
 
   /* Check if window exists. */
   XSelectInput (dpy, wmcheck_window, StructureNotifyMask);
-  x_sync (f);
   if (x_had_errors_p (dpy))
     {
       x_uncatch_errors ();