Mercurial > hg > xemacs-beta
annotate src/console-gtk.c @ 5518:3cc7470ea71c
gnuclient: if TMPDIR was set and connect failed, try again with /tmp
2011-06-03 Aidan Kehoe <kehoea@parhasard.net>
* gnuslib.c (connect_to_unix_server):
Retry with /tmp as a directory in which to search for Unix sockets
if an attempt to connect with some other directory failed (which
may be because gnuclient and gnuserv don't share an environment
value for TMPDIR, or because gnuserv was compiled with USE_TMPDIR
turned off).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Fri, 03 Jun 2011 18:40:57 +0100 |
parents | 308d34e9f07d |
children | 56144c8593a8 |
rev | line source |
---|---|
462 | 1 /* Console functions for X windows. |
2 Copyright (C) 1996 Ben Wing. | |
3 | |
4 This file is part of XEmacs. | |
5 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
462 | 7 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
9 option) any later version. |
462 | 10 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
462 | 18 |
19 /* Synched up with: Not in FSF. */ | |
20 | |
21 /* Authorship: | |
22 | |
23 Ben Wing: January 1996, for 19.14. | |
24 William Perry: April 2000, for 21.1 (Gtk version) | |
25 */ | |
26 | |
27 #include <config.h> | |
28 #include "lisp.h" | |
29 | |
30 #include "process.h" /* canonicalize_host_name */ | |
31 #include "redisplay.h" /* for display_arg */ | |
32 | |
2828 | 33 #include "charset.h" |
34 #include "elhash.h" | |
35 | |
872 | 36 #include "console-gtk-impl.h" |
37 | |
462 | 38 DEFINE_CONSOLE_TYPE (gtk); |
39 | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
40 Lisp_Object Vgtk_seen_characters; |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
41 |
462 | 42 static int |
2286 | 43 gtk_initially_selected_for_input (struct console *UNUSED (con)) |
462 | 44 { |
45 return 1; | |
46 } | |
47 | |
48 /* Remember, in all of the following functions, we have to verify | |
49 the integrity of our input, because the generic functions don't. */ | |
50 | |
51 static Lisp_Object | |
2286 | 52 gtk_device_to_console_connection (Lisp_Object connection, |
53 Error_Behavior UNUSED (errb)) | |
462 | 54 { |
55 /* Strip the trailing .# off of the connection, if it's there. */ | |
56 | |
57 if (NILP (connection)) | |
58 return Qnil; | |
59 else | |
60 { | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
61 connection = build_ascstring ("gtk"); |
462 | 62 } |
63 return connection; | |
64 } | |
65 | |
66 static Lisp_Object | |
67 gtk_semi_canonicalize_console_connection (Lisp_Object connection, | |
2286 | 68 Error_Behavior UNUSED (errb)) |
462 | 69 { |
70 struct gcpro gcpro1; | |
71 | |
72 GCPRO1 (connection); | |
73 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
74 connection = build_ascstring ("gtk"); |
462 | 75 |
76 RETURN_UNGCPRO (connection); | |
77 } | |
78 | |
79 static Lisp_Object | |
2286 | 80 gtk_canonicalize_console_connection (Lisp_Object connection, |
81 Error_Behavior UNUSED (errb)) | |
462 | 82 { |
83 Lisp_Object hostname = Qnil; | |
84 struct gcpro gcpro1, gcpro2; | |
85 | |
86 GCPRO2 (connection, hostname); | |
87 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
88 connection = build_ascstring ("gtk"); |
462 | 89 |
90 RETURN_UNGCPRO (connection); | |
91 } | |
92 | |
93 static Lisp_Object | |
94 gtk_semi_canonicalize_device_connection (Lisp_Object connection, | |
2286 | 95 Error_Behavior UNUSED (errb)) |
462 | 96 { |
97 struct gcpro gcpro1; | |
98 | |
99 GCPRO1 (connection); | |
100 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
101 connection = build_ascstring("gtk"); |
462 | 102 |
103 RETURN_UNGCPRO (connection); | |
104 } | |
105 | |
106 static Lisp_Object | |
2286 | 107 gtk_canonicalize_device_connection (Lisp_Object connection, |
108 Error_Behavior UNUSED (errb)) | |
462 | 109 { |
110 struct gcpro gcpro1; | |
111 | |
112 GCPRO1 (connection); | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4432
diff
changeset
|
113 connection = build_ascstring("gtk"); |
462 | 114 |
115 RETURN_UNGCPRO (connection); | |
116 } | |
117 | |
2828 | 118 extern Lisp_Object gtk_keysym_to_character(guint keysym); |
119 | |
120 static Lisp_Object | |
121 gtk_perhaps_init_unseen_key_defaults (struct console *UNUSED(con), | |
122 Lisp_Object key) | |
123 { | |
124 Lisp_Object char_to_associate = Qnil; | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
125 extern Lisp_Object Vcurrent_global_map, Qcharacter_of_keysym; |
2828 | 126 |
127 if (SYMBOLP(key)) | |
128 { | |
129 gchar *symbol_name; | |
130 DECLARE_EISTRING(ei_symname); | |
131 | |
132 eicpy_rawz(ei_symname, XSTRING_DATA(symbol_name(XSYMBOL(key)))); | |
133 | |
134 /* No information on the coding system of the string key names in GDK, | |
135 to my knowledge. Defaulting to binary, */ | |
136 eito_external(ei_symname, Qbinary); | |
137 symbol_name = eiextdata(ei_symname); | |
138 | |
139 /* GTK 2.0 has an API we can use, and makes this available in gdkkeys.h | |
140 | |
141 This has yet to be compiled, because XEmacs' GTK support hasn't yet moved | |
142 to 2.0. So if you're porting XEmacs to GTK 2.0, bear that in mind. */ | |
143 char_to_associate | |
144 #ifdef __GDK_KEYS_H__ | |
145 = Funicode_to_char | |
146 (make_int(gdk_keyval_to_unicode | |
147 (gdk_keyval_from_name(symbol_name))), Qnil); | |
148 #else /* GTK 1.whatever doesn't. Use the X11 map. */ | |
149 = gtk_keysym_to_character(gdk_keyval_from_name(symbol_name)); | |
150 #endif | |
151 } | |
152 else | |
153 { | |
154 CHECK_CHAR(key); | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
155 char_to_associate = key; |
2828 | 156 } |
157 | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
158 if (!(HASH_TABLEP(Vgtk_seen_characters))) |
2828 | 159 { |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
160 Vgtk_seen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK, |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
4952
diff
changeset
|
161 Qequal); |
2828 | 162 } |
163 | |
164 /* Might give the user an opaque error if make_lisp_hash_table fails, | |
165 but it shouldn't crash. */ | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
166 CHECK_HASH_TABLE(Vgtk_seen_characters); |
2828 | 167 |
168 if (EQ(char_to_associate, Qnil) /* If there's no char to bind, */ | |
169 || (XCHAR(char_to_associate) < 0x80) /* or it's ASCII */ | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
170 || !NILP(Fgethash(key, Vgtk_seen_characters, Qnil))) /* Or we've seen |
2828 | 171 it already, */ |
172 { | |
173 /* then don't bind the key. */ | |
174 return Qnil; | |
175 } | |
176 | |
177 if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil))) | |
4432
87ef74baf946
Fix GTK build-breaking typo.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4380
diff
changeset
|
178 { |
87ef74baf946
Fix GTK build-breaking typo.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4380
diff
changeset
|
179 Fputhash(key, Qt, Vgtk_seen_characters); |
2828 | 180 Fdefine_key (Vcurrent_global_map, key, Qself_insert_command); |
181 if (SYMBOLP(key)) | |
182 { | |
183 Fput (key, Qcharacter_of_keysym, char_to_associate); | |
184 } | |
185 return Qt; | |
186 } | |
187 | |
188 return Qnil; | |
189 } | |
190 | |
462 | 191 void |
192 console_type_create_gtk (void) | |
193 { | |
194 INITIALIZE_CONSOLE_TYPE (gtk, "gtk", "console-gtk-p"); | |
195 | |
196 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_console_connection); | |
197 CONSOLE_HAS_METHOD (gtk, canonicalize_console_connection); | |
198 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_device_connection); | |
199 CONSOLE_HAS_METHOD (gtk, canonicalize_device_connection); | |
200 CONSOLE_HAS_METHOD (gtk, device_to_console_connection); | |
201 CONSOLE_HAS_METHOD (gtk, initially_selected_for_input); | |
2828 | 202 CONSOLE_HAS_METHOD (gtk, perhaps_init_unseen_key_defaults); |
462 | 203 /* CONSOLE_HAS_METHOD (gtk, delete_console); */ |
204 } | |
205 | |
206 void | |
207 reinit_console_type_create_gtk (void) | |
208 { | |
209 REINITIALIZE_CONSOLE_TYPE (gtk); | |
210 } | |
4380
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
211 |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
212 void |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
213 vars_of_console_gtk (void) |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
214 { |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
215 staticpro (&Vgtk_seen_characters); |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
216 Vgtk_seen_characters = Qnil; |
461fdb92f3b6
Correct the perhaps_init_unseen_key_defaults GTK code; don't override X11 fonts.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2828
diff
changeset
|
217 } |