changeset 106097:5fa329215a93

xsettings.c didn't check font-use-system-font, fix that. * xsettings.c (something_changedCB, Ffont_get_system_font): Check use_system_font. (syms_of_xsettings): DEFVAR font-use-system-font. * font-setting.el (font-use-system-font): Moved ... * cus-start.el (all): ... to here.
author Jan Djärv <jan.h.d@swipnet.se>
date Tue, 17 Nov 2009 20:17:46 +0000
parents 58fd09a16d9e
children 8c46fe65b4c6
files lisp/ChangeLog lisp/cus-start.el lisp/font-setting.el src/ChangeLog src/xsettings.c
diffstat 5 files changed, 31 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Nov 17 19:13:14 2009 +0000
+++ b/lisp/ChangeLog	Tue Nov 17 20:17:46 2009 +0000
@@ -1,3 +1,9 @@
+2009-11-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* font-setting.el (font-use-system-font): Moved ...
+
+	* cus-start.el (all): ... to here.
+
 2009-11-17  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp.el (tramp-advice-file-expand-wildcards): Simplify.
--- a/lisp/cus-start.el	Tue Nov 17 19:13:14 2009 +0000
+++ b/lisp/cus-start.el	Tue Nov 17 20:17:46 2009 +0000
@@ -351,7 +351,9 @@
 	     ;; xterm.c
 	     (x-use-underline-position-properties display boolean "22.1")
 	     (x-underline-at-descent-line display boolean "22.1")
-	     (x-stretch-cursor display boolean "21.1")))
+	     (x-stretch-cursor display boolean "21.1")
+	     ;; xsettings.c
+	     (font-use-system-font font-selection boolean "23.2")))
       this symbol group type standard version native-p
       ;; This function turns a value
       ;; into an expression which produces that value.
--- a/lisp/font-setting.el	Tue Nov 17 19:13:14 2009 +0000
+++ b/lisp/font-setting.el	Tue Nov 17 20:17:46 2009 +0000
@@ -31,20 +31,6 @@
 
 ;;; Customizable variables
 
-(defun font-setting-set-system-font (symbol value)
-  (set-default symbol value)
-  (if (symbol-value symbol)
-      (let ((f (selected-frame)))
-	(if (display-graphic-p f)
-	    (font-setting-change-default-font f t)))))
-
-(defcustom font-use-system-font nil
-  "If non-nil, use the system monospaced font"
-  :version "23.2"
-  :type 'boolean
-  :group 'font-selection
-  :set 'font-setting-set-system-font)
-
 (declare-function font-get-system-font "xsettings.c" ())
 
 (defun font-setting-change-default-font (display-or-frame set-font)
@@ -75,13 +61,15 @@
 		    (if set-font new-font
 		      ;; else set font again, hinting etc. may have changed.
 		      frame-font)))
-	      (progn
-		(set-frame-parameter f 'font-parameter font-to-set)
-		(set-face-attribute 'default f 
-				    :width 'normal
-				    :weight 'normal
-				    :slant 'normal
-				    :font font-to-set)))))
+	      (if font-to-set
+		  (progn
+		    (message "setting %s" font-to-set)
+		    (set-frame-parameter f 'font-parameter font-to-set)
+		    (set-face-attribute 'default f 
+					:width 'normal
+					:weight 'normal
+					:slant 'normal
+					:font font-to-set))))))
     
       ;; Set for future frames.
       (set-face-attribute 'default t :font new-font)
--- a/src/ChangeLog	Tue Nov 17 19:13:14 2009 +0000
+++ b/src/ChangeLog	Tue Nov 17 20:17:46 2009 +0000
@@ -1,3 +1,9 @@
+2009-11-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xsettings.c (something_changedCB, Ffont_get_system_font): Check
+	use_system_font.
+	(syms_of_xsettings): DEFVAR font-use-system-font.
+
 2009-11-17  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* xfns.c (x_default_font_parameter): Remove dead assignment.
--- a/src/xsettings.c	Tue Nov 17 19:13:14 2009 +0000
+++ b/src/xsettings.c	Tue Nov 17 20:17:46 2009 +0000
@@ -40,6 +40,7 @@
 static char *current_mono_font;
 static struct x_display_info *first_dpyinfo;
 static Lisp_Object Qfont_name, Qfont_render;
+static int use_system_font;
 
 #ifdef HAVE_GCONF
 static GConfClient *gconf_client;
@@ -96,7 +97,7 @@
       for (dpyinfo = x_display_list; !found && dpyinfo; dpyinfo = dpyinfo->next)
         found = dpyinfo == first_dpyinfo;
 
-      if (found)
+      if (found && use_system_font)
         store_font_changed_event (Qfont_name,
                                   XCAR (first_dpyinfo->name_list_element));
     }
@@ -610,7 +611,7 @@
        doc: /* Get the system default monospaced font. */)
   ()
 {
-  return current_mono_font
+  return current_mono_font && use_system_font
     ? make_string (current_mono_font, strlen (current_mono_font))
     : Qnil;
 }
@@ -630,6 +631,10 @@
   staticpro (&Qfont_render);
   defsubr (&Sfont_get_system_font);
 
+  DEFVAR_BOOL ("font-use-system-font", &use_system_font,
+    doc: /* *Non-nil means to use the system defined font.  */);
+  use_system_font = 0;
+
 #ifdef HAVE_GCONF
   Fprovide (intern_c_string ("system-font-setting"), Qnil);
 #endif