aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2009-11-20 09:44:42 +0000
committerJan Djärv2009-11-20 09:44:42 +0000
commit0d1d0d26a9f5634372da7f5b624e46fc2d54998b (patch)
tree6060c7180398dd389b5813550e83f620c25c27ef /src
parent4a8e097d4ee5a28bcf551ee4fbeec3126c07be79 (diff)
downloademacs-0d1d0d26a9f5634372da7f5b624e46fc2d54998b.tar.gz
emacs-0d1d0d26a9f5634372da7f5b624e46fc2d54998b.zip
Always suggest system font because .emacs may not have been read yet.
* xfns.c (x_default_font_parameter): Call xsettings_get_system_font. * xsettings.h: Declare xsettings_get_system_font. * xsettings.c (xsettings_get_system_font): New function. (init_gconf): No use initiating gconf unless we have Xft also. (syms_of_xsettings): Only provide system-font-setting if HAVE_XFT and HAVE_GCONF.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/xfns.c15
-rw-r--r--src/xsettings.c13
-rw-r--r--src/xsettings.h1
4 files changed, 30 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e1cce91b646..cefcd6145f8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
12009-11-20 Jan Djärv <jan.h.d@swipnet.se> 12009-11-20 Jan Djärv <jan.h.d@swipnet.se>
2 2
3 * xfns.c (x_default_font_parameter): Call xsettings_get_system_font.
4
5 * xsettings.h: Declare xsettings_get_system_font.
6
7 * xsettings.c (xsettings_get_system_font): New function.
8 (init_gconf): No use initiating gconf unless we have Xft also.
9 (syms_of_xsettings): Only provide system-font-setting if HAVE_XFT and
10 HAVE_GCONF.
11
3 * gtkutil.c (xg_modify_menubar_widgets): If menubar is totally empty 12 * gtkutil.c (xg_modify_menubar_widgets): If menubar is totally empty
4 add a blank entry so it doesn't collapse into nothing. 13 add a blank entry so it doesn't collapse into nothing.
5 14
diff --git a/src/xfns.c b/src/xfns.c
index 3d7e89c19bd..0ae6f95b30b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3031,14 +3031,21 @@ x_default_font_parameter (f, parms)
3031 Lisp_Object font; 3031 Lisp_Object font;
3032 int got_from_gconf = 0; 3032 int got_from_gconf = 0;
3033 if (EQ (font_param, Qunbound)) 3033 if (EQ (font_param, Qunbound))
3034 font_param = Qnil;
3035
3036 if (NILP (font_param))
3034 { 3037 {
3035 font_param = Ffont_get_system_font(); 3038 /* System font takes precedendce over X resources. We must suggest this
3036 got_from_gconf = !NILP (font_param); 3039 regardless of font-use-system-font because .emacs may not have been
3040 read yet. */
3041 const char *system_font = xsettings_get_system_font ();
3042 if (system_font) font_param = make_string (system_font,
3043 strlen (system_font));
3037 } 3044 }
3038 3045
3039 font = !NILP (font_param) ? font_param 3046 font = !NILP (font_param) ? font_param
3040 : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); 3047 : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
3041 3048
3042 if (! STRINGP (font)) 3049 if (! STRINGP (font))
3043 { 3050 {
3044 char *names[] 3051 char *names[]
diff --git a/src/xsettings.c b/src/xsettings.c
index 71a7eaa86ca..8ce24743260 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -498,7 +498,7 @@ xft_settings_event (dpyinfo, event)
498static void 498static void
499init_gconf () 499init_gconf ()
500{ 500{
501#ifdef HAVE_GCONF 501#if defined (HAVE_GCONF) && defined (HAVE_XFT)
502 int i; 502 int i;
503 char *s; 503 char *s;
504 /* Should be enough, this is called at startup */ 504 /* Should be enough, this is called at startup */
@@ -556,7 +556,7 @@ init_gconf ()
556 init_sigio (i); 556 init_sigio (i);
557#endif /* ! defined (SIGIO) */ 557#endif /* ! defined (SIGIO) */
558 } 558 }
559#endif /* HAVE_GCONF */ 559#endif /* HAVE_GCONF && HAVE_XFT */
560} 560}
561 561
562static void 562static void
@@ -605,6 +605,11 @@ xsettings_initialize (dpyinfo)
605 init_xfd_settings (dpyinfo); 605 init_xfd_settings (dpyinfo);
606} 606}
607 607
608const char *
609xsettings_get_system_font ()
610{
611 return current_mono_font;
612}
608 613
609DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font, 614DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font,
610 0, 0, 0, 615 0, 0, 0,
@@ -635,10 +640,10 @@ syms_of_xsettings ()
635 doc: /* *Non-nil means to use the system defined font. */); 640 doc: /* *Non-nil means to use the system defined font. */);
636 use_system_font = 0; 641 use_system_font = 0;
637 642
643#ifdef HAVE_XFT
644 Fprovide (intern_c_string ("font-render-setting"), Qnil);
638#ifdef HAVE_GCONF 645#ifdef HAVE_GCONF
639 Fprovide (intern_c_string ("system-font-setting"), Qnil); 646 Fprovide (intern_c_string ("system-font-setting"), Qnil);
640#endif 647#endif
641#ifdef HAVE_XFT
642 Fprovide (intern_c_string ("font-render-setting"), Qnil);
643#endif 648#endif
644} 649}
diff --git a/src/xsettings.h b/src/xsettings.h
index 503116bceec..d1b3992bffe 100644
--- a/src/xsettings.h
+++ b/src/xsettings.h
@@ -24,6 +24,7 @@ EXFUN (Ffont_get_system_font, 0);
24extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo)); 24extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo));
25extern void xft_settings_event P_ ((struct x_display_info *dpyinfo, 25extern void xft_settings_event P_ ((struct x_display_info *dpyinfo,
26 XEvent *)); 26 XEvent *));
27extern const char *xsettings_get_system_font P_ ((void));
27 28
28 29
29#endif /* XSETTINGS_H */ 30#endif /* XSETTINGS_H */