annotate src/console-gtk.c @ 4407:4ee73bbe4f8e

Always use boyer_moore in ASCII or Latin-1 buffers with ASCII search strings. 2007-12-26 Aidan Kehoe <kehoea@parhasard.net> * casetab.c: Extend and correct some case table documentation. * search.c (search_buffer): Correct a bug where only the first entry for a character in the case equivalence table was examined in determining if the Boyer-Moore search algorithm is appropriate. If there are case mappings outside of the charset and row of the characters specified in the search string, those case mappings can be safely ignored (and Boyer-Moore search can be used) if we know from the buffer statistics that the corresponding characters cannot occur. * search.c (boyer_moore): Assert that we haven't been passed a string with varying characters sets or rows within character sets. That's what simple_search is for. In the very rare event that a character in the search string has a canonical case mapping that is not in the same character set and row, don't try to search for the canonical character, search for some other character that is in the the desired character set and row. Assert that the case table isn't corrupt. Do not search for any character case mappings that cannot possibly occur in the buffer, given the buffer metadata about its contents.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 26 Dec 2007 17:30:16 +0100
parents a25c824ed558
children 461fdb92f3b6
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
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 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61 connection = build_string ("gtk");
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74 connection = build_string ("gtk");
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 connection = build_string ("gtk");
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 connection = build_string("gtk");
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);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113 connection = build_string("gtk");
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;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
125 extern Lisp_Object Vcurrent_global_map, Qgtk_seen_characters,
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
126 Qcharacter_of_keysym;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
127
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
128 if (SYMBOLP(key))
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
129 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
130 gchar *symbol_name;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
131 guint keyval;
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);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
157 }
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 if (!(HASH_TABLEP(Qgtk_seen_characters)))
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
160 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
161 Qgtk_seen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK,
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
162 HASH_TABLE_EQUAL);
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
165 /* 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
166 but it shouldn't crash. */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
167 CHECK_HASH_TABLE(Qgtk_seen_characters);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
168
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
169 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
170 || (XCHAR(char_to_associate) < 0x80) /* or it's ASCII */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
171 || !NILP(Fgethash(key, Qgtk_seen_characters, Qnil))) /* Or we've seen
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
172 it already, */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
173 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
174 /* then don't bind the key. */
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
175 return Qnil;
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
178 if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil)))
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
179 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
180 Fputhash(key, Qt, Qgtk_seen_characters);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
181 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
182 if (SYMBOLP(key))
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
183 {
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
184 Fput (key, Qcharacter_of_keysym, char_to_associate);
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
185 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
186 return Qt;
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
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
189 return Qnil;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
190 }
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
191
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 console_type_create_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195 INITIALIZE_CONSOLE_TYPE (gtk, "gtk", "console-gtk-p");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 CONSOLE_HAS_METHOD (gtk, canonicalize_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 CONSOLE_HAS_METHOD (gtk, semi_canonicalize_device_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 CONSOLE_HAS_METHOD (gtk, canonicalize_device_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 CONSOLE_HAS_METHOD (gtk, device_to_console_connection);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202 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
203 CONSOLE_HAS_METHOD (gtk, perhaps_init_unseen_key_defaults);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204 /* CONSOLE_HAS_METHOD (gtk, delete_console); */
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 reinit_console_type_create_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210 REINITIALIZE_CONSOLE_TYPE (gtk);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211 }