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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 /* Console functions for X windows.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 Copyright (C) 1996 Ben Wing.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4 This file is part of XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 for more details.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 /* Authorship:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23 Ben Wing: January 1996, for 19.14.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 William Perry: April 2000, for 21.1 (Gtk version)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30 #include "process.h" /* canonicalize_host_name */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 #include "redisplay.h" /* for display_arg */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
33 #include "charset.h"
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
34 #include "elhash.h"
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
35
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 578
diff changeset
36 #include "console-gtk-impl.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 578
diff changeset
37
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38 DEFINE_CONSOLE_TYPE (gtk);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
43 gtk_initially_selected_for_input (struct console *UNUSED (con))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 return 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 /* Remember, in all of the following functions, we have to verify
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 the integrity of our input, because the generic functions don't. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
52 gtk_device_to_console_connection (Lisp_Object connection,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
53 Error_Behavior UNUSED (errb))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 /* Strip the trailing .# off of the connection, if it's there. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57 if (NILP (connection))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58 return Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 return connection;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67 gtk_semi_canonicalize_console_connection (Lisp_Object connection,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
68 Error_Behavior UNUSED (errb))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 struct gcpro gcpro1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 GCPRO1 (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
75
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
80 gtk_canonicalize_console_connection (Lisp_Object connection,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
81 Error_Behavior UNUSED (errb))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
83 Lisp_Object hostname = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84 struct gcpro gcpro1, gcpro2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 GCPRO2 (connection, hostname);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
90 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
91 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 gtk_semi_canonicalize_device_connection (Lisp_Object connection,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
95 Error_Behavior UNUSED (errb))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 struct gcpro gcpro1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99 GCPRO1 (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
107 gtk_canonicalize_device_connection (Lisp_Object connection,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
108 Error_Behavior UNUSED (errb))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 struct gcpro gcpro1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
118 extern Lisp_Object gtk_keysym_to_character(guint keysym);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
119
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
120 static Lisp_Object
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
121 gtk_perhaps_init_unseen_key_defaults (struct console *UNUSED(con),
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
122 Lisp_Object key)
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
123 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
126
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
127 if (SYMBOLP(key))
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
128 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
129 gchar *symbol_name;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
130 DECLARE_EISTRING(ei_symname);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
131
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
132 eicpy_rawz(ei_symname, XSTRING_DATA(symbol_name(XSYMBOL(key))));
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
133
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
134 /* No information on the coding system of the string key names in GDK,
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
135 to my knowledge. Defaulting to binary, */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
136 eito_external(ei_symname, Qbinary);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
137 symbol_name = eiextdata(ei_symname);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
138
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
139 /* GTK 2.0 has an API we can use, and makes this available in gdkkeys.h
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
140
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
141 This has yet to be compiled, because XEmacs' GTK support hasn't yet moved
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
142 to 2.0. So if you're porting XEmacs to GTK 2.0, bear that in mind. */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
143 char_to_associate
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
144 #ifdef __GDK_KEYS_H__
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
145 = Funicode_to_char
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
146 (make_int(gdk_keyval_to_unicode
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
147 (gdk_keyval_from_name(symbol_name))), Qnil);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
148 #else /* GTK 1.whatever doesn't. Use the X11 map. */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
149 = gtk_keysym_to_character(gdk_keyval_from_name(symbol_name));
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
150 #endif
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
151 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
152 else
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
153 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
156 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
162 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
163
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
164 /* Might give the user an opaque error if make_lisp_hash_table fails,
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
167
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
168 if (EQ(char_to_associate, Qnil) /* If there's no char to bind, */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
171 it already, */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
172 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
173 /* then don't bind the key. */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
174 return Qnil;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
175 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
176
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
180 Fdefine_key (Vcurrent_global_map, key, Qself_insert_command);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
181 if (SYMBOLP(key))
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
182 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
183 Fput (key, Qcharacter_of_keysym, char_to_associate);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
184 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
185 return Qt;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
186 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
187
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
188 return Qnil;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
189 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
190
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 console_type_create_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 INITIALIZE_CONSOLE_TYPE (gtk, "gtk", "console-gtk-p");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197 CONSOLE_HAS_METHOD (gtk, canonicalize_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_device_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 CONSOLE_HAS_METHOD (gtk, canonicalize_device_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 CONSOLE_HAS_METHOD (gtk, device_to_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 CONSOLE_HAS_METHOD (gtk, initially_selected_for_input);
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
202 CONSOLE_HAS_METHOD (gtk, perhaps_init_unseen_key_defaults);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
203 /* CONSOLE_HAS_METHOD (gtk, delete_console); */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 reinit_console_type_create_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 REINITIALIZE_CONSOLE_TYPE (gtk);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
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 }