]> git.eshelyaron.com Git - emacs.git/commitdiff
Do not ask for XRender extension each time XFT font is opened.
authorDmitry Antipov <dmantipov@yandex.ru>
Mon, 16 Jun 2014 08:49:09 +0000 (12:49 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Mon, 16 Jun 2014 08:49:09 +0000 (12:49 +0400)
* xftfont.c (xftfont_open): Move call to XRenderQueryExtension ...
* xterm.c (x_term_init) [HAVE_XFT]: ... to here.  Adjust comment.

src/ChangeLog
src/xftfont.c
src/xterm.c

index 66ccae26c5c8f45c65f56270798bc9f5bfd1f463..a97cc3a2567062b00c5f035764c53dde1a2cfe81 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-16  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Do not ask for XRender extension each time XFT font is opened.
+       * xftfont.c (xftfont_open): Move call to XRenderQueryExtension ...
+       * xterm.c (x_term_init) [HAVE_XFT]: ... to here.  Adjust comment.
+
 2014-06-15  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in: Use `make -C' rather than `cd && make' throughout.
index 421eb713a15d99c8cd47ccd0865829d851dc47b2..2b4ec0657345917e2d6d502bc841a731683dff35 100644 (file)
@@ -322,16 +322,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
 
 
   block_input ();
-  /* Make sure that the Xrender extension is added before the Xft one.
-     Otherwise, the close-display hook set by Xft is called after the
-     one for Xrender, and the former tries to re-add the latter.  This
-     results in inconsistency of internal states and leads to X
-     protocol error when one reconnects to the same X server.
-     (Bug#1696)  */
-  {
-    int event_base, error_base;
-    XRenderQueryExtension (display, &event_base, &error_base);
-  }
 
   /* Substitute in values from X resources and XftDefaultSet.  */
   XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);
index b6728880f5d3644fcf96a2149d97120b224c8854..a5f6ae7d0aba5d0e5a54e12e11c56869d9a73bda 100644 (file)
@@ -37,6 +37,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/extensions/Xfixes.h>
 #endif
 
+/* Using Xft implies that XRender is available.  */
+#ifdef HAVE_XFT
+#include <X11/extensions/Xrender.h>
+#endif
+
 /* Load sys/types.h if not already loaded.
    In some systems loading it twice is suicidal.  */
 #ifndef makedev
@@ -10086,14 +10091,27 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 
 #ifdef HAVE_XFT
   {
-    /* If we are using Xft, check dpi value in X resources.
-       It is better we use it as well, since Xft will use it, as will all
-       Gnome applications.  If our real DPI is smaller or larger than the
-       one Xft uses, our font will look smaller or larger than other
-       for other applications, even if it is the same font name (monospace-10
-       for example).  */
-    char *v = XGetDefault (dpyinfo->display, "Xft", "dpi");
+    /* If we are using Xft, the following precautions should be made:
+
+       1. Make sure that the Xrender extension is added before the Xft one.
+       Otherwise, the close-display hook set by Xft is called after the one
+       for Xrender, and the former tries to re-add the latter.  This results
+       in inconsistency of internal states and leads to X protocol error when
+       one reconnects to the same X server (Bug#1696).
+
+       2. Check dpi value in X resources.  It is better we use it as well,
+       since Xft will use it, as will all Gnome applications.  If our real DPI
+       is smaller or larger than the one Xft uses, our font will look smaller
+       or larger than other for other applications, even if it is the same
+       font name (monospace-10 for example).  */
+
+    int event_base, error_base;
+    char *v;
     double d;
+
+    XRenderQueryExtension (dpyinfo->display, &event_base, &error_base);
+
+    v = XGetDefault (dpyinfo->display, "Xft", "dpi");    
     if (v != NULL && sscanf (v, "%lf", &d) == 1)
       dpyinfo->resy = dpyinfo->resx = d;
   }