emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ee52942 3/4: Reduce some unnecessary X calls.


From: Ken Raeburn
Subject: [Emacs-diffs] master ee52942 3/4: Reduce some unnecessary X calls.
Date: Thu, 08 Oct 2015 05:51:23 +0000

branch: master
commit ee529429775037fb2d9e78e7c86db21d7b3f4bdd
Author: Ken Raeburn <address@hidden>
Commit: Ken Raeburn <address@hidden>

    Reduce some unnecessary X calls.
    
    * 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  |   21 ++++++---------------
 src/xterm.c |    4 ----
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 7a236e7..e4ec315 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -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 ();
 
diff --git a/src/xterm.c b/src/xterm.c
index 8be893e..83ef89c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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 ();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]