comparison src/console-gtk.c @ 4380:461fdb92f3b6

Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts. 2008-01-02 Aidan Kehoe <kehoea@parhasard.net> * emacs.c (main_1): Call the new vars_of_console_gtk function. * console-gtk.c (vars_of_console_gtk): New. * console-gtk.c (gtk_perhaps_init_unseen_key_defaults): Correct the initialisation of the hash table, on the model of the MSW and TTY builds. 2008-01-02 Aidan Kehoe <kehoea@parhasard.net> * gtk-init.el (init-post-gtk-win): Trust the X11 code to give us decent default fonts.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 02 Jan 2008 22:11:03 +0100
parents a25c824ed558
children 87ef74baf946
comparison
equal deleted inserted replaced
4379:92188a8f47a3 4380:461fdb92f3b6
37 37
38 #include "console-gtk-impl.h" 38 #include "console-gtk-impl.h"
39 39
40 DEFINE_CONSOLE_TYPE (gtk); 40 DEFINE_CONSOLE_TYPE (gtk);
41 41
42 Lisp_Object Vgtk_seen_characters;
43
42 static int 44 static int
43 gtk_initially_selected_for_input (struct console *UNUSED (con)) 45 gtk_initially_selected_for_input (struct console *UNUSED (con))
44 { 46 {
45 return 1; 47 return 1;
46 } 48 }
120 static Lisp_Object 122 static Lisp_Object
121 gtk_perhaps_init_unseen_key_defaults (struct console *UNUSED(con), 123 gtk_perhaps_init_unseen_key_defaults (struct console *UNUSED(con),
122 Lisp_Object key) 124 Lisp_Object key)
123 { 125 {
124 Lisp_Object char_to_associate = Qnil; 126 Lisp_Object char_to_associate = Qnil;
125 extern Lisp_Object Vcurrent_global_map, Qgtk_seen_characters, 127 extern Lisp_Object Vcurrent_global_map, Qcharacter_of_keysym;
126 Qcharacter_of_keysym;
127 128
128 if (SYMBOLP(key)) 129 if (SYMBOLP(key))
129 { 130 {
130 gchar *symbol_name; 131 gchar *symbol_name;
131 guint keyval;
132 DECLARE_EISTRING(ei_symname); 132 DECLARE_EISTRING(ei_symname);
133 133
134 eicpy_rawz(ei_symname, XSTRING_DATA(symbol_name(XSYMBOL(key)))); 134 eicpy_rawz(ei_symname, XSTRING_DATA(symbol_name(XSYMBOL(key))));
135 135
136 /* No information on the coding system of the string key names in GDK, 136 /* No information on the coding system of the string key names in GDK,
152 #endif 152 #endif
153 } 153 }
154 else 154 else
155 { 155 {
156 CHECK_CHAR(key); 156 CHECK_CHAR(key);
157 } 157 char_to_associate = key;
158 158 }
159 if (!(HASH_TABLEP(Qgtk_seen_characters))) 159
160 { 160 if (!(HASH_TABLEP(Vgtk_seen_characters)))
161 Qgtk_seen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK, 161 {
162 Vgtk_seen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK,
162 HASH_TABLE_EQUAL); 163 HASH_TABLE_EQUAL);
163 } 164 }
164 165
165 /* Might give the user an opaque error if make_lisp_hash_table fails, 166 /* Might give the user an opaque error if make_lisp_hash_table fails,
166 but it shouldn't crash. */ 167 but it shouldn't crash. */
167 CHECK_HASH_TABLE(Qgtk_seen_characters); 168 CHECK_HASH_TABLE(Vgtk_seen_characters);
168 169
169 if (EQ(char_to_associate, Qnil) /* If there's no char to bind, */ 170 if (EQ(char_to_associate, Qnil) /* If there's no char to bind, */
170 || (XCHAR(char_to_associate) < 0x80) /* or it's ASCII */ 171 || (XCHAR(char_to_associate) < 0x80) /* or it's ASCII */
171 || !NILP(Fgethash(key, Qgtk_seen_characters, Qnil))) /* Or we've seen 172 || !NILP(Fgethash(key, Vgtk_seen_characters, Qnil))) /* Or we've seen
172 it already, */ 173 it already, */
173 { 174 {
174 /* then don't bind the key. */ 175 /* then don't bind the key. */
175 return Qnil; 176 return Qnil;
176 } 177 }
177 178
178 if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil))) 179 if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil)))
179 { 180 {
180 Fputhash(key, Qt, Qgtk_seen_characters); 181 Fputhash(key, Qt, Vgtk_seen_characters;)
181 Fdefine_key (Vcurrent_global_map, key, Qself_insert_command); 182 Fdefine_key (Vcurrent_global_map, key, Qself_insert_command);
182 if (SYMBOLP(key)) 183 if (SYMBOLP(key))
183 { 184 {
184 Fput (key, Qcharacter_of_keysym, char_to_associate); 185 Fput (key, Qcharacter_of_keysym, char_to_associate);
185 } 186 }
207 void 208 void
208 reinit_console_type_create_gtk (void) 209 reinit_console_type_create_gtk (void)
209 { 210 {
210 REINITIALIZE_CONSOLE_TYPE (gtk); 211 REINITIALIZE_CONSOLE_TYPE (gtk);
211 } 212 }
213
214 void
215 vars_of_console_gtk (void)
216 {
217 staticpro (&Vgtk_seen_characters);
218 Vgtk_seen_characters = Qnil;
219 }