diff options
| author | Dmitry Antipov | 2014-06-16 12:49:09 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-06-16 12:49:09 +0400 |
| commit | e9558d441dfafa37efd85c5341b519adc6985319 (patch) | |
| tree | 10bfb2efeb8c671489e318f15529c1fcf44fae75 /src | |
| parent | 680d0ff96854a603c7e18d8d1069067501f1b4ed (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xftfont.c | 10 | ||||
| -rw-r--r-- | src/xterm.c | 32 |
3 files changed, 31 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 66ccae26c5c..a97cc3a2567 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-06-16 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Do not ask for XRender extension each time XFT font is opened. | ||
| 4 | * xftfont.c (xftfont_open): Move call to XRenderQueryExtension ... | ||
| 5 | * xterm.c (x_term_init) [HAVE_XFT]: ... to here. Adjust comment. | ||
| 6 | |||
| 1 | 2014-06-15 Glenn Morris <rgm@gnu.org> | 7 | 2014-06-15 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * Makefile.in: Use `make -C' rather than `cd && make' throughout. | 9 | * Makefile.in: Use `make -C' rather than `cd && make' throughout. |
diff --git a/src/xftfont.c b/src/xftfont.c index 421eb713a15..2b4ec065734 100644 --- a/src/xftfont.c +++ b/src/xftfont.c | |||
| @@ -322,16 +322,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 322 | 322 | ||
| 323 | 323 | ||
| 324 | block_input (); | 324 | block_input (); |
| 325 | /* Make sure that the Xrender extension is added before the Xft one. | ||
| 326 | Otherwise, the close-display hook set by Xft is called after the | ||
| 327 | one for Xrender, and the former tries to re-add the latter. This | ||
| 328 | results in inconsistency of internal states and leads to X | ||
| 329 | protocol error when one reconnects to the same X server. | ||
| 330 | (Bug#1696) */ | ||
| 331 | { | ||
| 332 | int event_base, error_base; | ||
| 333 | XRenderQueryExtension (display, &event_base, &error_base); | ||
| 334 | } | ||
| 335 | 325 | ||
| 336 | /* Substitute in values from X resources and XftDefaultSet. */ | 326 | /* Substitute in values from X resources and XftDefaultSet. */ |
| 337 | XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); | 327 | XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); |
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 | } |