annotate lisp/dynamic-setting.el @ 109635:fc7a8c411aa3

Add declarations to header files. * src/keyboard.h (xmalloc_widget_value, digest_single_submenu): Remove declarations, menu.h has them. (QCbutton, QCtoggle, QCradio, QClabel, extra_keyboard_modifiers) (Vinput_method_function, Qinput_method_function) (Qevent_symbol_element_mask, last_event_timestamp): * src/dispextern.h (Voverflow_newline_into_fringe): * src/font.h (QCantialias, Qp, syms_of_ftfont, syms_of_xfns) (syms_of_ftxfont, syms_of_xftfont, syms_of_bdffont) (syms_of_w32font, syms_of_nsfont): * src/fontset.h (find_font_encoding, Qlatin): * src/frame.h (Qtooltip, Qrun_hook_with_args, Vmenu_bar_mode) (Vtool_bar_mode, set_frame_menubar): * src/ftfont.h (ftfont_font_format, ftfont_get_fc_charset): * src/xterm.h (Qx_gtk_map_stock): * src/keymap.h (meta_prefix_char): Add declarations. * src/lisp.h: Remove HAVE_SHM code, unused. (QCmap, QCrehash_size, QCrehash_threshold, QCsize, QCtest) (QCweakness, Qabove_handle, Qbackquote, Qbar, Qbelow_handle) (Qborder, Qbottom, Qbox, Qcircular_list, Qcomma, Qcomma_at) (Qcomma_dot, Qcursor, Qdefault, Qdown, Qend_scroll, Qeq, Qeql) (Qequal, Qfile_exists_p, Qfont_param, Qfringe, Qfunction) (Qfunction_documentation, Qhandle, Qhbar, Qheader_line, Qhollow) (Qidentity, Qleft_margin, Qmenu, Qmenu_bar_update_hook) (Qmode_line_inactive, Qmouse, Qoverriding_local_map) (Qoverriding_terminal_local_map, Qratio, Qregion, Qright_margin) (Qscroll_bar, Qtool_bar, Qtop, Qup, Qvertical_border, Qwhen) (Qwindow_scroll_functions, Vafter_load_alist) (Vauto_save_list_file_name, Vface_alternative_font_family_alist) (Vface_alternative_font_registry_alist, Vface_font_rescale_alist) (Vface_ignored_fonts, Vinhibit_redisplay, Vminibuffer_list) (Vprint_length, Vprint_level, Vscalable_fonts_allowed) (Vshell_file_name, Vsystem_name, Vwindow_scroll_functions) (Vwindow_system_version, Vx_no_window_manager, initial_argc) (initial_argv, last_nonmenu_event, load_in_progress) (noninteractive_need_newline, scroll_margin): Add declarations.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 05 Aug 2010 16:15:24 -0700
parents 012ef7d8f2be
children 0a56ed7397f0 be18c3b67d66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
108024
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
1 ;;; dynamic-setting.el --- Support dynamic changes
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106750
diff changeset
3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
4
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
5 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
6 ;; Maintainer: FSF
108024
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
7 ;; Keywords: font, system-font, tool-bar-style
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
8
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
10
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
14 ;; (at your option) any later version.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
15
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
19 ;; GNU General Public License for more details.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
20
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
23
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
24 ;;; Commentary:
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
25
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
26 ;; This file provides the lisp part of the GConf and XSetting code in
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
27 ;; xsetting.c. But it is nothing that prevents it from being used by
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
28 ;; other configuration schemes.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
29
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
30 ;;; Code:
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
31
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
32 ;;; Customizable variables
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
33
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
34 (declare-function font-get-system-font "xsettings.c" ())
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
35
106102
0cdf7c60b414 * font-setting.el (font-use-system-font): Declare for byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106097
diff changeset
36 (defvar font-use-system-font)
0cdf7c60b414 * font-setting.el (font-use-system-font): Declare for byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106097
diff changeset
37
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
38 (defun font-setting-change-default-font (display-or-frame set-font)
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
39 "Change font and/or font settings for frames on display DISPLAY-OR-FRAME.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
40 If DISPLAY-OR-FRAME is a frame, the display is the one for that frame.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
41
106102
0cdf7c60b414 * font-setting.el (font-use-system-font): Declare for byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106097
diff changeset
42 If SET-FONT is non-nil, change the font for frames. Otherwise re-apply the
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
43 current form for the frame (i.e. hinting or somesuch changed)."
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
44
106102
0cdf7c60b414 * font-setting.el (font-use-system-font): Declare for byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106097
diff changeset
45 (let ((new-font (and (fboundp 'font-get-system-font)
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
46 (font-get-system-font))))
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
47 (when new-font
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
48 ;; Be careful here: when set-face-attribute is called for the
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
49 ;; :font attribute, Emacs tries to guess the best matching font
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
50 ;; by examining the other face attributes (Bug#2476).
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
51
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
52 (clear-font-cache)
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
53 ;; Set for current frames. Only change font for those that have
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
54 ;; the old font now. If they don't have the old font, the user
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
55 ;; probably changed it.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
56 (dolist (f (frames-on-display-list display-or-frame))
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
57 (if (display-graphic-p f)
106102
0cdf7c60b414 * font-setting.el (font-use-system-font): Declare for byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106097
diff changeset
58 (let* ((frame-font
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
59 (or (font-get (face-attribute 'default :font f
106750
10b9609fb6b7 Fixing user-spec for fonts instead of using name.
Jan D. <jan.h.d@swipnet.se>
parents: 106352
diff changeset
60 'default) :user-spec)
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
61 (frame-parameter f 'font-parameter)))
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
62 (font-to-set
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
63 (if set-font new-font
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
64 ;; else set font again, hinting etc. may have changed.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
65 frame-font)))
106097
5fa329215a93 xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents: 106085
diff changeset
66 (if font-to-set
5fa329215a93 xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents: 106085
diff changeset
67 (progn
5fa329215a93 xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents: 106085
diff changeset
68 (set-frame-parameter f 'font-parameter font-to-set)
106102
0cdf7c60b414 * font-setting.el (font-use-system-font): Declare for byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106097
diff changeset
69 (set-face-attribute 'default f
106097
5fa329215a93 xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents: 106085
diff changeset
70 :width 'normal
5fa329215a93 xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents: 106085
diff changeset
71 :weight 'normal
5fa329215a93 xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents: 106085
diff changeset
72 :slant 'normal
5fa329215a93 xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents: 106085
diff changeset
73 :font font-to-set))))))
106102
0cdf7c60b414 * font-setting.el (font-use-system-font): Declare for byte-compiler.
Juanma Barranquero <lekktu@gmail.com>
parents: 106097
diff changeset
74
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
75 ;; Set for future frames.
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
76 (set-face-attribute 'default t :font new-font)
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
77 (let ((spec (list (list t (face-attr-construct 'default)))))
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
78 (progn
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
79 (put 'default 'customized-face spec)
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
80 (custom-push-theme 'theme-face 'default 'user 'set spec)
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
81 (put 'default 'face-modified nil))))))
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
82
108024
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
83 (defun dynamic-setting-handle-config-changed-event (event)
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
84 "Handle config-changed-event on the display in EVENT.
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
85 Changes can be
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
86 The monospace font. If `font-use-system-font' is nil, the font
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
87 is not changed.
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
88 Xft parameters, like DPI and hinting.
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
89 The tool bar style."
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
90 (interactive "e")
108024
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
91 (let ((type (nth 1 event))
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
92 (display-name (nth 2 event)))
108024
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
93 (cond ((and (eq type 'monospace-font-name) font-use-system-font)
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
94 (font-setting-change-default-font display-name t))
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
95
108024
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
96 ((eq type 'font-render)
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
97 (font-setting-change-default-font display-name nil))
106085
cd4cbab8bb21 Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff changeset
98
108024
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
99 ((eq type 'tool-bar-style) (force-mode-line-update t)))))
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
100
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
101 (define-key special-event-map [config-changed-event]
4d8277a44bb4 Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
102 'dynamic-setting-handle-config-changed-event)
106352
3b90f039f42b Add arch tagline
Miles Bader <miles@gnu.org>
parents: 106102
diff changeset
103
3b90f039f42b Add arch tagline
Miles Bader <miles@gnu.org>
parents: 106102
diff changeset
104 ;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017