diff options
| author | Vincent Bernat | 2022-10-25 23:02:16 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2022-10-28 10:27:47 +0300 |
| commit | 52d4c98cec0901ef5cc1c55d5b3b33ac9d9c519f (patch) | |
| tree | d6fddd4fdb3845e4081bae94cba034b72752be64 /src | |
| parent | e953490603e597530f9dac68acdd3d199283e534 (diff) | |
| download | emacs-52d4c98cec0901ef5cc1c55d5b3b33ac9d9c519f.tar.gz emacs-52d4c98cec0901ef5cc1c55d5b3b33ac9d9c519f.zip | |
Fix detection of DPI changes in builds without Xft
* src/xsettings.c (apply_xft_settings) [!HAVE_XFT]: Support
XSETTINGS changes in non-XFT builds. (Bug#43128)
Copyright-paperwork-exempt: yes
Diffstat (limited to 'src')
| -rw-r--r-- | src/xsettings.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/xsettings.c b/src/xsettings.c index e4a9865d686..14098e21f5c 100644 --- a/src/xsettings.c +++ b/src/xsettings.c | |||
| @@ -804,16 +804,28 @@ static void | |||
| 804 | apply_xft_settings (Display_Info *dpyinfo, | 804 | apply_xft_settings (Display_Info *dpyinfo, |
| 805 | struct xsettings *settings) | 805 | struct xsettings *settings) |
| 806 | { | 806 | { |
| 807 | #ifdef HAVE_XFT | 807 | #if defined USE_CAIRO || defined HAVE_XFT |
| 808 | FcPattern *pat; | 808 | FcPattern *pat; |
| 809 | struct xsettings oldsettings; | 809 | struct xsettings oldsettings; |
| 810 | bool changed = false; | 810 | bool changed = false; |
| 811 | #ifndef HAVE_XFT | ||
| 812 | cairo_font_options_t *options; | ||
| 813 | #endif | ||
| 814 | |||
| 811 | 815 | ||
| 812 | memset (&oldsettings, 0, sizeof (oldsettings)); | 816 | memset (&oldsettings, 0, sizeof (oldsettings)); |
| 813 | pat = FcPatternCreate (); | 817 | pat = FcPatternCreate (); |
| 818 | #ifdef HAVE_XFT | ||
| 814 | XftDefaultSubstitute (dpyinfo->display, | 819 | XftDefaultSubstitute (dpyinfo->display, |
| 815 | XScreenNumberOfScreen (dpyinfo->screen), | 820 | XScreenNumberOfScreen (dpyinfo->screen), |
| 816 | pat); | 821 | pat); |
| 822 | #else | ||
| 823 | FcConfigSubstitute (NULL, pat, FcMatchPattern); | ||
| 824 | options = cairo_font_options_create (); | ||
| 825 | cairo_ft_font_options_substitute (options, pat); | ||
| 826 | cairo_font_options_destroy (options); | ||
| 827 | FcDefaultSubstitute (pat); | ||
| 828 | #endif | ||
| 817 | FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa); | 829 | FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa); |
| 818 | FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting); | 830 | FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting); |
| 819 | #ifdef FC_HINT_STYLE | 831 | #ifdef FC_HINT_STYLE |
| @@ -912,8 +924,11 @@ apply_xft_settings (Display_Info *dpyinfo, | |||
| 912 | - sizeof "%f") | 924 | - sizeof "%f") |
| 913 | }; | 925 | }; |
| 914 | char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; | 926 | char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; |
| 915 | 927 | #ifdef HAVE_XFT | |
| 916 | XftDefaultSet (dpyinfo->display, pat); | 928 | XftDefaultSet (dpyinfo->display, pat); |
| 929 | #else | ||
| 930 | FcPatternDestroy (pat); | ||
| 931 | #endif | ||
| 917 | store_config_changed_event (Qfont_render, | 932 | store_config_changed_event (Qfont_render, |
| 918 | XCAR (dpyinfo->name_list_element)); | 933 | XCAR (dpyinfo->name_list_element)); |
| 919 | Vxft_settings | 934 | Vxft_settings |