Mercurial > emacs
annotate src/xsettings.c @ 110776:073caec7510f
* net/tramp.el (tramp-handle-directory-files-and-attributes)
(tramp-handle-file-exists-p, tramp-handle-file-newer-than-file-p):
New defuns, taken from tramp-smb.el.
(tramp-coding-system-change-eol-conversion)
(tramp-set-process-query-on-exit-flag): Removed.
* net/tramp-compat.el (top): Do not check for byte-compiler
objects.
(tramp-compat-coding-system-change-eol-conversion)
(tramp-compat-set-process-query-on-exit-flag): New defuns, taken
from tramp.el.
* net/tramp-gvfs.el:
* net/tramp-gw.el: Replace `tramp-set-process-query-on-exit-flag'
by `tramp-compat-set-process-query-on-exit-flag'.
* net/tramp-imap.el (tramp-imap-file-name-handler-alist): Use
`tramp-handle-directory-files-and-attributes',
`tramp-handle-file-exists-p' and
`tramp-handle-file-newer-than-file-p'.
(tramp-imap-handle-file-exists-p)
(tramp-imap-handle-file-executable-p)
(tramp-imap-handle-file-readable-p)
(tramp-imap-handle-directory-files-and-attributes)
(tramp-imap-handle-file-newer-than-file-p): Removed.
* net/tramp-sh.el: Replace `tramp-set-process-query-on-exit-flag'
by `tramp-compat-set-process-query-on-exit-flag' and
`tramp-coding-system-change-eol-conversion' by
`tramp-compat-coding-system-change-eol-conversion'.
* net/tramp-smb.el (tramp-smb-file-name-handler-alist): Use
`tramp-handle-directory-files-and-attributes',
`tramp-handle-file-exists-p' and
`tramp-handle-file-newer-than-file-p'.
(tramp-smb-handle-directory-files-and-attributes)
(tramp-smb-handle-file-exists-p)
(tramp-smb-handle-file-newer-than-file-p): Removed.
(tramp-smb-maybe-open-connection): Replace
`tramp-set-process-query-on-exit-flag' by
`tramp-compat-set-process-query-on-exit-flag'.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Tue, 05 Oct 2010 16:20:24 +0200 |
parents | d03bc4a3fced |
children | 4f757d8e8ed7 |
rev | line source |
---|---|
108175
c9cc3dd13301
xsettings.c: include limits.h and update file comment.
Jan D <jan.h.d@swipnet.se>
parents:
108068
diff
changeset
|
1 /* Functions for handle font and other changes dynamically. |
106815 | 2 Copyright (C) 2009, 2010 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
3 Free Software Foundation, Inc. |
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 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
|
6 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
7 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
|
8 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
|
9 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
|
10 (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
|
11 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
12 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
|
13 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
|
14 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
|
15 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
|
16 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
17 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
|
18 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
|
19 |
108861
ad09f2bfce51
Fix config.h includes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108315
diff
changeset
|
20 #include <config.h> |
108175
c9cc3dd13301
xsettings.c: include limits.h and update file comment.
Jan D <jan.h.d@swipnet.se>
parents:
108068
diff
changeset
|
21 #include <limits.h> |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
22 #include <setjmp.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
23 #include <fcntl.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
24 #include "lisp.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
25 #include "xterm.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
26 #include "xsettings.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
27 #include "frame.h" |
106513
ee739656ad20
* xsettings.c: Include "keyboard.h".
Andreas Schwab <schwab@linux-m68k.org>
parents:
106352
diff
changeset
|
28 #include "keyboard.h" |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
29 #include "blockinput.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
30 #include "termhooks.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
31 #include "termopts.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
32 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
33 #include <X11/Xproto.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
34 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
35 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
36 #include <gconf/gconf-client.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
37 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
38 #ifdef HAVE_XFT |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
39 #include <X11/Xft/Xft.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
40 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
41 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
42 static char *current_mono_font; |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
43 static char *current_font; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
44 static struct x_display_info *first_dpyinfo; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
45 static Lisp_Object Qmonospace_font_name, Qfont_name, Qfont_render, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
46 Qtool_bar_style; |
106097
5fa329215a93
xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
47 static int use_system_font; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
48 static Lisp_Object Vxft_settings; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
49 static Lisp_Object current_tool_bar_style; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
50 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
51 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
52 static GConfClient *gconf_client; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
53 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
54 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
55 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
56 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
57 store_config_changed_event (Lisp_Object arg, Lisp_Object display_name) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
58 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
59 struct input_event event; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
60 EVENT_INIT (event); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
61 event.kind = CONFIG_CHANGED_EVENT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
62 event.frame_or_window = display_name; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
63 event.arg = arg; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
64 kbd_buffer_store_event (&event); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
65 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
66 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
67 #define XSETTINGS_FONT_NAME "Gtk/FontName" |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
68 #define XSETTINGS_TOOL_BAR_STYLE "Gtk/ToolbarStyle" |
107807
2311789d4888
* xsettings.c (XSETTINGS_FONT_NAME): Move XSETTINGS_FONT_NAME out of HAVE_GCONF.
Jan D. <jan.h.d@swipnet.se>
parents:
107804
diff
changeset
|
69 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
70 enum { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
71 SEEN_AA = 0x01, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
72 SEEN_HINTING = 0x02, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
73 SEEN_RGBA = 0x04, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
74 SEEN_LCDFILTER = 0x08, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
75 SEEN_HINTSTYLE = 0x10, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
76 SEEN_DPI = 0x20, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
77 SEEN_FONT = 0x40, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
78 SEEN_TB_STYLE = 0x80, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
79 }; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
80 struct xsettings |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
81 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
82 #ifdef HAVE_XFT |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
83 FcBool aa, hinting; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
84 int rgba, lcdfilter, hintstyle; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
85 double dpi; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
86 #endif |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
87 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
88 char *font; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
89 char *tb_style; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
90 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
91 unsigned seen; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
92 }; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
93 |
108031
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
94 #ifdef HAVE_GCONF |
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
95 |
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
96 #define SYSTEM_MONO_FONT "/desktop/gnome/interface/monospace_font_name" |
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
97 #define SYSTEM_FONT "/desktop/gnome/interface/font_name" |
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
98 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
99 /* Callback called when something changed in GConf that we care about, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
100 that is SYSTEM_MONO_FONT. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
101 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
102 static void |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
103 something_changedCB (GConfClient *client, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
104 guint cnxn_id, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
105 GConfEntry *entry, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
106 gpointer user_data) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
107 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
108 GConfValue *v = gconf_entry_get_value (entry); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
109 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
110 if (!v) return; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
111 if (v->type == GCONF_VALUE_STRING) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
112 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
113 const char *value = gconf_value_get_string (v); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
114 if (current_mono_font != NULL && strcmp (value, current_mono_font) == 0) |
106186
9b6f45dd8386
Use a select wrapper around the GLib event loop, thus taking into account GLib
Jan Djärv <jan.h.d@swipnet.se>
parents:
106162
diff
changeset
|
115 return; /* No change. */ |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
116 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
117 xfree (current_mono_font); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
118 current_mono_font = xstrdup (value); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
119 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
120 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
121 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
122 if (first_dpyinfo != NULL) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
123 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
124 /* Check if display still open */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
125 struct x_display_info *dpyinfo; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
126 int found = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
127 for (dpyinfo = x_display_list; !found && dpyinfo; dpyinfo = dpyinfo->next) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
128 found = dpyinfo == first_dpyinfo; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
129 |
106097
5fa329215a93
xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
130 if (found && use_system_font) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
131 store_config_changed_event (Qmonospace_font_name, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
132 XCAR (first_dpyinfo->name_list_element)); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
133 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
134 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
135 #endif /* HAVE_GCONF */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
136 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
137 #ifdef HAVE_XFT |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
138 |
106092
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
139 /* Older fontconfig versions don't have FC_LCD_*. */ |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
140 #ifndef FC_LCD_NONE |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
141 #define FC_LCD_NONE 0 |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
142 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
143 #ifndef FC_LCD_DEFAULT |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
144 #define FC_LCD_DEFAULT 1 |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
145 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
146 #ifndef FC_LCD_FILTER |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
147 #define FC_LCD_FILTER "lcdfilter" |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
148 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
149 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
150 #endif /* HAVE_XFT */ |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
151 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
152 /* Find the window that contains the XSETTINGS property values. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
153 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
154 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
155 get_prop_window (struct x_display_info *dpyinfo) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
156 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
157 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
158 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
159 XGrabServer (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
160 dpyinfo->xsettings_window = XGetSelectionOwner (dpy, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
161 dpyinfo->Xatom_xsettings_sel); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
162 if (dpyinfo->xsettings_window != None) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
163 /* Select events so we can detect if window is deleted or if settings |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
164 are changed. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
165 XSelectInput (dpy, dpyinfo->xsettings_window, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
166 PropertyChangeMask|StructureNotifyMask); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
167 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
168 XUngrabServer (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
169 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
170 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
171 #define SWAP32(nr) (((nr) << 24) | (((nr) << 8) & 0xff0000) \ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
172 | (((nr) >> 8) & 0xff00) | ((nr) >> 24)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
173 #define SWAP16(nr) (((nr) << 8) | ((nr) >> 8)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
174 #define PAD(nr) (((nr) + 3) & ~3) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
175 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
176 /* Parse xsettings and extract those that deal with Xft. |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
177 See http://freedesktop.org/wiki/Specifications/XSettingsRegistry |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
178 and http://standards.freedesktop.org/xsettings-spec/xsettings-spec-0.5.html. |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
179 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
180 Layout of prop. First is a header: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
181 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
182 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
183 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
184 1 CARD8 byte-order |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
185 3 unused |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
186 4 CARD32 SERIAL |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
187 4 CARD32 N_SETTINGS |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
188 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
189 Then N_SETTINGS records, with header: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
190 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
191 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
192 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
193 1 SETTING_TYPE type (0 = integer, 1 = string, 2 RGB color). |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
194 1 unused |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
195 2 CARD16 n == name-length |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
196 n STRING8 name |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
197 p unused, p=pad_to_even_4(n) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
198 4 CARD32 last-change-serial |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
199 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
200 and then the value, For string: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
201 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
202 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
203 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
204 4 CARD32 n = value-length |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
205 n STRING8 value |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
206 p unused, p=pad_to_even_4(n) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
207 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
208 For integer: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
209 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
210 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
211 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
212 4 INT32 value |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
213 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
214 For RGB color: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
215 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
216 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
217 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
218 2 CARD16 red |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
219 2 CARD16 blue |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
220 2 CARD16 green |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
221 2 CARD16 alpha |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
222 |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
223 Returns non-zero if some Xft settings was seen, zero otherwise. |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
224 */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
225 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
226 static int |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
227 parse_settings (unsigned char *prop, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
228 long unsigned int bytes, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
229 struct xsettings *settings) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
230 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
231 Lisp_Object byteorder = Fbyteorder (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
232 int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
233 int that_bo = prop[0]; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
234 CARD32 n_settings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
235 int bytes_parsed = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
236 int settings_seen = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
237 int i = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
238 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
239 /* First 4 bytes is a serial number, skip that. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
240 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
241 if (bytes < 12) return BadLength; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
242 memcpy (&n_settings, prop+8, 4); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
243 if (my_bo != that_bo) n_settings = SWAP32 (n_settings); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
244 bytes_parsed = 12; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
245 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
246 memset (settings, 0, sizeof (*settings)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
247 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
248 while (bytes_parsed+4 < bytes && settings_seen < 7 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
249 && i < n_settings) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
250 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
251 int type = prop[bytes_parsed++]; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
252 CARD16 nlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
253 CARD32 vlen, ival = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
254 char name[128]; /* The names we are looking for are not this long. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
255 char sval[128]; /* The values we are looking for are not this long. */ |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
256 int want_this; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
257 int to_cpy; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
258 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
259 sval[0] = '\0'; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
260 ++i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
261 ++bytes_parsed; /* Padding */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
262 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
263 memcpy (&nlen, prop+bytes_parsed, 2); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
264 bytes_parsed += 2; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
265 if (my_bo != that_bo) nlen = SWAP16 (nlen); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
266 if (bytes_parsed+nlen > bytes) return BadLength; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
267 to_cpy = nlen > 127 ? 127 : nlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
268 memcpy (name, prop+bytes_parsed, to_cpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
269 name[to_cpy] = '\0'; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
270 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
271 bytes_parsed += nlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
272 bytes_parsed = PAD (bytes_parsed); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
273 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
274 bytes_parsed += 4; /* Skip serial for this value */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
275 if (bytes_parsed > bytes) return BadLength; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
276 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
277 want_this = |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
278 #ifdef HAVE_XFT |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
279 (nlen > 6 && strncmp (name, "Xft/", 4) == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
280 || |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
281 #endif |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
282 (strcmp (XSETTINGS_FONT_NAME, name) == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
283 || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
284 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
285 switch (type) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
286 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
287 case 0: /* Integer */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
288 if (bytes_parsed+4 > bytes) return BadLength; |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
289 if (want_this) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
290 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
291 memcpy (&ival, prop+bytes_parsed, 4); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
292 if (my_bo != that_bo) ival = SWAP32 (ival); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
293 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
294 bytes_parsed += 4; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
295 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
296 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
297 case 1: /* String */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
298 if (bytes_parsed+4 > bytes) return BadLength; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
299 memcpy (&vlen, prop+bytes_parsed, 4); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
300 bytes_parsed += 4; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
301 if (my_bo != that_bo) vlen = SWAP32 (vlen); |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
302 if (want_this) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
303 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
304 to_cpy = vlen > 127 ? 127 : vlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
305 memcpy (sval, prop+bytes_parsed, to_cpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
306 sval[to_cpy] = '\0'; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
307 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
308 bytes_parsed += vlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
309 bytes_parsed = PAD (bytes_parsed); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
310 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
311 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
312 case 2: /* RGB value */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
313 /* No need to parse this */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
314 if (bytes_parsed+8 > bytes) return BadLength; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
315 bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
316 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
317 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
318 default: /* Parse Error */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
319 return BadValue; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
320 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
321 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
322 if (want_this) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
323 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
324 ++settings_seen; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
325 if (strcmp (name, XSETTINGS_FONT_NAME) == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
326 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
327 settings->font = xstrdup (sval); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
328 settings->seen |= SEEN_FONT; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
329 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
330 else if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
331 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
332 settings->tb_style = xstrdup (sval); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
333 settings->seen |= SEEN_TB_STYLE; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
334 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
335 #ifdef HAVE_XFT |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
336 else if (strcmp (name, "Xft/Antialias") == 0) |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
337 { |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
338 settings->seen |= SEEN_AA; |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
339 settings->aa = ival != 0; |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
340 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
341 else if (strcmp (name, "Xft/Hinting") == 0) |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
342 { |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
343 settings->seen |= SEEN_HINTING; |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
344 settings->hinting = ival != 0; |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
345 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
346 else if (strcmp (name, "Xft/HintStyle") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
347 { |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
348 settings->seen |= SEEN_HINTSTYLE; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
349 if (strcmp (sval, "hintnone") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
350 settings->hintstyle = FC_HINT_NONE; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
351 else if (strcmp (sval, "hintslight") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
352 settings->hintstyle = FC_HINT_SLIGHT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
353 else if (strcmp (sval, "hintmedium") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
354 settings->hintstyle = FC_HINT_MEDIUM; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
355 else if (strcmp (sval, "hintfull") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
356 settings->hintstyle = FC_HINT_FULL; |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
357 else |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
358 settings->seen &= ~SEEN_HINTSTYLE; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
359 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
360 else if (strcmp (name, "Xft/RGBA") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
361 { |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
362 settings->seen |= SEEN_RGBA; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
363 if (strcmp (sval, "none") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
364 settings->rgba = FC_RGBA_NONE; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
365 else if (strcmp (sval, "rgb") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
366 settings->rgba = FC_RGBA_RGB; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
367 else if (strcmp (sval, "bgr") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
368 settings->rgba = FC_RGBA_BGR; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
369 else if (strcmp (sval, "vrgb") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
370 settings->rgba = FC_RGBA_VRGB; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
371 else if (strcmp (sval, "vbgr") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
372 settings->rgba = FC_RGBA_VBGR; |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
373 else |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
374 settings->seen &= ~SEEN_RGBA; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
375 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
376 else if (strcmp (name, "Xft/DPI") == 0) |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
377 { |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
378 settings->seen |= SEEN_DPI; |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
379 settings->dpi = (double)ival/1024.0; |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
380 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
381 else if (strcmp (name, "Xft/lcdfilter") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
382 { |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
383 settings->seen |= SEEN_LCDFILTER; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
384 if (strcmp (sval, "none") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
385 settings->lcdfilter = FC_LCD_NONE; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
386 else if (strcmp (sval, "lcddefault") == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
387 settings->lcdfilter = FC_LCD_DEFAULT; |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
388 else |
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
389 settings->seen &= ~SEEN_LCDFILTER; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
390 } |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
391 #endif /* HAVE_XFT */ |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
392 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
393 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
394 |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
395 return settings_seen; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
396 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
397 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
398 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
399 read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
400 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
401 Atom act_type; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
402 int act_form; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
403 unsigned long nitems, bytes_after; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
404 unsigned char *prop = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
405 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
406 int rc; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
407 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
408 x_catch_errors (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
409 rc = XGetWindowProperty (dpy, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
410 dpyinfo->xsettings_window, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
411 dpyinfo->Xatom_xsettings_prop, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
412 0, LONG_MAX, False, AnyPropertyType, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
413 &act_type, &act_form, &nitems, &bytes_after, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
414 &prop); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
415 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
416 if (rc == Success && prop != NULL && act_form == 8 && nitems > 0 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
417 && act_type == dpyinfo->Xatom_xsettings_prop) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
418 rc = parse_settings (prop, nitems, settings); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
419 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
420 XFree (prop); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
421 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
422 x_uncatch_errors (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
423 |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
424 return rc != 0; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
425 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
426 |
106201
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106186
diff
changeset
|
427 |
01190029e5d3
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106186
diff
changeset
|
428 static void |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
429 apply_xft_settings (struct x_display_info *dpyinfo, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
430 int send_event_p, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109126
diff
changeset
|
431 struct xsettings *settings) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
432 { |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
433 #ifdef HAVE_XFT |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
434 FcPattern *pat; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
435 struct xsettings oldsettings; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
436 int changed = 0; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
437 char buf[256]; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
438 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
439 memset (&oldsettings, 0, sizeof (oldsettings)); |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
440 buf[0] = '\0'; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
441 pat = FcPatternCreate (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
442 XftDefaultSubstitute (dpyinfo->display, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
443 XScreenNumberOfScreen (dpyinfo->screen), |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
444 pat); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
445 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
446 FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
447 FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
448 FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
449 FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
450 FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
451 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
452 if ((settings->seen & SEEN_AA) != 0 && oldsettings.aa != settings->aa) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
453 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
454 FcPatternDel (pat, FC_ANTIALIAS); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
455 FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
456 ++changed; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
457 oldsettings.aa = settings->aa; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
458 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
459 sprintf (buf, "Antialias: %d", oldsettings.aa); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
460 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
461 if ((settings->seen & SEEN_HINTING) != 0 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
462 && oldsettings.hinting != settings->hinting) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
463 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
464 FcPatternDel (pat, FC_HINTING); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
465 FcPatternAddBool (pat, FC_HINTING, settings->hinting); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
466 ++changed; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
467 oldsettings.hinting = settings->hinting; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
468 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
469 if (strlen (buf) > 0) strcat (buf, ", "); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
470 sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
471 if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
472 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
473 FcPatternDel (pat, FC_RGBA); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
474 FcPatternAddInteger (pat, FC_RGBA, settings->rgba); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
475 oldsettings.rgba = settings->rgba; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
476 ++changed; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
477 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
478 if (strlen (buf) > 0) strcat (buf, ", "); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
479 sprintf (buf+strlen (buf), "RGBA: %d", oldsettings.rgba); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
480 |
106089 | 481 /* Older fontconfig versions don't have FC_LCD_FILTER. */ |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
482 if ((settings->seen & SEEN_LCDFILTER) != 0 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
483 && oldsettings.lcdfilter != settings->lcdfilter) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
484 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
485 FcPatternDel (pat, FC_LCD_FILTER); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
486 FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
487 ++changed; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
488 oldsettings.lcdfilter = settings->lcdfilter; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
489 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
490 if (strlen (buf) > 0) strcat (buf, ", "); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
491 sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
492 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
493 if ((settings->seen & SEEN_HINTSTYLE) != 0 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
494 && oldsettings.hintstyle != settings->hintstyle) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
495 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
496 FcPatternDel (pat, FC_HINT_STYLE); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
497 FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
498 ++changed; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
499 oldsettings.hintstyle = settings->hintstyle; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
500 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
501 if (strlen (buf) > 0) strcat (buf, ", "); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
502 sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
503 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
504 if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
505 && settings->dpi > 0) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
506 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
507 Lisp_Object frame, tail; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
508 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
509 FcPatternDel (pat, FC_DPI); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
510 FcPatternAddDouble (pat, FC_DPI, settings->dpi); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
511 ++changed; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
512 oldsettings.dpi = settings->dpi; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
513 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
514 /* Change the DPI on this display and all frames on the display. */ |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
515 dpyinfo->resy = dpyinfo->resx = settings->dpi; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
516 FOR_EACH_FRAME (tail, frame) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
517 if (FRAME_X_P (XFRAME (frame)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
518 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
519 XFRAME (frame)->resy = XFRAME (frame)->resx = settings->dpi; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
520 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
521 |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
522 if (strlen (buf) > 0) strcat (buf, ", "); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
523 sprintf (buf+strlen (buf), "DPI: %lf", oldsettings.dpi); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
524 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
525 if (changed) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
526 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
527 XftDefaultSet (dpyinfo->display, pat); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
528 if (send_event_p) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
529 store_config_changed_event (Qfont_render, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
530 XCAR (dpyinfo->name_list_element)); |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
531 Vxft_settings = make_string (buf, strlen (buf)); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
532 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
533 else |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
534 FcPatternDestroy (pat); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
535 #endif /* HAVE_XFT */ |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
536 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
537 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
538 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
539 read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
540 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
541 struct xsettings settings; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
542 Lisp_Object dpyname = XCAR (dpyinfo->name_list_element); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
543 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
544 if (!read_settings (dpyinfo, &settings)) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
545 return; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
546 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
547 apply_xft_settings (dpyinfo, True, &settings); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
548 if (settings.seen & SEEN_TB_STYLE) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
549 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
550 Lisp_Object style = Qnil; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
551 if (strcmp (settings.tb_style, "both") == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
552 style = Qboth; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
553 else if (strcmp (settings.tb_style, "both-horiz") == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
554 style = Qboth_horiz; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
555 else if (strcmp (settings.tb_style, "icons") == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
556 style = Qimage; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
557 else if (strcmp (settings.tb_style, "text") == 0) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
558 style = Qtext; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
559 if (!NILP (style) && !EQ (style, current_tool_bar_style)) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
560 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
561 current_tool_bar_style = style; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
562 if (send_event_p) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
563 store_config_changed_event (Qtool_bar_style, dpyname); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
564 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
565 free (settings.tb_style); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
566 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
567 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
568 if (settings.seen & SEEN_FONT) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
569 { |
108068 | 570 if (!current_font || strcmp (current_font, settings.font) != 0) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
571 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
572 free (current_font); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
573 current_font = settings.font; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
574 if (send_event_p) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
575 store_config_changed_event (Qfont_name, dpyname); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
576 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
577 else |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
578 free (settings.font); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
579 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
580 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
581 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
582 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
583 xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
584 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
585 int check_window_p = 0; |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
586 int apply_settings = 0; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
587 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
588 switch (event->type) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
589 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
590 case DestroyNotify: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
591 if (dpyinfo->xsettings_window == event->xany.window) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
592 check_window_p = 1; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
593 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
594 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
595 case ClientMessage: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
596 if (event->xclient.message_type == dpyinfo->Xatom_xsettings_mgr |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
597 && event->xclient.data.l[1] == dpyinfo->Xatom_xsettings_sel |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
598 && event->xclient.window == dpyinfo->root_window) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
599 check_window_p = 1; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
600 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
601 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
602 case PropertyNotify: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
603 if (event->xproperty.window == dpyinfo->xsettings_window |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
604 && event->xproperty.state == PropertyNewValue |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
605 && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
606 apply_settings = 1; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
607 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
608 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
609 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
610 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
611 if (check_window_p) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
612 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
613 dpyinfo->xsettings_window = None; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
614 get_prop_window (dpyinfo); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
615 if (dpyinfo->xsettings_window != None) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
616 apply_settings = 1; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
617 } |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
618 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
619 if (apply_settings) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
620 read_and_apply_settings (dpyinfo, True); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
621 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
622 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
623 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
624 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
625 init_gconf (void) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
626 { |
106162
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
627 #if defined (HAVE_GCONF) && defined (HAVE_XFT) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
628 char *s; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
629 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
630 g_type_init (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
631 gconf_client = gconf_client_get_default (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
632 s = gconf_client_get_string (gconf_client, SYSTEM_MONO_FONT, NULL); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
633 if (s) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
634 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
635 current_mono_font = xstrdup (s); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
636 g_free (s); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
637 } |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
638 s = gconf_client_get_string (gconf_client, SYSTEM_FONT, NULL); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
639 if (s) |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
640 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
641 current_font = xstrdup (s); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
642 g_free (s); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
643 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
644 gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
645 gconf_client_add_dir (gconf_client, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
646 SYSTEM_MONO_FONT, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
647 GCONF_CLIENT_PRELOAD_ONELEVEL, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
648 NULL); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
649 gconf_client_notify_add (gconf_client, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
650 SYSTEM_MONO_FONT, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
651 something_changedCB, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
652 NULL, NULL, NULL); |
106162
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
653 #endif /* HAVE_GCONF && HAVE_XFT */ |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
654 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
655 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
656 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
657 init_xsettings (struct x_display_info *dpyinfo) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
658 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
659 char sel[64]; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
660 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
661 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
662 BLOCK_INPUT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
663 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
664 sprintf (sel, "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
665 dpyinfo->Xatom_xsettings_sel = XInternAtom (dpy, sel, False); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
666 dpyinfo->Xatom_xsettings_prop = XInternAtom (dpy, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
667 "_XSETTINGS_SETTINGS", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
668 False); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
669 dpyinfo->Xatom_xsettings_mgr = XInternAtom (dpy, "MANAGER", False); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
670 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
671 /* Select events so we can detect client messages sent when selection |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
672 owner changes. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
673 XSelectInput (dpy, dpyinfo->root_window, StructureNotifyMask); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
674 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
675 get_prop_window (dpyinfo); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
676 if (dpyinfo->xsettings_window != None) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
677 read_and_apply_settings (dpyinfo, False); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
678 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
679 UNBLOCK_INPUT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
680 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
681 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
682 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
683 xsettings_initialize (struct x_display_info *dpyinfo) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
684 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
685 if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
686 init_gconf (); |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
687 init_xsettings (dpyinfo); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
688 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
689 |
106162
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
690 const char * |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
691 xsettings_get_system_font (void) |
106162
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
692 { |
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
693 return current_mono_font; |
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
694 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
695 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
696 const char * |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
697 xsettings_get_system_normal_font (void) |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
698 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
699 return current_font; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
700 } |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
701 |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
702 DEFUN ("font-get-system-normal-font", Ffont_get_system_normal_font, |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
703 Sfont_get_system_normal_font, |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
704 0, 0, 0, |
109083
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
705 doc: /* Get the system default application font. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109141
diff
changeset
|
706 (void) |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
707 { |
109083
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
708 return current_font |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
709 ? make_string (current_font, strlen (current_font)) |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
710 : Qnil; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
711 } |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
712 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
713 DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
714 0, 0, 0, |
109083
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
715 doc: /* Get the system default fixed width font. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109141
diff
changeset
|
716 (void) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
717 { |
109083
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
718 return current_mono_font |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
719 ? make_string (current_mono_font, strlen (current_mono_font)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
720 : Qnil; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
721 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
722 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
723 DEFUN ("tool-bar-get-system-style", Ftool_bar_get_system_style, Stool_bar_get_system_style, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
724 0, 0, 0, |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
725 doc: /* Get the system tool bar style. |
108315
8bb62bdbd80a
Fix bug #6139, text is briefly shown in tool bar on startup.
Jan D <jan.h.d@swipnet.se>
parents:
108175
diff
changeset
|
726 If no system tool bar style is known, return `tool-bar-style' if set to a |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
727 known style. Otherwise return image. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109141
diff
changeset
|
728 (void) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
729 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
730 if (EQ (Vtool_bar_style, Qimage) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
731 || EQ (Vtool_bar_style, Qtext) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
732 || EQ (Vtool_bar_style, Qboth) |
109566
d03bc4a3fced
Add tool bar style text-image-horiz (text to the left of the image).
Jan D. <jan.h.d@swipnet.se>
parents:
109179
diff
changeset
|
733 || EQ (Vtool_bar_style, Qboth_horiz) |
d03bc4a3fced
Add tool bar style text-image-horiz (text to the left of the image).
Jan D. <jan.h.d@swipnet.se>
parents:
109179
diff
changeset
|
734 || EQ (Vtool_bar_style, Qtext_image_horiz)) |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
735 return Vtool_bar_style; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
736 if (!NILP (current_tool_bar_style)) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
737 return current_tool_bar_style; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
738 return Qimage; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
739 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
740 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
741 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109083
diff
changeset
|
742 syms_of_xsettings (void) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
743 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
744 current_mono_font = NULL; |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
745 current_font = NULL; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
746 first_dpyinfo = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
747 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
748 gconf_client = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
749 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
750 |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
751 Qmonospace_font_name = intern_c_string ("monospace-font-name"); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
752 staticpro (&Qmonospace_font_name); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
753 Qfont_name = intern_c_string ("font-name"); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
754 staticpro (&Qfont_name); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
755 Qfont_render = intern_c_string ("font-render"); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
756 staticpro (&Qfont_render); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
757 defsubr (&Sfont_get_system_font); |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
758 defsubr (&Sfont_get_system_normal_font); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
759 |
106097
5fa329215a93
xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
760 DEFVAR_BOOL ("font-use-system-font", &use_system_font, |
109083
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
761 doc: /* *Non-nil means to apply the system defined font dynamically. |
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
762 When this is non-nil and the system defined fixed width font changes, we |
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
763 update frames dynamically. |
52060ddf14aa
Improve doc for system font things. Return font regardless of use_system_font.
Jan D <jan.h.d@swipnet.se>
parents:
108861
diff
changeset
|
764 If this variable is nil, Emacs ignores system font changes. */); |
106097
5fa329215a93
xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
765 use_system_font = 0; |
5fa329215a93
xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
766 |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
767 DEFVAR_LISP ("xft-settings", &Vxft_settings, |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
768 doc: /* Font settings applied to Xft. */); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
769 Vxft_settings = make_string ("", 0); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
770 |
106162
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
771 #ifdef HAVE_XFT |
4cee82a6f25b
Always suggest system font because .emacs may not have been read yet.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106097
diff
changeset
|
772 Fprovide (intern_c_string ("font-render-setting"), Qnil); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
773 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
774 Fprovide (intern_c_string ("system-font-setting"), Qnil); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
775 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
776 #endif |
108024
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
777 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
778 current_tool_bar_style = Qnil; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
779 Qtool_bar_style = intern_c_string ("tool-bar-style"); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
780 staticpro (&Qtool_bar_style); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
781 defsubr (&Stool_bar_get_system_style); |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
782 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
783 Fprovide (intern_c_string ("dynamic-setting"), Qnil); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
784 } |
106352 | 785 |
786 /* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d | |
787 (do not change this comment) */ |