Mercurial > emacs
annotate src/xsettings.c @ 107852:4abde609aac9
Add variable `scroll-preserve-screen-position-commands'.
http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00403.html
* window.c (Vscroll_preserve_screen_position_commands): New variable
with the default value as the list of Qscroll_down and Qscroll_up.
(window_scroll_pixel_based, window_scroll_line_based): Search the
last command in the list Vscroll_preserve_screen_position_commands
instead of comparing with Qscroll_up and Qscroll_down.
* mwheel.el (scroll-preserve-screen-position-commands):
Add mwheel-scroll to this list of commands.
* simple.el (scroll-preserve-screen-position-commands):
Add scroll-up-command, scroll-down-command, scroll-up-line,
scroll-down-line to this list of commands.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Wed, 14 Apr 2010 03:11:21 +0300 |
parents | 2311789d4888 |
children | 4d8277a44bb4 |
rev | line source |
---|---|
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
1 /* Functions for handle font 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 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
20 #include "config.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
21 #include <setjmp.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
22 #include <fcntl.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
23 #include "lisp.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
24 #include "xterm.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
25 #include "xsettings.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
26 #include "frame.h" |
106513
ee739656ad20
* xsettings.c: Include "keyboard.h".
Andreas Schwab <schwab@linux-m68k.org>
parents:
106352
diff
changeset
|
27 #include "keyboard.h" |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
28 #include "blockinput.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
29 #include "termhooks.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
30 #include "termopts.h" |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
31 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
32 #include <X11/Xproto.h> |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
33 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
34 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
35 #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
|
36 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
37 #ifdef HAVE_XFT |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
38 #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
|
39 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
40 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
41 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
|
42 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
|
43 static struct x_display_info *first_dpyinfo; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
44 static Lisp_Object Qfont_name, Qfont_render; |
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
|
45 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
|
46 static Lisp_Object Vxft_settings; |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
47 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
48 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
49 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
50 static GConfClient *gconf_client; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
51 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
52 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
53 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
54 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
55 store_font_changed_event (arg, display_name) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
56 Lisp_Object arg; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
57 Lisp_Object display_name; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
58 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
59 struct input_event event; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
60 EVENT_INIT (event); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
61 event.kind = CONFIG_CHANGED_EVENT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
62 event.frame_or_window = display_name; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
63 event.arg = arg; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
64 kbd_buffer_store_event (&event); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
65 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
66 |
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
|
67 #define XSETTINGS_FONT_NAME "Gtk/FontName" |
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
|
68 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
69 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
70 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
71 #define SYSTEM_MONO_FONT "/desktop/gnome/interface/monospace_font_name" |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
72 #define SYSTEM_FONT "/desktop/gnome/interface/font_name" |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
73 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
74 /* 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
|
75 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
|
76 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
77 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
78 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
|
79 GConfClient *client; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
80 guint cnxn_id; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
81 GConfEntry *entry; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
82 gpointer user_data; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
83 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
84 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
|
85 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
86 if (!v) return; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
87 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
|
88 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
89 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
|
90 int i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
91 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
|
92 return; /* No change. */ |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
93 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
94 xfree (current_mono_font); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
95 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
|
96 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
97 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
98 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
99 if (first_dpyinfo != NULL) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
100 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
101 /* 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
|
102 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
|
103 int found = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
104 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
|
105 found = dpyinfo == first_dpyinfo; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
106 |
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
|
107 if (found && use_system_font) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
108 store_font_changed_event (Qfont_name, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
109 XCAR (first_dpyinfo->name_list_element)); |
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 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
112 #endif /* HAVE_GCONF */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
113 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
114 #ifdef HAVE_XFT |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
115 |
106092
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
116 /* 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
|
117 #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
|
118 #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
|
119 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
120 #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
|
121 #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
|
122 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
123 #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
|
124 #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
|
125 #endif |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
126 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
127 /* 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
|
128 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
129 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
130 get_prop_window (dpyinfo) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
131 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
|
132 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
133 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
134 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
135 XGrabServer (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
136 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
|
137 dpyinfo->Xatom_xsettings_sel); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
138 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
|
139 /* 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
|
140 are changed. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
141 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
|
142 PropertyChangeMask|StructureNotifyMask); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
143 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
144 XUngrabServer (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
145 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
146 |
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
|
147 enum { |
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
|
148 SEEN_AA = 0x01, |
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
|
149 SEEN_HINTING = 0x02, |
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
|
150 SEEN_RGBA = 0x04, |
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
|
151 SEEN_LCDFILTER = 0x08, |
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
|
152 SEEN_HINTSTYLE = 0x10, |
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
|
153 SEEN_DPI = 0x20, |
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
|
154 }; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
155 struct xsettings |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
156 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
157 FcBool aa, hinting; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
158 int rgba, lcdfilter, hintstyle; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
159 double dpi; |
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
|
160 |
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
|
161 unsigned seen; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
162 }; |
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 #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
|
165 | (((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
|
166 #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
|
167 #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
|
168 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
169 /* 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
|
170 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
|
171 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
|
172 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
173 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
|
174 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
175 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
176 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
177 1 CARD8 byte-order |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
178 3 unused |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
179 4 CARD32 SERIAL |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
180 4 CARD32 N_SETTINGS |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
181 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
182 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
|
183 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
184 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
185 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
186 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
|
187 1 unused |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
188 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
|
189 n STRING8 name |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
190 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
|
191 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
|
192 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
193 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
|
194 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
195 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
196 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
197 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
|
198 n STRING8 value |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
199 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
|
200 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
201 For integer: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
202 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
203 bytes type what |
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 4 INT32 value |
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 For RGB color: |
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 bytes type what |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
210 ------------------------------------ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
211 2 CARD16 red |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
212 2 CARD16 blue |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
213 2 CARD16 green |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
214 2 CARD16 alpha |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
215 |
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
|
216 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
|
217 */ |
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 static int |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
220 parse_xft_settings (prop, bytes, settings) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
221 unsigned char *prop; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
222 unsigned long bytes; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
223 struct xsettings *settings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
224 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
225 Lisp_Object byteorder = Fbyteorder (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
226 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
|
227 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
|
228 CARD32 n_settings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
229 int bytes_parsed = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
230 int settings_seen = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
231 int i = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
232 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
233 /* 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
|
234 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
235 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
|
236 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
|
237 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
|
238 bytes_parsed = 12; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
239 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
240 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
|
241 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
242 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
|
243 && i < n_settings) |
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 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
|
246 CARD16 nlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
247 CARD32 vlen, ival = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
248 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
|
249 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
|
250 int want_this; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
251 int to_cpy; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
252 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
253 sval[0] = '\0'; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
254 ++i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
255 ++bytes_parsed; /* Padding */ |
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 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
|
258 bytes_parsed += 2; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 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
|
263 name[to_cpy] = '\0'; |
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 bytes_parsed += nlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
266 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
|
267 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
268 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
|
269 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
|
270 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
271 want_this = (nlen > 6 && strncmp (name, "Xft/", 4) == 0) |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
272 || (strcmp (XSETTINGS_FONT_NAME, name) == 0); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
273 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
274 switch (type) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
275 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
276 case 0: /* Integer */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
277 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
|
278 if (want_this) |
106085
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 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
|
281 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
|
282 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
283 bytes_parsed += 4; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
284 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
285 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
286 case 1: /* String */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
287 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
|
288 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
|
289 bytes_parsed += 4; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
290 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
|
291 if (want_this) |
106085
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 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
|
294 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
|
295 sval[to_cpy] = '\0'; |
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 bytes_parsed += vlen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
298 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
|
299 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
300 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
301 case 2: /* RGB value */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
302 /* 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
|
303 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
|
304 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
|
305 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
306 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
307 default: /* Parse Error */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
308 return BadValue; |
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 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
311 if (want_this) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
312 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
313 ++settings_seen; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
314 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
|
315 { |
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
|
316 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
|
317 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
|
318 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
319 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
|
320 { |
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
|
321 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
|
322 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
|
323 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
324 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
|
325 { |
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
|
326 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
|
327 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
|
328 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
|
329 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
|
330 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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 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
|
336 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
|
337 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
338 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
|
339 { |
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
|
340 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
|
341 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
|
342 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
|
343 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
|
344 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
|
345 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
|
346 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
|
347 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
|
348 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
|
349 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
|
350 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
|
351 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
|
352 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
|
353 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
354 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
|
355 { |
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
|
356 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
|
357 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
|
358 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
359 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
|
360 { |
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
|
361 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
|
362 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
|
363 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
|
364 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
|
365 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
|
366 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
|
367 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
|
368 } |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
369 else if (strcmp (name, XSETTINGS_FONT_NAME) == 0) |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
370 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
371 free (current_font); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
372 current_font = xstrdup (sval); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
373 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
374 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
375 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
376 |
106552
6cfff9d02df6
DPI might get set to 0 if we saw some Xsettings, but not DPI.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106513
diff
changeset
|
377 return settings_seen; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
378 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
379 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
380 static int |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
381 read_xft_settings (dpyinfo, settings) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
382 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
|
383 struct xsettings *settings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
384 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
385 long long_len; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
386 Atom act_type; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
387 int act_form; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
388 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
|
389 unsigned char *prop = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
390 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
391 int rc; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
392 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
393 x_catch_errors (dpy); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
394 rc = XGetWindowProperty (dpy, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
395 dpyinfo->xsettings_window, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
396 dpyinfo->Xatom_xsettings_prop, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
397 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
|
398 &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
|
399 &prop); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
400 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
401 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
|
402 && act_type == dpyinfo->Xatom_xsettings_prop) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
403 rc = parse_xft_settings (prop, nitems, settings); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
404 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
405 XFree (prop); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
406 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
407 x_uncatch_errors (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
408 |
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
|
409 return rc != 0; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
410 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
411 |
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
|
412 |
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
|
413 static void |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
414 apply_xft_settings (dpyinfo, send_event_p) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
415 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
|
416 int send_event_p; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
417 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
418 FcPattern *pat; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
419 struct xsettings settings, oldsettings; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
420 int changed = 0; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
421 char buf[256]; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
422 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
423 if (!read_xft_settings (dpyinfo, &settings)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
424 return; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
425 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
426 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
|
427 buf[0] = '\0'; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
428 pat = FcPatternCreate (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
429 XftDefaultSubstitute (dpyinfo->display, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
430 XScreenNumberOfScreen (dpyinfo->screen), |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
431 pat); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 |
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
|
439 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
|
440 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
441 FcPatternDel (pat, FC_ANTIALIAS); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
442 FcPatternAddBool (pat, FC_ANTIALIAS, settings.aa); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
443 ++changed; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
444 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
|
445 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
446 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
|
447 |
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
|
448 if ((settings.seen & SEEN_HINTING) != 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
|
449 && 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
|
450 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
451 FcPatternDel (pat, FC_HINTING); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
452 FcPatternAddBool (pat, FC_HINTING, settings.hinting); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
453 ++changed; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
454 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
|
455 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
456 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
|
457 sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting); |
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
|
458 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
|
459 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
460 FcPatternDel (pat, FC_RGBA); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
461 FcPatternAddInteger (pat, FC_RGBA, settings.rgba); |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
462 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
|
463 ++changed; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
464 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
465 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
|
466 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
|
467 |
106089 | 468 /* Older fontconfig versions don't have FC_LCD_FILTER. */ |
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
|
469 if ((settings.seen & SEEN_LCDFILTER) != 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
|
470 && 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
|
471 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
472 FcPatternDel (pat, FC_LCD_FILTER); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
473 FcPatternAddInteger (pat, FC_LCD_FILTER, settings.lcdfilter); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
474 ++changed; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
475 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
|
476 } |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
477 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
|
478 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
|
479 |
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
|
480 if ((settings.seen & SEEN_HINTSTYLE) != 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
|
481 && 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
|
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_HINT_STYLE); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
484 FcPatternAddInteger (pat, FC_HINT_STYLE, settings.hintstyle); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
485 ++changed; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
486 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
|
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), "Hintstyle: %d", oldsettings.hintstyle); |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
490 |
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
|
491 if ((settings.seen & SEEN_DPI) != 0 && oldsettings.dpi != settings.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
|
492 && settings.dpi > 0) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
493 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
494 Lisp_Object frame, tail; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
495 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
496 FcPatternDel (pat, FC_DPI); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
497 FcPatternAddDouble (pat, FC_DPI, settings.dpi); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
498 ++changed; |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
499 oldsettings.dpi = settings.dpi; |
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
500 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
501 /* Change the DPI on this display and all frames on the display. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
502 dpyinfo->resy = dpyinfo->resx = settings.dpi; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
503 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
|
504 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
|
505 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
506 XFRAME (frame)->resy = XFRAME (frame)->resx = settings.dpi; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
507 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
508 |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
509 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
|
510 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
|
511 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
512 if (changed) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
513 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
514 XftDefaultSet (dpyinfo->display, pat); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
515 if (send_event_p) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
516 store_font_changed_event (Qfont_render, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
517 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
|
518 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
|
519 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
520 else |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
521 FcPatternDestroy (pat); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
522 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
523 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
524 #endif /* HAVE_XFT */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
525 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
526 void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
527 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
|
528 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
|
529 XEvent *event; |
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 #ifdef HAVE_XFT |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
532 int check_window_p = 0; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
533 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
534 switch (event->type) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
535 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
536 case DestroyNotify: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
537 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
|
538 check_window_p = 1; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
539 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
540 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
541 case ClientMessage: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
542 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
|
543 && 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
|
544 && 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
|
545 check_window_p = 1; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
546 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
547 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
548 case PropertyNotify: |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
549 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
|
550 && event->xproperty.state == PropertyNewValue |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
551 && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
552 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
553 apply_xft_settings (dpyinfo, True); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
554 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
555 break; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
556 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
557 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
558 if (check_window_p) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
559 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
560 dpyinfo->xsettings_window = None; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
561 get_prop_window (dpyinfo); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
562 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
|
563 apply_xft_settings (dpyinfo, True); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
564 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
565 #endif /* HAVE_XFT */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
566 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
567 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
568 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
569 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
570 init_gconf () |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
571 { |
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
|
572 #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
|
573 int i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
574 char *s; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
575 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
576 g_type_init (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
577 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
|
578 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
|
579 if (s) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
580 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
581 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
|
582 g_free (s); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
583 } |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
584 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
|
585 if (s) |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
586 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
587 current_font = xstrdup (s); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
588 g_free (s); |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
589 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
590 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
|
591 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
|
592 SYSTEM_MONO_FONT, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
593 GCONF_CLIENT_PRELOAD_ONELEVEL, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
594 NULL); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
595 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
|
596 SYSTEM_MONO_FONT, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
597 something_changedCB, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
598 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
|
599 #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
|
600 } |
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 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
603 init_xfd_settings (dpyinfo) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
604 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
|
605 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
606 #ifdef HAVE_XFT |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
607 char sel[64]; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
608 Display *dpy = dpyinfo->display; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
609 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
610 BLOCK_INPUT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
611 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
612 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
|
613 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
|
614 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
|
615 "_XSETTINGS_SETTINGS", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
616 False); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
617 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
|
618 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
619 /* 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
|
620 owner changes. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
621 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
|
622 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
623 get_prop_window (dpyinfo); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
624 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
|
625 apply_xft_settings (dpyinfo, False); |
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 UNBLOCK_INPUT; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
628 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
629 #else /* ! HAVE_XFT */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
630 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
631 dpyinfo->Xatom_xsettings_sel = None; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
632 dpyinfo->Xatom_xsettings_prop = None; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
633 dpyinfo->Xatom_xsettings_mgr = None; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
634 dpyinfo->xsettings_window = None; |
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 #endif /* ! HAVE_XFT */ |
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 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
639 void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
640 xsettings_initialize (dpyinfo) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
641 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
|
642 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
643 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
|
644 init_gconf (); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
645 init_xfd_settings (dpyinfo); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
646 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
647 |
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
|
648 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
|
649 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
|
650 { |
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
|
651 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
|
652 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
653 |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
654 const char * |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
655 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
|
656 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
657 return current_font; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
658 } |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
659 |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
660 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
|
661 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
|
662 0, 0, 0, |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
663 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
|
664 () |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
665 { |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
666 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
|
667 ? 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
|
668 : Qnil; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
669 } |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106908
diff
changeset
|
670 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
671 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
|
672 0, 0, 0, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
673 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
|
674 () |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
675 { |
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
|
676 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
|
677 ? 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
|
678 : Qnil; |
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 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
681 void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
682 syms_of_xsettings () |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
683 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
684 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
|
685 current_font = NULL; |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
686 first_dpyinfo = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
687 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
688 gconf_client = NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
689 #endif |
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 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
|
692 staticpro (&Qfont_name); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
693 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
|
694 staticpro (&Qfont_render); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
695 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
|
696 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
|
697 |
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
|
698 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
|
699 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
|
700 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
|
701 |
106908
7d9b2b9edc21
Store settings in xft-settings for debug purposes.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
702 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
|
703 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
|
704 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
|
705 |
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
|
706 #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
|
707 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
|
708 #ifdef HAVE_GCONF |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
709 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
|
710 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
711 #endif |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
712 } |
106352 | 713 |
714 /* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d | |
715 (do not change this comment) */ |