Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 84b14dcb0985 |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
439:357dd071b03c | 440:8de8e3f6228a |
---|---|
119 0 | 119 0 |
120 }; | 120 }; |
121 | 121 |
122 static Lisp_Object x_keysym_to_emacs_keysym (KeySym keysym, int simple_p); | 122 static Lisp_Object x_keysym_to_emacs_keysym (KeySym keysym, int simple_p); |
123 void emacs_Xt_mapping_action (Widget w, XEvent *event); | 123 void emacs_Xt_mapping_action (Widget w, XEvent *event); |
124 void debug_process_finalization (struct Lisp_Process *p); | 124 void debug_process_finalization (Lisp_Process *p); |
125 void emacs_Xt_event_handler (Widget wid, XtPointer closure, XEvent *event, | 125 void emacs_Xt_event_handler (Widget wid, XtPointer closure, XEvent *event, |
126 Boolean *continue_to_dispatch); | 126 Boolean *continue_to_dispatch); |
127 | 127 |
128 static int last_quit_check_signal_tick_count; | 128 static int last_quit_check_signal_tick_count; |
129 | 129 |
172 | 172 |
173 Emacs detects keyboard configurations which violate the above rules, and | 173 Emacs detects keyboard configurations which violate the above rules, and |
174 prints an error message on the standard-error-output. (Perhaps it should | 174 prints an error message on the standard-error-output. (Perhaps it should |
175 use a pop-up-window instead.) | 175 use a pop-up-window instead.) |
176 */ | 176 */ |
177 | |
178 /* For every key on the keyboard that has a known character correspondence, | |
179 we define the ascii-character property of the keysym, and make the | |
180 default binding for the key be self-insert-command. | |
181 | |
182 The following magic is basically intimate knowledge of X11/keysymdef.h. | |
183 The keysym mappings defined by X11 are based on the iso8859 standards, | |
184 except for Cyrillic and Greek. | |
185 | |
186 In a non-Mule world, a user can still have a multi-lingual editor, by doing | |
187 (set-face-font "...-iso8859-2" (current-buffer)) | |
188 for all their Latin-2 buffers, etc. */ | |
189 | |
190 static Lisp_Object | |
191 x_keysym_to_character (KeySym keysym) | |
192 { | |
193 #ifdef MULE | |
194 Lisp_Object charset = Qzero; | |
195 #define USE_CHARSET(var,cs) \ | |
196 ((var) = CHARSET_BY_LEADING_BYTE (LEADING_BYTE_##cs)) | |
197 #else | |
198 #define USE_CHARSET(var,lb) | |
199 #endif /* MULE */ | |
200 int code = 0; | |
201 | |
202 if ((keysym & 0xff) < 0xa0) | |
203 return Qnil; | |
204 | |
205 switch (keysym >> 8) | |
206 { | |
207 case 0: /* ASCII + Latin1 */ | |
208 USE_CHARSET (charset, LATIN_ISO8859_1); | |
209 code = keysym & 0x7f; | |
210 break; | |
211 case 1: /* Latin2 */ | |
212 USE_CHARSET (charset, LATIN_ISO8859_2); | |
213 code = keysym & 0x7f; | |
214 break; | |
215 case 2: /* Latin3 */ | |
216 USE_CHARSET (charset, LATIN_ISO8859_3); | |
217 code = keysym & 0x7f; | |
218 break; | |
219 case 3: /* Latin4 */ | |
220 USE_CHARSET (charset, LATIN_ISO8859_4); | |
221 code = keysym & 0x7f; | |
222 break; | |
223 case 4: /* Katakana */ | |
224 USE_CHARSET (charset, KATAKANA_JISX0201); | |
225 if ((keysym & 0xff) > 0xa0) | |
226 code = keysym & 0x7f; | |
227 break; | |
228 case 5: /* Arabic */ | |
229 USE_CHARSET (charset, ARABIC_ISO8859_6); | |
230 code = keysym & 0x7f; | |
231 break; | |
232 case 6: /* Cyrillic */ | |
233 { | |
234 static unsigned char const cyrillic[] = /* 0x20 - 0x7f */ | |
235 {0x00, 0x72, 0x73, 0x71, 0x74, 0x75, 0x76, 0x77, | |
236 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x00, 0x7e, 0x7f, | |
237 0x70, 0x22, 0x23, 0x21, 0x24, 0x25, 0x26, 0x27, | |
238 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x00, 0x2e, 0x2f, | |
239 0x6e, 0x50, 0x51, 0x66, 0x54, 0x55, 0x64, 0x53, | |
240 0x65, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, | |
241 0x5f, 0x6f, 0x60, 0x61, 0x62, 0x63, 0x56, 0x52, | |
242 0x6c, 0x6b, 0x57, 0x68, 0x6d, 0x69, 0x67, 0x6a, | |
243 0x4e, 0x30, 0x31, 0x46, 0x34, 0x35, 0x44, 0x33, | |
244 0x45, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, | |
245 0x3f, 0x4f, 0x40, 0x41, 0x42, 0x43, 0x36, 0x32, | |
246 0x4c, 0x4b, 0x37, 0x48, 0x4d, 0x49, 0x47, 0x4a}; | |
247 USE_CHARSET (charset, CYRILLIC_ISO8859_5); | |
248 code = cyrillic[(keysym & 0x7f) - 0x20]; | |
249 break; | |
250 } | |
251 case 7: /* Greek */ | |
252 { | |
253 static unsigned char const greek[] = /* 0x20 - 0x7f */ | |
254 {0x00, 0x36, 0x38, 0x39, 0x3a, 0x5a, 0x00, 0x3c, | |
255 0x3e, 0x5b, 0x00, 0x3f, 0x00, 0x00, 0x35, 0x2f, | |
256 0x00, 0x5c, 0x5d, 0x5e, 0x5f, 0x7a, 0x40, 0x7c, | |
257 0x7d, 0x7b, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, | |
258 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | |
259 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, | |
260 0x50, 0x51, 0x53, 0x00, 0x54, 0x55, 0x56, 0x57, | |
261 0x58, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
262 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | |
263 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | |
264 0x70, 0x71, 0x73, 0x72, 0x74, 0x75, 0x76, 0x77, | |
265 0x78, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | |
266 USE_CHARSET (charset, GREEK_ISO8859_7); | |
267 code = greek[(keysym & 0x7f) - 0x20]; | |
268 break; | |
269 } | |
270 case 8: /* Technical */ | |
271 break; | |
272 case 9: /* Special */ | |
273 break; | |
274 case 10: /* Publishing */ | |
275 break; | |
276 case 11: /* APL */ | |
277 break; | |
278 case 12: /* Hebrew */ | |
279 USE_CHARSET (charset, HEBREW_ISO8859_8); | |
280 code = keysym & 0x7f; | |
281 break; | |
282 case 13: /* Thai */ | |
283 /* #### This needs to deal with character composition. */ | |
284 USE_CHARSET (charset, THAI_TIS620); | |
285 code = keysym & 0x7f; | |
286 break; | |
287 case 14: /* Korean Hangul */ | |
288 break; | |
289 case 19: /* Latin 9 - ISO8859-15 - unsupported charset. */ | |
290 break; | |
291 case 32: /* Currency */ | |
292 break; | |
293 default: | |
294 break; | |
295 } | |
296 | |
297 if (code == 0) | |
298 return Qnil; | |
299 | |
300 #ifdef MULE | |
301 return make_char (MAKE_CHAR (charset, code, 0)); | |
302 #else | |
303 return make_char (code + 0x80); | |
304 #endif | |
305 } | |
306 | |
307 /* #### The way that keysym correspondence to characters should work: | |
308 - a Lisp_Event should contain a keysym AND a character slot. | |
309 - keybindings are tried with the keysym. If no binding can be found, | |
310 and there is a corresponding character, call self-insert-command. | |
311 | |
312 #### Nuke x-iso8859-1.el. | |
313 #### Nuke the Qascii_character property. | |
314 #### Nuke Vcharacter_set_property. | |
315 */ | |
316 static void | |
317 maybe_define_x_key_as_self_inserting_character (KeySym keysym, Lisp_Object symbol) | |
318 { | |
319 Lisp_Object character = x_keysym_to_character (keysym); | |
320 | |
321 if (CHARP (character)) | |
322 { | |
323 extern Lisp_Object Vcurrent_global_map; | |
324 extern Lisp_Object Qascii_character; | |
325 Fput (symbol, Qascii_character, character); | |
326 if (NILP (Flookup_key (Vcurrent_global_map, symbol, Qnil))) | |
327 Fdefine_key (Vcurrent_global_map, symbol, Qself_insert_command); | |
328 } | |
329 } | |
330 | |
331 static void | |
332 x_has_keysym (KeySym keysym, Lisp_Object hash_table, int with_modifiers) | |
333 { | |
334 KeySym upper_lower[2]; | |
335 int j; | |
336 | |
337 if (keysym < 0x80) /* Optimize for ASCII keysyms */ | |
338 return; | |
339 /* If you do: xmodmap -e 'keysym NN = scaron' | |
340 and then press (Shift scaron), X11 will return the different | |
341 keysym Scaron, but xmodmap -pke might not even mention Scaron. | |
342 So we `register' both scaron and Scaron. */ | |
343 XConvertCase (keysym, &upper_lower[0], &upper_lower[1]); | |
344 | |
345 for (j = 0; j < (upper_lower[0] == upper_lower[1] ? 1 : 2); j++) | |
346 { | |
347 char *name; | |
348 keysym = upper_lower[j]; | |
349 | |
350 name = XKeysymToString (keysym); | |
351 if (name) | |
352 { | |
353 /* X guarantees NAME to be in the Host Portable Character Encoding */ | |
354 Lisp_Object sym = x_keysym_to_emacs_keysym (keysym, 0); | |
355 Lisp_Object new_value = with_modifiers ? Qt : Qsans_modifiers; | |
356 Lisp_Object old_value = Fgethash (sym, hash_table, Qnil); | |
357 | |
358 if (! EQ (old_value, new_value) | |
359 && ! (EQ (old_value, Qsans_modifiers) && | |
360 EQ (new_value, Qt))) | |
361 { | |
362 maybe_define_x_key_as_self_inserting_character (keysym, sym); | |
363 Fputhash (build_ext_string (name, Qbinary), new_value, hash_table); | |
364 Fputhash (sym, new_value, hash_table); | |
365 } | |
366 } | |
367 } | |
368 } | |
177 | 369 |
178 static void | 370 static void |
179 x_reset_key_mapping (struct device *d) | 371 x_reset_key_mapping (struct device *d) |
180 { | 372 { |
181 Display *display = DEVICE_X_DISPLAY (d); | 373 Display *display = DEVICE_X_DISPLAY (d); |
210 int j; | 402 int j; |
211 | 403 |
212 if (keysym[0] == NoSymbol) | 404 if (keysym[0] == NoSymbol) |
213 continue; | 405 continue; |
214 | 406 |
215 { | 407 x_has_keysym (keysym[0], hash_table, 0); |
216 char *name = XKeysymToString (keysym[0]); | |
217 Lisp_Object sym = x_keysym_to_emacs_keysym (keysym[0], 0); | |
218 if (name) | |
219 { | |
220 Fputhash (build_string (name), Qsans_modifiers, hash_table); | |
221 Fputhash (sym, Qsans_modifiers, hash_table); | |
222 } | |
223 } | |
224 | 408 |
225 for (j = 1; j < keysyms_per_code; j++) | 409 for (j = 1; j < keysyms_per_code; j++) |
226 { | 410 { |
227 if (keysym[j] != keysym[0] && | 411 if (keysym[j] != keysym[0] && |
228 keysym[j] != NoSymbol) | 412 keysym[j] != NoSymbol) |
229 { | 413 x_has_keysym (keysym[j], hash_table, 1); |
230 char *name = XKeysymToString (keysym[j]); | |
231 Lisp_Object sym = x_keysym_to_emacs_keysym (keysym[j], 0); | |
232 if (name && NILP (Fgethash (sym, hash_table, Qnil))) | |
233 { | |
234 Fputhash (build_string (name), Qt, hash_table); | |
235 Fputhash (sym, Qt, hash_table); | |
236 } | |
237 } | |
238 } | 414 } |
239 } | 415 } |
240 } | 416 } |
241 | 417 |
242 static CONST char * | 418 static CONST char * |
858 Emchar ch; | 1034 Emchar ch; |
859 Lisp_Object instream, fb_instream; | 1035 Lisp_Object instream, fb_instream; |
860 Lstream *istr; | 1036 Lstream *istr; |
861 struct gcpro gcpro1, gcpro2; | 1037 struct gcpro gcpro1, gcpro2; |
862 | 1038 |
863 fb_instream = | 1039 fb_instream = make_fixed_buffer_input_stream (bufptr, len); |
864 make_fixed_buffer_input_stream ((unsigned char *) bufptr, len); | 1040 |
865 | 1041 /* #### Use Fget_coding_system (Vcomposed_input_coding_system) */ |
866 /* ### Use Fget_coding_system (Vcomposed_input_coding_system) */ | |
867 instream = | 1042 instream = |
868 make_decoding_input_stream (XLSTREAM (fb_instream), | 1043 make_decoding_input_stream (XLSTREAM (fb_instream), |
869 Fget_coding_system (Qundecided)); | 1044 Fget_coding_system (Qundecided)); |
870 | 1045 |
871 istr = XLSTREAM (instream); | 1046 istr = XLSTREAM (instream); |
872 | 1047 |
873 GCPRO2 (instream, fb_instream); | 1048 GCPRO2 (instream, fb_instream); |
874 while ((ch = Lstream_get_emchar (istr)) != EOF) | 1049 while ((ch = Lstream_get_emchar (istr)) != EOF) |
875 { | 1050 { |
876 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1051 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
877 struct Lisp_Event *ev = XEVENT (emacs_event); | 1052 Lisp_Event *ev = XEVENT (emacs_event); |
878 ev->channel = DEVICE_CONSOLE (d); | 1053 ev->channel = DEVICE_CONSOLE (d); |
879 ev->event_type = key_press_event; | 1054 ev->event_type = key_press_event; |
880 ev->timestamp = event->time; | 1055 ev->timestamp = event->time; |
881 ev->event.key.modifiers = 0; | 1056 ev->event.key.modifiers = 0; |
882 ev->event.key.keysym = make_char (ch); | 1057 ev->event.key.keysym = make_char (ch); |
919 } | 1094 } |
920 DEVICE_X_LAST_SERVER_TIMESTAMP (d) = t; | 1095 DEVICE_X_LAST_SERVER_TIMESTAMP (d) = t; |
921 } | 1096 } |
922 | 1097 |
923 static int | 1098 static int |
924 x_event_to_emacs_event (XEvent *x_event, struct Lisp_Event *emacs_event) | 1099 x_event_to_emacs_event (XEvent *x_event, Lisp_Event *emacs_event) |
925 { | 1100 { |
926 Display *display = x_event->xany.display; | 1101 Display *display = x_event->xany.display; |
927 struct device *d = get_device_from_display (display); | 1102 struct device *d = get_device_from_display (display); |
928 struct x_device *xd = DEVICE_X_DATA (d); | 1103 struct x_device *xd = DEVICE_X_DATA (d); |
929 | 1104 |
1189 l_type = Qdragdrop_MIME; | 1364 l_type = Qdragdrop_MIME; |
1190 l_dndlist = list1 ( list3 ( list1 ( make_string ((Bufbyte *)"text/plain", 10) ), | 1365 l_dndlist = list1 ( list3 ( list1 ( make_string ((Bufbyte *)"text/plain", 10) ), |
1191 make_string ((Bufbyte *)"8bit", 4), | 1366 make_string ((Bufbyte *)"8bit", 4), |
1192 make_ext_string ((Extbyte *)data, | 1367 make_ext_string ((Extbyte *)data, |
1193 strlen((char *)data), | 1368 strlen((char *)data), |
1194 FORMAT_CTEXT) ) ); | 1369 Qctext) ) ); |
1195 break; | 1370 break; |
1196 case DndMIME: | 1371 case DndMIME: |
1197 /* we have to parse this in some way to extract | 1372 /* we have to parse this in some way to extract |
1198 content-type and params (in the tm way) and | 1373 content-type and params (in the tm way) and |
1199 content encoding. | 1374 content encoding. |
1202 to tm... | 1377 to tm... |
1203 */ | 1378 */ |
1204 l_type = Qdragdrop_MIME; | 1379 l_type = Qdragdrop_MIME; |
1205 l_dndlist = list1 ( make_ext_string ((Extbyte *)data, | 1380 l_dndlist = list1 ( make_ext_string ((Extbyte *)data, |
1206 strlen((char *)data), | 1381 strlen((char *)data), |
1207 FORMAT_BINARY) ); | 1382 Qbinary) ); |
1208 break; | 1383 break; |
1209 case DndFile: | 1384 case DndFile: |
1210 case DndDir: | 1385 case DndDir: |
1211 case DndLink: | 1386 case DndLink: |
1212 case DndExe: | 1387 case DndExe: |
1223 case DndURL: | 1398 case DndURL: |
1224 /* as it is a real URL it should already be escaped | 1399 /* as it is a real URL it should already be escaped |
1225 and escaping again will break them (cause % is unsave) */ | 1400 and escaping again will break them (cause % is unsave) */ |
1226 l_dndlist = list1 ( make_ext_string ((Extbyte *)data, | 1401 l_dndlist = list1 ( make_ext_string ((Extbyte *)data, |
1227 strlen ((char *)data), | 1402 strlen ((char *)data), |
1228 FORMAT_FILENAME) ); | 1403 Qfile_name) ); |
1229 l_type = Qdragdrop_URL; | 1404 l_type = Qdragdrop_URL; |
1230 break; | 1405 break; |
1231 default: /* Unknown, RawData and any other type */ | 1406 default: /* Unknown, RawData and any other type */ |
1232 l_dndlist = list1 ( list3 ( list1 ( make_string ((Bufbyte *)"application/octet-stream", 24) ), | 1407 l_dndlist = list1 ( list3 ( list1 ( make_string ((Bufbyte *)"application/octet-stream", 24) ), |
1233 make_string ((Bufbyte *)"8bit", 4), | 1408 make_string ((Bufbyte *)"8bit", 4), |
1234 make_ext_string ((Extbyte *)data, | 1409 make_ext_string ((Extbyte *)data, |
1235 size, | 1410 size, |
1236 FORMAT_BINARY) ) ); | 1411 Qbinary) ) ); |
1237 l_type = Qdragdrop_MIME; | 1412 l_type = Qdragdrop_MIME; |
1238 break; | 1413 break; |
1239 } | 1414 } |
1240 | 1415 |
1241 emacs_event->event.misc.function = Qdragdrop_drop_dispatch; | 1416 emacs_event->event.misc.function = Qdragdrop_drop_dispatch; |
1539 #endif | 1714 #endif |
1540 } | 1715 } |
1541 } | 1716 } |
1542 | 1717 |
1543 static void | 1718 static void |
1544 emacs_Xt_handle_magic_event (struct Lisp_Event *emacs_event) | 1719 emacs_Xt_handle_magic_event (Lisp_Event *emacs_event) |
1545 { | 1720 { |
1546 /* This function can GC */ | 1721 /* This function can GC */ |
1547 XEvent *event = &emacs_event->event.magic.underlying_x_event; | 1722 XEvent *event = &emacs_event->event.magic.underlying_x_event; |
1548 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); | 1723 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); |
1549 | 1724 |
1780 if (timeout) | 1955 if (timeout) |
1781 Blocktype_free (the_Xt_timeout_blocktype, timeout); | 1956 Blocktype_free (the_Xt_timeout_blocktype, timeout); |
1782 } | 1957 } |
1783 | 1958 |
1784 static void | 1959 static void |
1785 Xt_timeout_to_emacs_event (struct Lisp_Event *emacs_event) | 1960 Xt_timeout_to_emacs_event (Lisp_Event *emacs_event) |
1786 { | 1961 { |
1787 struct Xt_timeout *timeout = completed_timeouts; | 1962 struct Xt_timeout *timeout = completed_timeouts; |
1788 assert (timeout); | 1963 assert (timeout); |
1789 completed_timeouts = completed_timeouts->next; | 1964 completed_timeouts = completed_timeouts->next; |
1790 emacs_event->event_type = timeout_event; | 1965 emacs_event->event_type = timeout_event; |
1947 xfree (closure); | 2122 xfree (closure); |
1948 filedesc_to_what_closure[fd] = 0; | 2123 filedesc_to_what_closure[fd] = 0; |
1949 } | 2124 } |
1950 | 2125 |
1951 static void | 2126 static void |
1952 emacs_Xt_select_process (struct Lisp_Process *p) | 2127 emacs_Xt_select_process (Lisp_Process *p) |
1953 { | 2128 { |
1954 Lisp_Object process; | 2129 Lisp_Object process; |
1955 int infd = event_stream_unixoid_select_process (p); | 2130 int infd = event_stream_unixoid_select_process (p); |
1956 | 2131 |
1957 XSETPROCESS (process, p); | 2132 XSETPROCESS (process, p); |
1958 select_filedesc (infd, process); | 2133 select_filedesc (infd, process); |
1959 } | 2134 } |
1960 | 2135 |
1961 static void | 2136 static void |
1962 emacs_Xt_unselect_process (struct Lisp_Process *p) | 2137 emacs_Xt_unselect_process (Lisp_Process *p) |
1963 { | 2138 { |
1964 int infd = event_stream_unixoid_unselect_process (p); | 2139 int infd = event_stream_unixoid_unselect_process (p); |
1965 | 2140 |
1966 unselect_filedesc (infd); | 2141 unselect_filedesc (infd); |
1967 } | 2142 } |
1986 | 2161 |
1987 /* This is called from GC when a process object is about to be freed. | 2162 /* This is called from GC when a process object is about to be freed. |
1988 If we've still got pointers to it in this file, we're gonna lose hard. | 2163 If we've still got pointers to it in this file, we're gonna lose hard. |
1989 */ | 2164 */ |
1990 void | 2165 void |
1991 debug_process_finalization (struct Lisp_Process *p) | 2166 debug_process_finalization (Lisp_Process *p) |
1992 { | 2167 { |
1993 #if 0 /* #### */ | 2168 #if 0 /* #### */ |
1994 int i; | 2169 int i; |
1995 Lisp_Object instr, outstr; | 2170 Lisp_Object instr, outstr; |
1996 | 2171 |
2006 } | 2181 } |
2007 #endif | 2182 #endif |
2008 } | 2183 } |
2009 | 2184 |
2010 static void | 2185 static void |
2011 Xt_process_to_emacs_event (struct Lisp_Event *emacs_event) | 2186 Xt_process_to_emacs_event (Lisp_Event *emacs_event) |
2012 { | 2187 { |
2013 int i; | 2188 int i; |
2014 | 2189 |
2015 assert (process_events_occurred > 0); | 2190 assert (process_events_occurred > 0); |
2016 | 2191 |
2066 may not really be any input available. (In this case, | 2241 may not really be any input available. (In this case, |
2067 read_event_from_tty_or_stream_desc() will arrange for the TTY device | 2242 read_event_from_tty_or_stream_desc() will arrange for the TTY device |
2068 to be deleted.) */ | 2243 to be deleted.) */ |
2069 | 2244 |
2070 static int | 2245 static int |
2071 Xt_tty_to_emacs_event (struct Lisp_Event *emacs_event) | 2246 Xt_tty_to_emacs_event (Lisp_Event *emacs_event) |
2072 { | 2247 { |
2073 int i; | 2248 int i; |
2074 | 2249 |
2075 assert (tty_events_occurred > 0); | 2250 assert (tty_events_occurred > 0); |
2076 for (i = 0; i < MAXDESC; i++) | 2251 for (i = 0; i < MAXDESC; i++) |
2112 if (f) | 2287 if (f) |
2113 { | 2288 { |
2114 char *buf = alloca_array (char, XSTRING_LENGTH (f->name) + 4); | 2289 char *buf = alloca_array (char, XSTRING_LENGTH (f->name) + 4); |
2115 sprintf (buf, " \"%s\"", XSTRING_DATA (f->name)); | 2290 sprintf (buf, " \"%s\"", XSTRING_DATA (f->name)); |
2116 write_string_to_stdio_stream (stderr, 0, (Bufbyte *) buf, 0, | 2291 write_string_to_stdio_stream (stderr, 0, (Bufbyte *) buf, 0, |
2117 strlen (buf), FORMAT_TERMINAL); | 2292 strlen (buf), Qterminal); |
2118 } | 2293 } |
2119 stderr_out ("\n"); | 2294 stderr_out ("\n"); |
2120 } | 2295 } |
2121 | 2296 |
2122 static CONST char * | 2297 static CONST char * |
2351 | 2526 |
2352 enqueue_Xt_dispatch_event (event); | 2527 enqueue_Xt_dispatch_event (event); |
2353 } | 2528 } |
2354 | 2529 |
2355 static void | 2530 static void |
2356 emacs_Xt_next_event (struct Lisp_Event *emacs_event) | 2531 emacs_Xt_next_event (Lisp_Event *emacs_event) |
2357 { | 2532 { |
2358 we_didnt_get_an_event: | 2533 we_didnt_get_an_event: |
2359 | 2534 |
2360 while (NILP (dispatch_event_queue) && | 2535 while (NILP (dispatch_event_queue) && |
2361 !completed_timeouts && | 2536 !completed_timeouts && |
2736 /* This is exported by the Xt library (at least by mine). If this | 2911 /* This is exported by the Xt library (at least by mine). If this |
2737 isn't the case somewhere, rename this appropriately and remove | 2912 isn't the case somewhere, rename this appropriately and remove |
2738 the '#if 0'. Note, however, that I got "unknown structure" | 2913 the '#if 0'. Note, however, that I got "unknown structure" |
2739 errors when I tried this. */ | 2914 errors when I tried this. */ |
2740 XtConvertArgRec Const colorConvertArgs[] = { | 2915 XtConvertArgRec Const colorConvertArgs[] = { |
2741 {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), | 2916 { XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), |
2742 sizeof(Screen *)}, | 2917 sizeof (Screen *) }, |
2743 {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), | 2918 { XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), |
2744 sizeof(Colormap)} | 2919 sizeof (Colormap) } |
2745 }; | 2920 }; |
2746 | 2921 |
2747 #endif | 2922 #endif |
2748 | 2923 |
2749 #define done(type, value) \ | 2924 #define done(type, value) \ |
2889 void | 3064 void |
2890 syms_of_event_Xt (void) | 3065 syms_of_event_Xt (void) |
2891 { | 3066 { |
2892 defsymbol (&Qkey_mapping, "key-mapping"); | 3067 defsymbol (&Qkey_mapping, "key-mapping"); |
2893 defsymbol (&Qsans_modifiers, "sans-modifiers"); | 3068 defsymbol (&Qsans_modifiers, "sans-modifiers"); |
3069 defsymbol (&Qself_insert_command, "self-insert-command"); | |
2894 } | 3070 } |
2895 | 3071 |
2896 void | 3072 void |
2897 reinit_vars_of_event_Xt (void) | 3073 reinit_vars_of_event_Xt (void) |
2898 { | 3074 { |