Mercurial > emacs
annotate src/xsettings.c @ 109024:f24aeaefbe37
Fix occasional recentering under scroll-conservatively.
xdisp.c (try_scrolling): Compute the limit for searching point
in forward scroll from scroll_max, instead of an arbitrary limit
of 10 screen lines. See
http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00766.html and
http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00773.html for
details.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 19 Jun 2010 12:40:15 +0300 |
parents | ad09f2bfce51 |
children | 52060ddf14aa |
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 |
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
|
57 store_config_changed_event (arg, display_name) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
58 Lisp_Object arg; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
59 Lisp_Object display_name; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
60 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
61 struct input_event event; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
62 EVENT_INIT (event); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
63 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
|
64 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
|
65 event.arg = arg; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
66 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
|
67 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
68 |
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
|
69 #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
|
70 #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
|
71 |
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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
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 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
|
83 { |
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 #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
|
85 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
|
86 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
|
87 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
|
88 #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
|
89 |
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 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
|
91 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
|
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 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
|
94 }; |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
95 |
108031
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
96 #ifdef HAVE_GCONF |
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
97 |
c10fc3731b2c
* xsettings.c: Move misplaced HAVE_GCONF
Jan D. <jan.h.d@swipnet.se>
parents:
108024
diff
changeset
|
98 #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
|
99 #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
|
100 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
101 /* 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
|
102 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
|
103 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
104 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
105 something_changedCB (client, cnxn_id, entry, user_data) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
106 GConfClient *client; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
107 guint cnxn_id; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
108 GConfEntry *entry; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
109 gpointer user_data; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
110 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
111 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
|
112 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
113 if (!v) return; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
114 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
|
115 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
116 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
|
117 int i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
118 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
|
119 return; /* No change. */ |
106085
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 xfree (current_mono_font); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
122 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
|
123 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
124 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
125 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
126 if (first_dpyinfo != NULL) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
127 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
128 /* 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
|
129 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
|
130 int found = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
131 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
|
132 found = dpyinfo == first_dpyinfo; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
133 |
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
|
134 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
|
135 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
|
136 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
|
137 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
138 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
139 #endif /* HAVE_GCONF */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
140 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
141 #ifdef HAVE_XFT |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
142 |
106092
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
143 /* 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
|
144 #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
|
145 #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
|
146 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
147 #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
|
148 #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
|
149 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
150 #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
|
151 #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
|
152 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
153 |
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
|
154 #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
|
155 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
156 /* 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
|
157 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
158 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
159 get_prop_window (dpyinfo) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
160 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
|
161 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
162 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
163 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
164 XGrabServer (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
165 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
|
166 dpyinfo->Xatom_xsettings_sel); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
167 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
|
168 /* 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
|
169 are changed. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
170 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
|
171 PropertyChangeMask|StructureNotifyMask); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
172 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
173 XUngrabServer (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
174 } |
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 #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
|
177 | (((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
|
178 #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
|
179 #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
|
180 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
181 /* 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
|
182 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
|
183 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
|
184 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
185 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
|
186 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
187 bytes type what |
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 1 CARD8 byte-order |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
190 3 unused |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
191 4 CARD32 SERIAL |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
192 4 CARD32 N_SETTINGS |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
193 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
194 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
|
195 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
196 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
197 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
198 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
|
199 1 unused |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
200 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
|
201 n STRING8 name |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
202 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
|
203 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
|
204 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
205 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
|
206 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
207 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
208 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
209 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
|
210 n STRING8 value |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
211 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
|
212 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
213 For integer: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
214 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
215 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
216 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
217 4 INT32 value |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
218 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
219 For RGB color: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
220 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
221 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
222 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
223 2 CARD16 red |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
224 2 CARD16 blue |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
225 2 CARD16 green |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
226 2 CARD16 alpha |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
227 |
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
|
228 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
|
229 */ |
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 static int |
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
|
232 parse_settings (prop, bytes, settings) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
233 unsigned char *prop; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
234 unsigned long bytes; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
235 struct xsettings *settings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
236 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
237 Lisp_Object byteorder = Fbyteorder (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
238 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
|
239 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
|
240 CARD32 n_settings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
241 int bytes_parsed = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
242 int settings_seen = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
243 int i = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
244 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
245 /* 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
|
246 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
247 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
|
248 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
|
249 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
|
250 bytes_parsed = 12; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
251 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
252 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
|
253 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
254 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
|
255 && i < n_settings) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
256 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
257 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
|
258 CARD16 nlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
259 CARD32 vlen, ival = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
260 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
|
261 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
|
262 int want_this; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
263 int to_cpy; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
264 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
265 sval[0] = '\0'; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
266 ++i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
267 ++bytes_parsed; /* Padding */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
268 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
269 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
|
270 bytes_parsed += 2; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
271 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
|
272 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
|
273 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
|
274 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
|
275 name[to_cpy] = '\0'; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
276 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
277 bytes_parsed += nlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
278 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
|
279 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
280 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
|
281 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
|
282 |
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
|
283 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
|
284 #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
|
285 (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
|
286 || |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
287 #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
|
288 (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
|
289 || (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
|
290 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
291 switch (type) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
292 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
293 case 0: /* Integer */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
294 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
|
295 if (want_this) |
106085
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 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
|
298 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
|
299 } |
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 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
302 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
303 case 1: /* String */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
304 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
|
305 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
|
306 bytes_parsed += 4; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
307 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
|
308 if (want_this) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
309 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
310 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
|
311 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
|
312 sval[to_cpy] = '\0'; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
313 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
314 bytes_parsed += vlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
315 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
|
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 case 2: /* RGB value */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
319 /* 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
|
320 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
|
321 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
|
322 break; |
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 default: /* Parse Error */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
325 return BadValue; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
326 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
327 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
328 if (want_this) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
329 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
330 ++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
|
331 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
|
332 { |
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->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
|
334 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
|
335 } |
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, 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
|
337 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
338 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
|
339 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
|
340 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
341 #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
|
342 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
|
343 { |
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->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
|
345 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
|
346 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
347 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
|
348 { |
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
|
349 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
|
350 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
|
351 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
352 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
|
353 { |
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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 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
|
364 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
|
365 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
366 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
|
367 { |
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
|
368 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
|
369 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
|
370 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
|
371 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
|
372 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
|
373 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
|
374 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
382 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
|
383 { |
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
|
384 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
|
385 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
|
386 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
387 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
|
388 { |
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
|
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 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
|
391 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
|
392 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
|
393 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
|
394 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
|
395 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
|
396 } |
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
|
397 #endif /* HAVE_XFT */ |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
398 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
399 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
400 |
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
|
401 return settings_seen; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
402 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
403 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
404 static int |
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
|
405 read_settings (dpyinfo, settings) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
406 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
|
407 struct xsettings *settings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
408 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
409 long long_len; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
410 Atom act_type; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
411 int act_form; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
412 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
|
413 unsigned char *prop = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
414 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
415 int rc; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
416 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
417 x_catch_errors (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
418 rc = XGetWindowProperty (dpy, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
419 dpyinfo->xsettings_window, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
420 dpyinfo->Xatom_xsettings_prop, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
421 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
|
422 &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
|
423 &prop); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
424 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
425 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
|
426 && 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
|
427 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
|
428 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
429 XFree (prop); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
430 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
431 x_uncatch_errors (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
432 |
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
|
433 return rc != 0; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
434 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
435 |
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
|
436 |
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
|
437 static 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
|
438 apply_xft_settings (dpyinfo, send_event_p, settings) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
439 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
|
440 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
|
441 struct xsettings *settings; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
442 { |
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
|
443 #ifdef HAVE_XFT |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
444 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
|
445 struct xsettings oldsettings; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
446 int changed = 0; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
447 char buf[256]; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
448 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
449 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
|
450 buf[0] = '\0'; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
451 pat = FcPatternCreate (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
452 XftDefaultSubstitute (dpyinfo->display, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
453 XScreenNumberOfScreen (dpyinfo->screen), |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
454 pat); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
455 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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 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
|
461 |
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
|
462 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
|
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_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
|
465 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
|
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.aa = settings->aa; |
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 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
|
470 |
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_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
|
472 && 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
|
473 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
474 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
|
475 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
|
476 ++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
|
477 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
|
478 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
479 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
|
480 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
|
481 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
|
482 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
483 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
|
484 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
|
485 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
|
486 ++changed; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
487 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
488 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
|
489 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
|
490 |
106089 | 491 /* 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
|
492 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
|
493 && 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
|
494 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
495 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
|
496 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
|
497 ++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
|
498 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
|
499 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
500 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
|
501 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
|
502 |
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
|
503 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
|
504 && 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
|
505 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
506 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
|
507 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
|
508 ++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
|
509 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
|
510 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
511 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
|
512 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
|
513 |
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
|
514 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
|
515 && settings->dpi > 0) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
516 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
517 Lisp_Object frame, tail; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
518 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
519 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
|
520 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
|
521 ++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
|
522 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
|
523 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
524 /* 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
|
525 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
|
526 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
|
527 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
|
528 && 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
|
529 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
|
530 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
531 |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
532 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
|
533 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
|
534 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
535 if (changed) |
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 XftDefaultSet (dpyinfo->display, pat); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
538 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
|
539 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
|
540 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
|
541 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
|
542 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
543 else |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
544 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
|
545 #endif /* HAVE_XFT */ |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
546 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
547 |
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
|
548 static void |
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 read_and_apply_settings (dpyinfo, 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
|
550 struct x_display_info *dpyinfo; |
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 int 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
|
552 { |
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 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
|
554 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
|
555 |
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 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
|
557 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
|
558 |
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 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
|
560 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
|
561 { |
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 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 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
|
571 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
|
572 { |
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_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
|
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 (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
|
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 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
|
578 } |
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 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
|
581 { |
108068 | 582 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
|
583 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
584 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
|
585 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
|
586 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
|
587 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
|
588 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
589 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
|
590 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
|
591 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
592 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
593 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
594 void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
595 xft_settings_event (dpyinfo, event) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
596 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
|
597 XEvent *event; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
598 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
599 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
|
600 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
|
601 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
602 switch (event->type) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
603 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
604 case DestroyNotify: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
605 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
|
606 check_window_p = 1; |
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 case ClientMessage: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
610 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
|
611 && 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
|
612 && 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
|
613 check_window_p = 1; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
614 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
615 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
616 case PropertyNotify: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
617 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
|
618 && event->xproperty.state == PropertyNewValue |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
619 && 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
|
620 apply_settings = 1; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
621 break; |
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 |
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
|
624 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
625 if (check_window_p) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
626 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
627 dpyinfo->xsettings_window = None; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
628 get_prop_window (dpyinfo); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
629 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
|
630 apply_settings = 1; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
631 } |
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
|
632 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
633 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
|
634 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
|
635 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
636 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
637 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
638 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
639 init_gconf () |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
640 { |
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
|
641 #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
|
642 int i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
643 char *s; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
644 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
645 g_type_init (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
646 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
|
647 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
|
648 if (s) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
649 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
650 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
|
651 g_free (s); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
652 } |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
653 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
|
654 if (s) |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
655 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
656 current_font = xstrdup (s); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
657 g_free (s); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
658 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
659 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
|
660 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
|
661 SYSTEM_MONO_FONT, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
662 GCONF_CLIENT_PRELOAD_ONELEVEL, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
663 NULL); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
664 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
|
665 SYSTEM_MONO_FONT, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
666 something_changedCB, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
667 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
|
668 #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
|
669 } |
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 static 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
|
672 init_xsettings (dpyinfo) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
673 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
|
674 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
675 char sel[64]; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
676 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
677 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
678 BLOCK_INPUT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
679 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
680 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
|
681 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
|
682 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
|
683 "_XSETTINGS_SETTINGS", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
684 False); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
685 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
|
686 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
687 /* 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
|
688 owner changes. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
689 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
|
690 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
691 get_prop_window (dpyinfo); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
692 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
|
693 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
|
694 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
695 UNBLOCK_INPUT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
696 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
697 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
698 void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
699 xsettings_initialize (dpyinfo) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
700 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
|
701 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
702 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
|
703 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
|
704 init_xsettings (dpyinfo); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
705 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
706 |
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
|
707 const char * |
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
|
708 xsettings_get_system_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
|
709 { |
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
|
710 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
|
711 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
712 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
713 const char * |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
714 xsettings_get_system_normal_font () |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
715 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
716 return current_font; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
717 } |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
718 |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
719 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
|
720 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
|
721 0, 0, 0, |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
722 doc: /* Get the system default font. */) |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
723 () |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
724 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
725 return current_font && use_system_font |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
726 ? 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
|
727 : Qnil; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
728 } |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
729 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
730 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
|
731 0, 0, 0, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
732 doc: /* Get the system default monospaced font. */) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
733 () |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
734 { |
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
|
735 return current_mono_font && use_system_font |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
736 ? 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
|
737 : Qnil; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
738 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
739 |
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
|
740 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
|
741 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
|
742 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
|
743 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
|
744 known style. Otherwise return image. */) |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
745 () |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
746 { |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
747 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
|
748 || 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
|
749 || EQ (Vtool_bar_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
|
750 || EQ (Vtool_bar_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
|
751 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
|
752 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
|
753 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
|
754 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
|
755 } |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
756 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
757 void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
758 syms_of_xsettings () |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
759 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
760 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
|
761 current_font = NULL; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
762 first_dpyinfo = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
763 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
764 gconf_client = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
765 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
766 |
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
|
767 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
|
768 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
|
769 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
|
770 staticpro (&Qfont_name); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
771 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
|
772 staticpro (&Qfont_render); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
773 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
|
774 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
|
775 |
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
|
776 DEFVAR_BOOL ("font-use-system-font", &use_system_font, |
5fa329215a93
xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
777 doc: /* *Non-nil means to use the system defined font. */); |
5fa329215a93
xsettings.c didn't check font-use-system-font, fix that.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
778 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
|
779 |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
780 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
|
781 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
|
782 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
|
783 |
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
|
784 #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
|
785 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
|
786 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
787 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
|
788 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
789 #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
|
790 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
791 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
|
792 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
|
793 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
|
794 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
|
795 |
4d8277a44bb4
Gtk tool bars can be text, icons with text or just icons.
Jan D. <jan.h.d@swipnet.se>
parents:
107807
diff
changeset
|
796 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
|
797 } |
106352 | 798 |
799 /* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d | |
800 (do not change this comment) */ |