annotate src/console-gtk.c @ 4930:9f04877ce07e

fix up comments about finalizers and NEWGC internal objects -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-01-20 Ben Wing <ben@xemacs.org> * lrecord.h: * lrecord.h (enum lrecord_type): * lrecord.h (struct lrecord_implementation): Clean up description of finalizer methods. Clean up and expand the long comment at the top of lrecord.h. Add a section about why New-GC requires a bunch of new internal objects to be created (not completely understood).
author Ben Wing <ben@xemacs.org>
date Wed, 20 Jan 2010 04:20:49 -0600
parents 87ef74baf946
children 19a72041c5ed
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 later version.
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
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 /* Synched up with: Not in FSF. */
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 /* Authorship:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 Ben Wing: January 1996, for 19.14.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26 William Perry: April 2000, for 21.1 (Gtk version)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 #include "process.h" /* canonicalize_host_name */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33 #include "redisplay.h" /* for display_arg */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
35 #include "charset.h"
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
36 #include "elhash.h"
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
37
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 578
diff changeset
38 #include "console-gtk-impl.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 578
diff changeset
39
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 DEFINE_CONSOLE_TYPE (gtk);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41
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
42 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
43
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
45 gtk_initially_selected_for_input (struct console *UNUSED (con))
462
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 return 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 /* Remember, in all of the following functions, we have to verify
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 the integrity of our input, because the generic functions don't. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
54 gtk_device_to_console_connection (Lisp_Object connection,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
55 Error_Behavior UNUSED (errb))
462
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 /* Strip the trailing .# off of the connection, if it's there. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 if (NILP (connection))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 return Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61 else
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 connection = build_string ("gtk");
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 return connection;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 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
70 Error_Behavior UNUSED (errb))
462
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 struct gcpro gcpro1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74 GCPRO1 (connection);
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 connection = build_string ("gtk");
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 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
82 gtk_canonicalize_console_connection (Lisp_Object connection,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
83 Error_Behavior UNUSED (errb))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85 Lisp_Object hostname = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 struct gcpro gcpro1, gcpro2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 GCPRO2 (connection, hostname);
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 connection = build_string ("gtk");
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 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96 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
97 Error_Behavior UNUSED (errb))
462
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 struct gcpro gcpro1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 GCPRO1 (connection);
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 connection = build_string("gtk");
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 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
109 gtk_canonicalize_device_connection (Lisp_Object connection,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 872
diff changeset
110 Error_Behavior UNUSED (errb))
462
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 struct gcpro gcpro1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 GCPRO1 (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 connection = build_string("gtk");
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 RETURN_UNGCPRO (connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
120 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
121
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
122 static Lisp_Object
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
123 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
124 Lisp_Object key)
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
125 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
126 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
127 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
128
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
129 if (SYMBOLP(key))
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
130 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
131 gchar *symbol_name;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
132 DECLARE_EISTRING(ei_symname);
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 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
135
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
136 /* 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
137 to my knowledge. Defaulting to binary, */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
138 eito_external(ei_symname, Qbinary);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
139 symbol_name = eiextdata(ei_symname);
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 /* 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
142
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
143 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
144 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
145 char_to_associate
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
146 #ifdef __GDK_KEYS_H__
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
147 = Funicode_to_char
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
148 (make_int(gdk_keyval_to_unicode
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
149 (gdk_keyval_from_name(symbol_name))), Qnil);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
150 #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
151 = 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
152 #endif
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 else
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
155 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
156 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
157 char_to_associate = key;
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
158 }
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 if (!(HASH_TABLEP(Vgtk_seen_characters)))
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
161 {
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
162 Vgtk_seen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK,
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
163 HASH_TABLE_EQUAL);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
164 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
165
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
166 /* 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
167 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
168 CHECK_HASH_TABLE(Vgtk_seen_characters);
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
169
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
170 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
171 || (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
172 || !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
173 it already, */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
174 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
175 /* then don't bind the key. */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
176 return Qnil;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
177 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
178
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
179 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
180 {
87ef74baf946 Fix GTK build-breaking typo.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4380
diff changeset
181 Fputhash(key, Qt, Vgtk_seen_characters);
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
182 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
183 if (SYMBOLP(key))
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 Fput (key, Qcharacter_of_keysym, char_to_associate);
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 return Qt;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
188 }
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 return Qnil;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
191 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
192
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 console_type_create_gtk (void)
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 INITIALIZE_CONSOLE_TYPE (gtk, "gtk", "console-gtk-p");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 CONSOLE_HAS_METHOD (gtk, canonicalize_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_device_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 CONSOLE_HAS_METHOD (gtk, canonicalize_device_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202 CONSOLE_HAS_METHOD (gtk, device_to_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
203 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
204 CONSOLE_HAS_METHOD (gtk, perhaps_init_unseen_key_defaults);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205 /* CONSOLE_HAS_METHOD (gtk, delete_console); */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 reinit_console_type_create_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211 REINITIALIZE_CONSOLE_TYPE (gtk);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 }
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
213
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 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
215 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
216 {
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 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
218 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
219 }