aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorDmitry Antipov2014-06-16 12:49:09 +0400
committerDmitry Antipov2014-06-16 12:49:09 +0400
commite9558d441dfafa37efd85c5341b519adc6985319 (patch)
tree10bfb2efeb8c671489e318f15529c1fcf44fae75 /src/xterm.c
parent680d0ff96854a603c7e18d8d1069067501f1b4ed (diff)
downloademacs-e9558d441dfafa37efd85c5341b519adc6985319.tar.gz
emacs-e9558d441dfafa37efd85c5341b519adc6985319.zip
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.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/xterm.c b/src/xterm.c
index b6728880f5d..a5f6ae7d0ab 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -37,6 +37,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#include <X11/extensions/Xfixes.h> 37#include <X11/extensions/Xfixes.h>
38#endif 38#endif
39 39
40/* Using Xft implies that XRender is available. */
41#ifdef HAVE_XFT
42#include <X11/extensions/Xrender.h>
43#endif
44
40/* Load sys/types.h if not already loaded. 45/* Load sys/types.h if not already loaded.
41 In some systems loading it twice is suicidal. */ 46 In some systems loading it twice is suicidal. */
42#ifndef makedev 47#ifndef makedev
@@ -10086,14 +10091,27 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10086 10091
10087#ifdef HAVE_XFT 10092#ifdef HAVE_XFT
10088 { 10093 {
10089 /* If we are using Xft, check dpi value in X resources. 10094 /* If we are using Xft, the following precautions should be made:
10090 It is better we use it as well, since Xft will use it, as will all 10095
10091 Gnome applications. If our real DPI is smaller or larger than the 10096 1. Make sure that the Xrender extension is added before the Xft one.
10092 one Xft uses, our font will look smaller or larger than other 10097 Otherwise, the close-display hook set by Xft is called after the one
10093 for other applications, even if it is the same font name (monospace-10 10098 for Xrender, and the former tries to re-add the latter. This results
10094 for example). */ 10099 in inconsistency of internal states and leads to X protocol error when
10095 char *v = XGetDefault (dpyinfo->display, "Xft", "dpi"); 10100 one reconnects to the same X server (Bug#1696).
10101
10102 2. Check dpi value in X resources. It is better we use it as well,
10103 since Xft will use it, as will all Gnome applications. If our real DPI
10104 is smaller or larger than the one Xft uses, our font will look smaller
10105 or larger than other for other applications, even if it is the same
10106 font name (monospace-10 for example). */
10107
10108 int event_base, error_base;
10109 char *v;
10096 double d; 10110 double d;
10111
10112 XRenderQueryExtension (dpyinfo->display, &event_base, &error_base);
10113
10114 v = XGetDefault (dpyinfo->display, "Xft", "dpi");
10097 if (v != NULL && sscanf (v, "%lf", &d) == 1) 10115 if (v != NULL && sscanf (v, "%lf", &d) == 1)
10098 dpyinfo->resy = dpyinfo->resx = d; 10116 dpyinfo->resy = dpyinfo->resx = d;
10099 } 10117 }