1268
|
1 /* Shared event code between X and GTK -- include file.
|
|
2 Copyright (C) 1991-5, 1997 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
4 Copyright (C) 1996, 2001, 2002, 2003 Ben Wing.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 /* For some code it's reasonable to have only one copy and conditionalize
|
|
26 at run-time. For other code it isn't. #### Perhaps all code should be
|
|
27 included here, not in event-xlike.c. However, event-xlike.c is always
|
|
28 X-specific, whereas the following code isn't, in the GTK case. */
|
|
29
|
|
30 static int
|
|
31 #ifdef THIS_IS_GTK
|
|
32 emacs_gtk_event_pending_p (int how_many)
|
|
33 #else
|
|
34 emacs_Xt_event_pending_p (int how_many)
|
|
35 #endif
|
|
36 {
|
|
37 Lisp_Object event;
|
|
38 int tick_count_val;
|
|
39
|
|
40 /* If `how_many' is 0, then this function returns whether there are any
|
|
41 X, timeout, or fd events pending (that is, whether
|
|
42 emacs_Xt_next_event() would return immediately without blocking).
|
|
43
|
|
44 If `how_many' is > 0, then this function returns whether there are
|
|
45 that many *user generated* events available (keyboard, mouse click,
|
|
46 etc.). This also implies that emacs_Xt_next_event() would not block.
|
|
47 */
|
|
48
|
|
49 /* This function used to simply check whether there were any X events (or
|
|
50 if user_p was 1, it iterated over all the pending X events using
|
|
51 XCheckIfEvent(), looking for keystrokes and button events). That
|
|
52 worked in the old cheesoid event loop, which didn't go through
|
|
53 XtAppDispatchEvent(), but it doesn't work any more -- X events may not
|
|
54 result in anything. For example, a button press in a blank part of
|
|
55 the menubar appears as an X event but will not result in any Emacs
|
|
56 events (a button press that activates the menubar results in an Emacs
|
|
57 event through the stop_next_event mechanism).
|
|
58
|
|
59 The only accurate way of determining whether these X events translate
|
|
60 into Emacs events is to go ahead and dispatch them until there's
|
|
61 something on the dispatch queue. */
|
|
62
|
|
63 if (!how_many)
|
|
64 {
|
|
65 /* We're being asked for *ALL* events, not just user events. */
|
|
66
|
|
67 /* (1) Any pending events in the dispatch queue? */
|
|
68 if (!NILP (dispatch_event_queue))
|
|
69 return 1;
|
|
70
|
|
71 /* (2) Any TTY or process input available?
|
|
72
|
|
73 Note that formerly we just checked the value of XtAppPending() to
|
|
74 determine if there was file-desc input. This doesn't work any
|
|
75 more with the signal_event_pipe; XtAppPending() will says "yes" in
|
|
76 this case but there isn't really any input. So instead we keep
|
|
77 track of the file descriptors, and call select() ourselves.
|
|
78 Another way of fixing this problem is for the signal_event_pipe to
|
|
79 generate actual input in the form of an identity eval event or
|
|
80 something. (#### maybe this actually happens?) */
|
|
81
|
|
82 if (poll_fds_for_input (non_fake_input_wait_mask))
|
|
83 return 1;
|
|
84
|
|
85 #ifndef THIS_IS_GTK
|
|
86 /* (3) Any timeout input available? */
|
|
87 if (XtAppPending (Xt_app_con) & XtIMTimer)
|
|
88 return 1;
|
|
89 #else
|
|
90 /* #### Is there any way to do this in Gtk? I don't think there
|
|
91 is a 'peek' for events */
|
|
92 #endif
|
|
93 }
|
|
94 else
|
|
95 {
|
|
96 /* HOW_MANY > 0 */
|
|
97 EVENT_CHAIN_LOOP (event, dispatch_event_queue)
|
|
98 {
|
|
99 if (command_event_p (event))
|
|
100 {
|
|
101 how_many--;
|
|
102 if (how_many <= 0)
|
|
103 return 1;
|
|
104 }
|
|
105 }
|
|
106 }
|
|
107
|
|
108 /* XtAppPending() can be super-slow, esp. over a network connection.
|
|
109 Quantify results have indicated that in some cases the call to
|
|
110 detect_input_pending() completely dominates the running time of
|
|
111 redisplay(). Fortunately, in a SIGIO world we can more quickly
|
|
112 determine whether there are any X events: if an event has happened
|
|
113 since the last time we checked, then a SIGIO will have happened. On a
|
|
114 machine with broken SIGIO, we'll still be in an OK state --
|
|
115 quit_check_signal_tick_count will get ticked at least every 1/4
|
|
116 second, so we'll be no more than that much behind reality. (In general
|
|
117 it's OK if we erroneously report no input pending when input is
|
|
118 actually pending() -- preemption is just a bit less efficient, that's
|
|
119 all. It's bad bad bad if you err the other way -- you've promised
|
|
120 that `next-event' won't block but it actually will, and some action
|
|
121 might get delayed until the next time you hit a key.)
|
|
122 */
|
|
123
|
|
124 if (!in_modal_loop)
|
|
125 {
|
|
126 /* quit_check_signal_tick_count is volatile so try to avoid race
|
|
127 conditions by using a temporary variable */
|
|
128 tick_count_val = quit_check_signal_tick_count;
|
|
129 if (last_quit_check_signal_tick_count != tick_count_val
|
|
130 #if !defined (THIS_IS_GTK) && (!defined (SIGIO) || defined (CYGWIN))
|
|
131 || (XtIMXEvent & XtAppPending (Xt_app_con))
|
|
132 #endif
|
|
133 )
|
|
134 {
|
|
135 last_quit_check_signal_tick_count = tick_count_val;
|
|
136
|
|
137 /* We need to drain the entire queue now -- if we only drain part of
|
|
138 it, we may later on end up with events actually pending but
|
|
139 detect_input_pending() returning false because there wasn't
|
|
140 another SIGIO. */
|
|
141 event_stream_drain_queue ();
|
|
142
|
|
143 if (!how_many)
|
|
144 return !NILP (dispatch_event_queue);
|
|
145
|
|
146 EVENT_CHAIN_LOOP (event, dispatch_event_queue)
|
|
147 {
|
|
148 if (command_event_p (event))
|
|
149 {
|
|
150 how_many--;
|
|
151 if (how_many <= 0)
|
|
152 return 1;
|
|
153 }
|
|
154 }
|
|
155
|
|
156 return 0;
|
|
157 }
|
|
158 }
|
|
159
|
|
160 return 0;
|
|
161 }
|
2828
|
162
|
|
163 #if defined(THIS_IS_X) || !defined(__GDK_KEYS_H__)
|
|
164
|
|
165 /* Use an appropriate map to Unicode within x_keysym_to_character. Arguments
|
|
166 are evaluated multiple times.
|
|
167
|
|
168 Breaks if an X11 keysym maps to zero in Unicode. */
|
|
169
|
|
170 #define USE_UNICODE_MAP(keysym, map) \
|
|
171 if (keysym >= FIRST_KNOWN_##map \
|
|
172 && (keysym < (FIRST_KNOWN_##map + countof(map))) \
|
|
173 && map[keysym - FIRST_KNOWN_##map ]) do \
|
|
174 { \
|
|
175 keysym -= FIRST_KNOWN_##map ; \
|
|
176 return Funicode_to_char(make_int(map[keysym]), Qnil); \
|
|
177 } while (0)
|
|
178
|
|
179 /* Maps to Unicode for X11 KeySyms, where we don't have a direct internal
|
|
180 mapping based on a Mule character set, or whatever. Taken from Markus
|
|
181 Kuhn's X11.keysyms--if you're ever comparing with that file, note the
|
|
182 sequences of KeySyms often leave out entries, so you'll have to fill them
|
|
183 in. Doesn't include support for Hangul, which it should, if the X11
|
|
184 Hangul keysyms have ever been used anywhere.
|
|
185
|
|
186 I'm not #ifdef'ing this based on wheter MULE is defined, because it's a
|
|
187 matter of 324 bytes in a stripped executable, and I want the
|
|
188 testing. :-P */
|
|
189
|
|
190 static UINT_16_BIT const TECHNICAL[] =
|
|
191 {
|
|
192 0x23B7, /* #x08A1 LEFT RADICAL Technical */
|
|
193
|
|
194 #define FIRST_KNOWN_TECHNICAL 0x8A1
|
|
195
|
|
196 0x0, /* #x08A2 TOP LEFT RADICAL Technical */
|
|
197 0x0, /* #x08A3 HORIZONTAL CONNECTOR Technical */
|
|
198 0x2320, /* #x08A4 TOP INTEGRAL Technical */
|
|
199 0x2321, /* #x08A5 BOTTOM INTEGRAL Technical */
|
|
200 0x0, /* #x08A6 VERTICAL CONNECTOR Technical */
|
|
201 0x23A1, /* #x08A7 TOP LEFT SQUARE BRACKET Technical */
|
|
202 0x23A3, /* #x08A8 BOTTOM LEFT SQUARE BRACKET Technical */
|
|
203 0x23A4, /* #x08A9 TOP RIGHT SQUARE BRACKET Technical */
|
|
204 0x23A6, /* #x08AA BOTTOM RIGHT SQUARE BRACKET Technical */
|
|
205 0x239B, /* #x08AB TOP LEFT PARENTHESIS Technical */
|
|
206 0x239D, /* #x08AC BOTTOM LEFT PARENTHESIS Technical */
|
|
207 0x239E, /* #x08AD TOP RIGHT PARENTHESIS Technical */
|
|
208 0x23A0, /* #x08AE BOTTOM RIGHT PARENTHESIS Technical */
|
|
209 0x23A8, /* #x08AF LEFT MIDDLE CURLY BRACE Technical */
|
|
210 0x23AC, /* #x08B0 RIGHT MIDDLE CURLY BRACE Technical */
|
|
211 0x0, /* #x08B1 TOP LEFT SUMMATION Technical */
|
|
212 0x0, /* #x08B2 BOTTOM LEFT SUMMATION Technical */
|
|
213 0x0, /* #x08B3 TOP VERTICAL SUMMATION CONNECTOR Technical */
|
|
214 0x0, /* #x08B4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical */
|
|
215 0x0, /* #x08B5 TOP RIGHT SUMMATION Technical */
|
|
216 0x0, /* #x08B6 BOTTOM RIGHT SUMMATION Technical */
|
|
217 0x0, /* #x08B7 RIGHT MIDDLE SUMMATION Technical */
|
|
218 0x0, /* #x08B8 */
|
|
219 0x0, /* #x08B9 */
|
|
220 0x0, /* #x08BA */
|
|
221 0x0, /* #x08BB */
|
|
222 0x2264, /* #x08BC LESS THAN OR EQUAL SIGN Technical */
|
|
223 0x2260, /* #x08BD NOT EQUAL SIGN Technical */
|
|
224 0x2265, /* #x08BE GREATER THAN OR EQUAL SIGN Technical */
|
|
225 0x222B, /* #x08BF INTEGRAL Technical */
|
|
226 0x2234, /* #x08C0 THEREFORE Technical */
|
|
227 0x221D, /* #x08C1 VARIATION, PROPORTIONAL TO Technical */
|
|
228 0x221E, /* #x08C2 INFINITY Technical */
|
|
229 0x0, /* #x08C3 */
|
|
230 0x0, /* #x08C4 */
|
|
231 0x2207, /* #x08C5 NABLA, DEL Technical */
|
|
232 0x0, /* #x08C6 */
|
|
233 0x0, /* #x08C7 */
|
|
234 0x223C, /* #x08C8 IS APPROXIMATE TO Technical */
|
|
235 0x2243, /* #x08C9 SIMILAR OR EQUAL TO Technical */
|
|
236 0x0, /* #x08CA */
|
|
237 0x0, /* #x08CB */
|
|
238 0x0, /* #x08CC */
|
|
239 0x21D4, /* #x08CD IF AND ONLY IF Technical */
|
|
240 0x21D2, /* #x08CE IMPLIES Technical */
|
|
241 0x2261, /* #x08CF IDENTICAL TO Technical */
|
|
242 0x0, /* #x08D0 */
|
|
243 0x0, /* #x08D1 */
|
|
244 0x0, /* #x08D2 */
|
|
245 0x0, /* #x08D3 */
|
|
246 0x0, /* #x08D4 */
|
|
247 0x0, /* #x08D5 */
|
|
248 0x221A, /* #x08D6 RADICAL Technical */
|
|
249 0x0, /* #x08D7 */
|
|
250 0x0, /* #x08D8 */
|
|
251 0x0, /* #x08D9 */
|
|
252 0x2282, /* #x08DA IS INCLUDED IN Technical */
|
|
253 0x2283, /* #x08DB INCLUDES Technical */
|
|
254 0x2229, /* #x08DC INTERSECTION Technical */
|
|
255 0x222A, /* #x08DD UNION Technical */
|
|
256 0x2227, /* #x08DE LOGICAL AND Technical */
|
|
257 0x2228, /* #x08DF LOGICAL OR Technical */
|
|
258 0x0, /* #x08E0 */
|
|
259 0x0, /* #x08E1 */
|
|
260 0x0, /* #x08E2 */
|
|
261 0x0, /* #x08E3 */
|
|
262 0x0, /* #x08E4 */
|
|
263 0x0, /* #x08E5 */
|
|
264 0x0, /* #x08E6 */
|
|
265 0x0, /* #x08E7 */
|
|
266 0x0, /* #x08E8 */
|
|
267 0x0, /* #x08E9 */
|
|
268 0x0, /* #x08Ea */
|
|
269 0x0, /* #x08Eb */
|
|
270 0x0, /* #x08Ec */
|
|
271 0x0, /* #x08Ed */
|
|
272 0x0, /* #x08Ee */
|
|
273 0x2202, /* #x08EF PARTIAL DERIVATIVE Technical */
|
|
274 0x0, /* #x08F0 */
|
|
275 0x0, /* #x08F1 */
|
|
276 0x0, /* #x08F2 */
|
|
277 0x0, /* #x08F3 */
|
|
278 0x0, /* #x08F4 */
|
|
279 0x0, /* #x08F5 */
|
|
280 0x0192, /* #x08F6 FUNCTION Technical */
|
|
281 0x0, /* #x08F7 */
|
|
282 0x0, /* #x08F8 */
|
|
283 0x0, /* #x08F9 */
|
|
284 0x0, /* #x08FA */
|
|
285 0x2190, /* #x08FB LEFT ARROW Technical */
|
|
286 0x2191, /* #x08FC UPWARD ARROW Technical */
|
|
287 0x2192, /* #x08FD RIGHT ARROW Technical */
|
|
288 0x2193, /* #x08FE DOWNWARD ARROW Technical */
|
|
289 };
|
|
290
|
|
291 static UINT_16_BIT const SPECIAL[] =
|
|
292 {
|
|
293 0x25C6, /* #x09E0 SOLID DIAMOND Special */
|
|
294
|
|
295 #define FIRST_KNOWN_SPECIAL 0x9E0
|
|
296
|
|
297 0x2592, /* #x09E1 CHECKERBOARD Special */
|
|
298 0x2409, /* #x09E2 ``HT'' Special */
|
|
299 0x240C, /* #x09E3 ``FF'' Special */
|
|
300 0x240D, /* #x09E4 ``CR'' Special */
|
|
301 0x240A, /* #x09E5 ``LF'' Special */
|
|
302 0x0, /* #x09E6 */
|
|
303 0x0, /* #x09E7 */
|
|
304 0x2424, /* #x09E8 ``NL'' Special */
|
|
305 0x240B, /* #x09E9 ``VT'' Special */
|
|
306 0x2518, /* #x09EA LOWER-RIGHT CORNER Special */
|
|
307 0x2510, /* #x09EB UPPER-RIGHT CORNER Special */
|
|
308 0x250C, /* #x09EC UPPER-LEFT CORNER Special */
|
|
309 0x2514, /* #x09ED LOWER-LEFT CORNER Special */
|
|
310 0x253C, /* #x09EE CROSSING-LINES Special */
|
|
311 0x23BA, /* #x09EF HORIZONTAL LINE, SCAN 1 Special */
|
|
312 0x23BB, /* #x09F0 HORIZONTAL LINE, SCAN 3 Special */
|
|
313 0x2500, /* #x09F1 HORIZONTAL LINE, SCAN 5 Special */
|
|
314 0x23BC, /* #x09F2 HORIZONTAL LINE, SCAN 7 Special */
|
|
315 0x23BD, /* #x09F3 HORIZONTAL LINE, SCAN 9 Special */
|
|
316 0x251C, /* #x09F4 LEFT ``T'' Special */
|
|
317 0x2524, /* #x09F5 RIGHT ``T'' Special */
|
|
318 0x2534, /* #x09F6 BOTTOM ``T'' Special */
|
|
319 0x252C, /* #x09F7 TOP ``T'' Special */
|
|
320 0x2502 /* #x09F8 VERTICAL BAR Special */
|
|
321 };
|
|
322
|
|
323 static UINT_16_BIT const PUBLISHING[] =
|
|
324 {
|
|
325 0x2003, /* #x0AA1 EM SPACE Publish */
|
|
326
|
|
327 #define FIRST_KNOWN_PUBLISHING 0xAA1
|
|
328
|
|
329 0x2002, /* #x0AA2 EN SPACE Publish */
|
|
330 0x2004, /* #x0AA3 3/EM SPACE Publish */
|
|
331 0x2005, /* #x0AA4 4/EM SPACE Publish */
|
|
332 0x2007, /* #x0AA5 DIGIT SPACE Publish */
|
|
333 0x2008, /* #x0AA6 PUNCTUATION SPACE Publish */
|
|
334 0x2009, /* #x0AA7 THIN SPACE Publish */
|
|
335 0x200A, /* #x0AA8 HAIR SPACE Publish */
|
|
336 0x2014, /* #x0AA9 EM DASH Publish */
|
|
337 0x2013, /* #x0AAA EN DASH Publish */
|
|
338 0x0, /* #x0AAB */
|
|
339 0x0, /* #x0AAC SIGNIFICANT BLANK SYMBOL Publish */
|
|
340 0x0, /* #x0AAD */
|
|
341 0x2026, /* #x0AAE ELLIPSIS Publish */
|
|
342 0x2025, /* #x0AAF DOUBLE BASELINE DOT Publish */
|
|
343 0x2153, /* #x0AB0 VULGAR FRACTION ONE THIRD Publish */
|
|
344 0x2154, /* #x0AB1 VULGAR FRACTION TWO THIRDS Publish */
|
|
345 0x2155, /* #x0AB2 VULGAR FRACTION ONE FIFTH Publish */
|
|
346 0x2156, /* #x0AB3 VULGAR FRACTION TWO FIFTHS Publish */
|
|
347 0x2157, /* #x0AB4 VULGAR FRACTION THREE FIFTHS Publish */
|
|
348 0x2158, /* #x0AB5 VULGAR FRACTION FOUR FIFTHS Publish */
|
|
349 0x2159, /* #x0AB6 VULGAR FRACTION ONE SIXTH Publish */
|
|
350 0x215A, /* #x0AB7 VULGAR FRACTION FIVE SIXTHS Publish */
|
|
351 0x2105, /* #x0AB8 CARE OF Publish */
|
|
352 0x0, /* #x0AB9 */
|
|
353 0x0, /* #x0ABA */
|
|
354 0x2012, /* #x0ABB FIGURE DASH Publish */
|
3458
|
355 0x3008, /* #x0ABC LEFT ANGLE BRACKET Publish */
|
|
356 0x002E, /* #x0ABD DECIMAL POINT Publish */
|
|
357 0x3009, /* #x0ABE RIGHT ANGLE BRACKET Publish */
|
2828
|
358 0x0, /* #x0ABF MARKER Publish */
|
|
359 0x0, /* #x0AC0 */
|
|
360 0x0, /* #x0AC1 */
|
|
361 0x0, /* #x0AC2 */
|
|
362 0x215B, /* #x0AC3 VULGAR FRACTION ONE EIGHTH Publish */
|
|
363 0x215C, /* #x0AC4 VULGAR FRACTION THREE EIGHTHS Publish */
|
|
364 0x215D, /* #x0AC5 VULGAR FRACTION FIVE EIGHTHS Publish */
|
|
365 0x215E, /* #x0AC6 VULGAR FRACTION SEVEN EIGHTHS Publish */
|
|
366 0x0, /* #x0AC7 */
|
|
367 0x0, /* #x0AC8 */
|
|
368 0x2122, /* #x0AC9 TRADEMARK SIGN Publish */
|
|
369 0x0, /* #x0ACA SIGNATURE MARK Publish */
|
|
370 0x0, /* #x0ACB TRADEMARK SIGN IN CIRCLE Publish */
|
|
371 0x0, /* #x0ACC LEFT OPEN TRIANGLE Publish */
|
|
372 0x0, /* #x0ACD RIGHT OPEN TRIANGLE Publish */
|
|
373 0x0, /* #x0ACE EM OPEN CIRCLE Publish */
|
|
374 0x0, /* #x0ACF EM OPEN RECTANGLE Publish */
|
|
375 0x2018, /* #x0AD0 LEFT SINGLE QUOTATION MARK Publish */
|
|
376 0x2019, /* #x0AD1 RIGHT SINGLE QUOTATION MARK Publish */
|
|
377 0x201C, /* #x0AD2 LEFT DOUBLE QUOTATION MARK Publish */
|
|
378 0x201D, /* #x0AD3 RIGHT DOUBLE QUOTATION MARK Publish */
|
|
379 0x211E, /* #x0AD4 PRESCRIPTION, TAKE, RECIPE Publish */
|
|
380 0x0, /* #x0AD5 */
|
|
381 0x2032, /* #x0AD6 MINUTES Publish */
|
|
382 0x2033, /* #x0AD7 SECONDS Publish */
|
|
383 0x0, /* #x0AD8 */
|
|
384 0x271D, /* #x0AD9 LATIN CROSS Publish */
|
|
385 0x0, /* #x0ADA HEXAGRAM Publish */
|
|
386 0x0, /* #x0ADB FILLED RECTANGLE BULLET Publish */
|
|
387 0x0, /* #x0ADC FILLED LEFT TRIANGLE BULLET Publish */
|
|
388 0x0, /* #x0ADD FILLED RIGHT TRIANGLE BULLET Publish */
|
|
389 0x0, /* #x0ADE EM FILLED CIRCLE Publish */
|
|
390 0x0, /* #x0ADF EM FILLED RECTANGLE Publish */
|
|
391 0x0, /* #x0AE0 EN OPEN CIRCLE BULLET Publish */
|
|
392 0x0, /* #x0AE1 EN OPEN SQUARE BULLET Publish */
|
|
393 0x0, /* #x0AE2 OPEN RECTANGULAR BULLET Publish */
|
|
394 0x0, /* #x0AE3 OPEN TRIANGULAR BULLET UP Publish */
|
|
395 0x0, /* #x0AE4 OPEN TRIANGULAR BULLET DOWN Publish */
|
|
396 0x0, /* #x0AE5 OPEN STAR Publish */
|
|
397 0x0, /* #x0AE6 EN FILLED CIRCLE BULLET Publish */
|
|
398 0x0, /* #x0AE7 EN FILLED SQUARE BULLET Publish */
|
|
399 0x0, /* #x0AE8 FILLED TRIANGULAR BULLET UP Publish */
|
|
400 0x0, /* #x0AE9 FILLED TRIANGULAR BULLET DOWN Publish */
|
|
401 0x0, /* #x0AEA LEFT POINTER Publish */
|
|
402 0x0, /* #x0AEB RIGHT POINTER Publish */
|
|
403 0x2663, /* #x0AEC CLUB Publish */
|
|
404 0x2666, /* #x0AED DIAMOND Publish */
|
|
405 0x2665, /* #x0AEE HEART Publish */
|
|
406 0x0, /* #x0AEF */
|
|
407 0x2720, /* #x0AF0 MALTESE CROSS Publish */
|
|
408 0x2020, /* #x0AF1 DAGGER Publish */
|
|
409 0x2021, /* #x0AF2 DOUBLE DAGGER Publish */
|
|
410 0x2713, /* #x0AF3 CHECK MARK, TICK Publish */
|
|
411 0x2717, /* #x0AF4 BALLOT CROSS Publish */
|
|
412 0x266F, /* #x0AF5 MUSICAL SHARP Publish */
|
|
413 0x266D, /* #x0AF6 MUSICAL FLAT Publish */
|
|
414 0x2642, /* #x0AF7 MALE SYMBOL Publish */
|
|
415 0x2640, /* #x0AF8 FEMALE SYMBOL Publish */
|
|
416 0x260E, /* #x0AF9 TELEPHONE SYMBOL Publish */
|
|
417 0x2315, /* #x0AFA TELEPHONE RECORDER SYMBOL Publish */
|
|
418 0x2117, /* #x0AFB PHONOGRAPH COPYRIGHT SIGN Publish */
|
|
419 0x2038, /* #x0AFC CARET Publish */
|
|
420 0x201A, /* #x0AFD SINGLE LOW QUOTATION MARK Publish */
|
|
421 0x201E, /* #x0AFE DOUBLE LOW QUOTATION MARK Publish */
|
|
422 };
|
|
423
|
|
424 static UINT_16_BIT const APL[] =
|
|
425 {
|
|
426 0x22A5, /* #x0BC2 DOWN TACK APL */
|
|
427 #define FIRST_KNOWN_APL 0xBC2
|
|
428 0x0, /* #x0BC3 UP SHOE (CAP) APL */
|
|
429 0x230A, /* #x0BC4 DOWN STILE APL */
|
|
430 0x0, /* #x0BC5 */
|
|
431 0x0, /* #x0BC6 UNDERBAR APL */
|
|
432 0x0, /* #x0BC7 */
|
|
433 0x0, /* #x0BC8 */
|
|
434 0x0, /* #x0BC9 */
|
|
435 0x2218, /* #x0BCA JOT APL */
|
|
436 0x0, /* #x0BCB */
|
|
437 0x2395, /* #x0BCC QUAD APL */
|
|
438 0x0, /* #x0BCD */
|
|
439 0x22A4, /* #x0BCE UP TACK APL */
|
|
440 0x25CB, /* #x0BCF CIRCLE APL */
|
|
441 0x0, /* #x0BD0 */
|
|
442 0x0, /* #x0BD1 */
|
|
443 0x0, /* #x0BD2 */
|
|
444 0x2308, /* #x0BD3 UP STILE APL */
|
|
445 0x0, /* #x0BD4 */
|
|
446 0x0, /* #x0BD5 */
|
|
447 0x0, /* #x0BD6 DOWN SHOE (CUP) APL */
|
|
448 0x0, /* #x0BD7 */
|
|
449 0x0, /* #x0BD8 RIGHT SHOE APL */
|
|
450 0x0, /* #x0BD9 */
|
|
451 0x0, /* #x0BDA LEFT SHOE APL */
|
|
452 0x0, /* #x0BDB */
|
|
453 0x0, /* #x0BDC */
|
|
454 0x22A2, /* #x0BDC LEFT TACK APL */
|
|
455 0x0, /* #x0BDE */
|
|
456 0x0, /* #x0BDF */
|
|
457 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* 0x0BB0--0x0BBB */
|
|
458 0x0, 0x0, 0x0, 0x0,
|
|
459 0x22A3, /* #x0BFC RIGHT TACK APL */
|
|
460 };
|
|
461
|
3640
|
462 static UINT_16_BIT const CYRILLIC[] =
|
|
463 {
|
|
464 0x0452, /* #x06A1 CYRILLIC SMALL LETTER DJE */
|
|
465 #define FIRST_KNOWN_CYRILLIC 0x6A1
|
|
466 0x0453, /* #x06A2 CYRILLIC SMALL LETTER GJE */
|
|
467 0x0451, /* #x06A3 CYRILLIC SMALL LETTER IO */
|
|
468 0x0454, /* #x06A4 CYRILLIC SMALL LETTER UKRAINIAN IE */
|
|
469 0x0455, /* #x06A5 CYRILLIC SMALL LETTER DZE */
|
|
470 0x0456, /* #x06A6 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
|
|
471 0x0457, /* #x06A7 CYRILLIC SMALL LETTER YI */
|
|
472 0x0458, /* #x06A8 CYRILLIC SMALL LETTER JE */
|
|
473 0x0459, /* #x06A9 CYRILLIC SMALL LETTER LJE */
|
|
474 0x045A, /* #x06AA CYRILLIC SMALL LETTER NJE */
|
|
475 0x045B, /* #x06AB CYRILLIC SMALL LETTER TSHE */
|
|
476 0x045C, /* #x06AC CYRILLIC SMALL LETTER KJE */
|
|
477 0x0491, /* #x06AD CYRILLIC SMALL LETTER GHE WITH UPTURN */
|
|
478 0x045E, /* #x06AE CYRILLIC SMALL LETTER SHORT U */
|
|
479 0x045F, /* #x06AF CYRILLIC SMALL LETTER DZHE */
|
|
480 0x2116, /* #x06B0 NUMERO SIGN */
|
|
481 0x0402, /* #x06B1 CYRILLIC CAPITAL LETTER DJE */
|
|
482 0x0403, /* #x06B2 CYRILLIC CAPITAL LETTER GJE */
|
|
483 0x0401, /* #x06B3 CYRILLIC CAPITAL LETTER IO */
|
|
484 0x0404, /* #x06B4 CYRILLIC CAPITAL LETTER UKRAINIAN IE */
|
|
485 0x0405, /* #x06B5 CYRILLIC CAPITAL LETTER DZE */
|
|
486 0x0406, /* #x06B6 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
|
|
487 0x0407, /* #x06B7 CYRILLIC CAPITAL LETTER YI */
|
|
488 0x0408, /* #x06B8 CYRILLIC CAPITAL LETTER JE */
|
|
489 0x0409, /* #x06B9 CYRILLIC CAPITAL LETTER LJE */
|
|
490 0x040A, /* #x06BA CYRILLIC CAPITAL LETTER NJE */
|
|
491 0x040B, /* #x06BB CYRILLIC CAPITAL LETTER TSHE */
|
|
492 0x040C, /* #x06BC CYRILLIC CAPITAL LETTER KJE */
|
|
493 0x0490, /* #x06BD CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
|
|
494 0x040E, /* #x06BE CYRILLIC CAPITAL LETTER SHORT U */
|
|
495 0x040F, /* #x06BF CYRILLIC CAPITAL LETTER DZHE */
|
|
496 0x044E, /* #x06C0 CYRILLIC SMALL LETTER YU */
|
|
497 0x0430, /* #x06C1 CYRILLIC SMALL LETTER A */
|
|
498 0x0431, /* #x06C2 CYRILLIC SMALL LETTER BE */
|
|
499 0x0446, /* #x06C3 CYRILLIC SMALL LETTER TSE */
|
|
500 0x0434, /* #x06C4 CYRILLIC SMALL LETTER DE */
|
|
501 0x0435, /* #x06C5 CYRILLIC SMALL LETTER IE */
|
|
502 0x0444, /* #x06C6 CYRILLIC SMALL LETTER EF */
|
|
503 0x0433, /* #x06C7 CYRILLIC SMALL LETTER GHE */
|
|
504 0x0445, /* #x06C8 CYRILLIC SMALL LETTER HA */
|
|
505 0x0438, /* #x06C9 CYRILLIC SMALL LETTER I */
|
|
506 0x0439, /* #x06CA CYRILLIC SMALL LETTER SHORT I */
|
|
507 0x043A, /* #x06CB CYRILLIC SMALL LETTER KA */
|
|
508 0x043B, /* #x06CC CYRILLIC SMALL LETTER EL */
|
|
509 0x043C, /* #x06CD CYRILLIC SMALL LETTER EM */
|
|
510 0x043D, /* #x06CE CYRILLIC SMALL LETTER EN */
|
|
511 0x043E, /* #x06CF CYRILLIC SMALL LETTER O */
|
|
512 0x043F, /* #x06D0 CYRILLIC SMALL LETTER PE */
|
|
513 0x044F, /* #x06D1 CYRILLIC SMALL LETTER YA */
|
|
514 0x0440, /* #x06D2 CYRILLIC SMALL LETTER ER */
|
|
515 0x0441, /* #x06D3 CYRILLIC SMALL LETTER ES */
|
|
516 0x0442, /* #x06D4 CYRILLIC SMALL LETTER TE */
|
|
517 0x0443, /* #x06D5 CYRILLIC SMALL LETTER U */
|
|
518 0x0436, /* #x06D6 CYRILLIC SMALL LETTER ZHE */
|
|
519 0x0432, /* #x06D7 CYRILLIC SMALL LETTER VE */
|
|
520 0x044C, /* #x06D8 CYRILLIC SMALL LETTER SOFT SIGN */
|
|
521 0x044B, /* #x06D9 CYRILLIC SMALL LETTER YERU */
|
|
522 0x0437, /* #x06DA CYRILLIC SMALL LETTER ZE */
|
|
523 0x0448, /* #x06DB CYRILLIC SMALL LETTER SHA */
|
|
524 0x044D, /* #x06DC CYRILLIC SMALL LETTER E */
|
|
525 0x0449, /* #x06DD CYRILLIC SMALL LETTER SHCHA */
|
|
526 0x0447, /* #x06DE CYRILLIC SMALL LETTER CHE */
|
|
527 0x044A, /* #x06DF CYRILLIC SMALL LETTER HARD SIGN */
|
|
528 0x042E, /* #x06E0 CYRILLIC CAPITAL LETTER YU */
|
|
529 0x0410, /* #x06E1 CYRILLIC CAPITAL LETTER A */
|
|
530 0x0411, /* #x06E2 CYRILLIC CAPITAL LETTER BE */
|
|
531 0x0426, /* #x06E3 CYRILLIC CAPITAL LETTER TSE */
|
|
532 0x0414, /* #x06E4 CYRILLIC CAPITAL LETTER DE */
|
|
533 0x0415, /* #x06E5 CYRILLIC CAPITAL LETTER IE */
|
|
534 0x0424, /* #x06E6 CYRILLIC CAPITAL LETTER EF */
|
|
535 0x0413, /* #x06E7 CYRILLIC CAPITAL LETTER GHE */
|
|
536 0x0425, /* #x06E8 CYRILLIC CAPITAL LETTER HA */
|
|
537 0x0418, /* #x06E9 CYRILLIC CAPITAL LETTER I */
|
|
538 0x0419, /* #x06EA CYRILLIC CAPITAL LETTER SHORT I */
|
|
539 0x041A, /* #x06EB CYRILLIC CAPITAL LETTER KA */
|
|
540 0x041B, /* #x06EC CYRILLIC CAPITAL LETTER EL */
|
|
541 0x041C, /* #x06ED CYRILLIC CAPITAL LETTER EM */
|
|
542 0x041D, /* #x06EE CYRILLIC CAPITAL LETTER EN */
|
|
543 0x041E, /* #x06EF CYRILLIC CAPITAL LETTER O */
|
|
544 0x041F, /* #x06F0 CYRILLIC CAPITAL LETTER PE */
|
|
545 0x042F, /* #x06F1 CYRILLIC CAPITAL LETTER YA */
|
|
546 0x0420, /* #x06F2 CYRILLIC CAPITAL LETTER ER */
|
|
547 0x0421, /* #x06F3 CYRILLIC CAPITAL LETTER ES */
|
|
548 0x0422, /* #x06F4 CYRILLIC CAPITAL LETTER TE */
|
|
549 0x0423, /* #x06F5 CYRILLIC CAPITAL LETTER U */
|
|
550 0x0416, /* #x06F6 CYRILLIC CAPITAL LETTER ZHE */
|
|
551 0x0412, /* #x06F7 CYRILLIC CAPITAL LETTER VE */
|
|
552 0x042C, /* #x06F8 CYRILLIC CAPITAL LETTER SOFT SIGN */
|
|
553 0x042B, /* #x06F9 CYRILLIC CAPITAL LETTER YERU */
|
|
554 0x0417, /* #x06FA CYRILLIC CAPITAL LETTER ZE */
|
|
555 0x0428, /* #x06FB CYRILLIC CAPITAL LETTER SHA */
|
|
556 0x042D, /* #x06FC CYRILLIC CAPITAL LETTER E */
|
|
557 0x0429, /* #x06FD CYRILLIC CAPITAL LETTER SHCHA */
|
|
558 0x0427, /* #x06FE CYRILLIC CAPITAL LETTER CHE */
|
|
559 0x042A, /* #x06FF CYRILLIC CAPITAL LETTER HARD SIGN */
|
|
560 };
|
|
561
|
2828
|
562 /* For every key on the keyboard that has a known character correspondence,
|
|
563 we define the character-of-keysym property of its XEmacs keysym, and make
|
|
564 the default binding for the key be self-insert-command.
|
|
565
|
|
566 The following magic is based on intimate knowledge of some of
|
|
567 X11/keysymdef.h. The keysym mappings defined by X11 are based on the
|
|
568 iso8859 standards, except for Cyrillic and Greek.
|
|
569
|
|
570 In a non-Mule world, a user can still have a multi-lingual editor, by
|
|
571 doing (set-face-font "...-iso8859-2" (current-buffer)) for all their
|
|
572 Latin-2 buffers, etc. and the X11 keysyms corresponding to characters in
|
|
573 those character sets will still do the right thing (because of the
|
|
574 make_char (code + 0x80) non-Mule case below.) Of course, X11 keysyms in
|
|
575 other character sets will not do the right thing, because XEmacs won't
|
|
576 support the right thing.
|
|
577
|
|
578 This code is also called when a command lookup is about to fail, and the
|
|
579 X11 platform code has worked out that it previously wasn't aware the
|
|
580 keysym of that command could be generated by the user's keyboard; in that
|
|
581 case, we bind its XEmacs keysym to self-insert-command if it has a
|
|
582 character correspondence we know about, and tell the general event code
|
|
583 that we've done so, so it can try the lookup again.
|
|
584
|
|
585 Called from the GTK code because GTK 1 has no defined way of doing the
|
|
586 same thing, and this works for it on X11. It should be moved back into
|
|
587 event-Xt.c when and if the GTK port moves to GTK 2. */
|
|
588
|
|
589 #ifndef THIS_IS_GTK
|
|
590 static Lisp_Object
|
|
591 x_keysym_to_character(KeySym keysym)
|
|
592 #else
|
|
593 Lisp_Object
|
|
594 gtk_keysym_to_character(guint keysym)
|
|
595 #endif
|
|
596 {
|
|
597 Lisp_Object charset = Qzero;
|
|
598 int code = 0;
|
|
599
|
|
600 /* Markus Kuhn's spec says keysyms in the range #x01000100 to #x0110FFFF
|
|
601 and only those should correspond directly to Unicode code points, in
|
|
602 the range #x100-#x10FFFF; actual implementations can have the Latin 1
|
|
603 code points do the same thing with keysyms
|
3439
|
604 #x01000000-#x01000100. */
|
2828
|
605
|
3439
|
606 if (keysym >= 0x01000000 && keysym <= 0x0110FFFF)
|
2828
|
607 return Funicode_to_char (make_int(keysym & 0xffffff), Qnil);
|
|
608
|
|
609 if ((keysym & 0xff) < 0xa0)
|
|
610 return Qnil;
|
|
611
|
|
612 switch (keysym >> 8)
|
|
613 {
|
|
614
|
|
615 #define USE_CHARSET(var,cs) \
|
|
616 ((var) = charset_by_leading_byte (LEADING_BYTE_##cs))
|
|
617
|
|
618 case 0: /* ASCII + Latin1 */
|
|
619 USE_CHARSET (charset, LATIN_ISO8859_1);
|
|
620 code = keysym & 0x7f;
|
|
621 break;
|
|
622 case 1: /* Latin2 */
|
|
623 USE_CHARSET (charset, LATIN_ISO8859_2);
|
|
624 code = keysym & 0x7f;
|
|
625 break;
|
|
626 case 2: /* Latin3 */
|
|
627 USE_CHARSET (charset, LATIN_ISO8859_3);
|
|
628 code = keysym & 0x7f;
|
|
629 break;
|
|
630 case 3: /* Latin4 */
|
|
631 USE_CHARSET (charset, LATIN_ISO8859_4);
|
|
632 code = keysym & 0x7f;
|
|
633 break;
|
|
634 case 4: /* Katakana */
|
|
635 USE_CHARSET (charset, KATAKANA_JISX0201);
|
|
636 if ((keysym & 0xff) > 0xa0)
|
|
637 code = keysym & 0x7f;
|
|
638 break;
|
|
639 case 5: /* Arabic */
|
|
640 USE_CHARSET (charset, ARABIC_ISO8859_6);
|
|
641 code = keysym & 0x7f;
|
|
642 break;
|
|
643 case 6: /* Cyrillic */
|
|
644 {
|
3640
|
645 USE_UNICODE_MAP(keysym, CYRILLIC);
|
2828
|
646 break;
|
|
647 }
|
|
648 case 7: /* Greek */
|
|
649 {
|
|
650 static UExtbyte const greek[] = /* 0x20 - 0x7f */
|
|
651 {0x00, 0x36, 0x38, 0x39, 0x3a, 0x5a, 0x00, 0x3c,
|
|
652 0x3e, 0x5b, 0x00, 0x3f, 0x00, 0x00, 0x35, 0x2f,
|
|
653 0x00, 0x5c, 0x5d, 0x5e, 0x5f, 0x7a, 0x40, 0x7c,
|
|
654 0x7d, 0x7b, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
|
655 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
|
656 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
|
|
657 0x50, 0x51, 0x53, 0x00, 0x54, 0x55, 0x56, 0x57,
|
|
658 0x58, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
659 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
|
660 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
|
|
661 0x70, 0x71, 0x73, 0x72, 0x74, 0x75, 0x76, 0x77,
|
|
662 0x78, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
663 USE_CHARSET (charset, GREEK_ISO8859_7);
|
|
664 code = greek[(keysym & 0x7f) - 0x20];
|
|
665 break;
|
|
666 }
|
|
667 case 8:
|
|
668 USE_UNICODE_MAP(keysym, TECHNICAL);
|
|
669 break;
|
|
670 case 9:
|
|
671 USE_UNICODE_MAP(keysym, SPECIAL);
|
|
672 break;
|
|
673 case 10:
|
|
674 USE_UNICODE_MAP(keysym, PUBLISHING);
|
|
675 break;
|
|
676 case 11:
|
|
677 USE_UNICODE_MAP(keysym, APL);
|
|
678 break;
|
|
679 case 12: /* Hebrew */
|
|
680 USE_CHARSET (charset, HEBREW_ISO8859_8);
|
|
681 code = keysym & 0x7f;
|
|
682 break;
|
|
683 case 13: /* Thai */
|
|
684 /* #### This needs to deal with character composition.
|
|
685 Are you sure we can't leave it to the X server? */
|
|
686 USE_CHARSET (charset, THAI_TIS620);
|
|
687 code = keysym & 0x7f;
|
|
688 break;
|
|
689 case 14: /* Korean Hangul. Would like some information on whether this
|
|
690 is worth doing--there don't appear to be any Korean keyboard
|
|
691 layouts in the XKB data files. */
|
|
692 break;
|
|
693
|
|
694 case 19: /* Latin 9 - ISO8859-15. */
|
|
695 USE_CHARSET (charset, LATIN_ISO8859_15);
|
|
696 code = keysym & 0x7f;
|
|
697 break;
|
|
698 case 32: /* Currency. The lower sixteen bits of these keysyms happily
|
|
699 correspond exactly to the Unicode code points of the
|
|
700 associated characters */
|
|
701 return Funicode_to_char(make_int(keysym & 0xffff), Qnil);
|
|
702 break;
|
|
703 default:
|
|
704 break;
|
|
705 }
|
|
706
|
|
707 if (code == 0)
|
|
708 return Qnil;
|
|
709
|
|
710 #ifdef MULE
|
|
711 return make_char (make_ichar (charset, code, 0));
|
|
712 #else
|
|
713 return make_char (code + 0x80);
|
|
714 #endif
|
|
715 }
|
|
716
|
|
717 #endif /* defined(THIS_IS_X) || !defined(__GDK_KEYS_H__) */
|