Mercurial > hg > xemacs-beta
comparison src/events.c @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 3742ea8250b5 2fd201d73a92 |
children | 623d57b7fbe8 |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
222 { XD_END } | 222 { XD_END } |
223 }; | 223 }; |
224 | 224 |
225 #ifdef EVENT_DATA_AS_OBJECTS | 225 #ifdef EVENT_DATA_AS_OBJECTS |
226 | 226 |
227 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("key-data", key_data, | 227 DEFINE_NODUMP_BASIC_LISP_OBJECT ("key-data", key_data, |
228 0, 0, 0, 0, 0, | 228 0, 0, 0, 0, 0, |
229 key_data_description, | 229 key_data_description, |
230 Lisp_Key_Data); | 230 Lisp_Key_Data); |
231 | 231 |
232 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("button-data", button_data, | 232 DEFINE_NODUMP_BASIC_LISP_OBJECT ("button-data", button_data, |
233 0, 0, 0, 0, 0, | 233 0, 0, 0, 0, 0, |
234 button_data_description, | 234 button_data_description, |
235 Lisp_Button_Data); | 235 Lisp_Button_Data); |
236 | 236 |
237 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("motion-data", motion_data, | 237 DEFINE_NODUMP_BASIC_LISP_OBJECT ("motion-data", motion_data, |
238 0, 0, 0, 0, 0, | 238 0, 0, 0, 0, 0, |
239 motion_data_description, | 239 motion_data_description, |
240 Lisp_Motion_Data); | 240 Lisp_Motion_Data); |
241 | 241 |
242 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("process-data", process_data, | 242 DEFINE_NODUMP_BASIC_LISP_OBJECT ("process-data", process_data, |
243 0, 0, 0, 0, 0, | 243 0, 0, 0, 0, 0, |
244 process_data_description, | 244 process_data_description, |
245 Lisp_Process_Data); | 245 Lisp_Process_Data); |
246 | 246 |
247 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("timeout-data", timeout_data, | 247 DEFINE_NODUMP_BASIC_LISP_OBJECT ("timeout-data", timeout_data, |
248 0, 0, 0, 0, 0, | 248 0, 0, 0, 0, 0, |
249 timeout_data_description, | 249 timeout_data_description, |
250 Lisp_Timeout_Data); | 250 Lisp_Timeout_Data); |
251 | 251 |
252 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("eval-data", eval_data, | 252 DEFINE_NODUMP_BASIC_LISP_OBJECT ("eval-data", eval_data, |
253 0, 0, 0, 0, 0, | 253 0, 0, 0, 0, 0, |
254 eval_data_description, | 254 eval_data_description, |
255 Lisp_Eval_Data); | 255 Lisp_Eval_Data); |
256 | 256 |
257 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("misc-user-data", misc_user_data, | 257 DEFINE_NODUMP_BASIC_LISP_OBJECT ("misc-user-data", misc_user_data, |
258 0, 0, 0, 0, 0, | 258 0, 0, 0, 0, 0, |
259 misc_user_data_description, | 259 misc_user_data_description, |
260 Lisp_Misc_User_Data); | 260 Lisp_Misc_User_Data); |
261 | 261 |
262 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("magic-eval-data", magic_eval_data, | 262 DEFINE_NODUMP_BASIC_LISP_OBJECT ("magic-eval-data", magic_eval_data, |
263 0, 0, 0, 0, 0, | 263 0, 0, 0, 0, 0, |
264 magic_eval_data_description, | 264 magic_eval_data_description, |
265 Lisp_Magic_Eval_Data); | 265 Lisp_Magic_Eval_Data); |
266 | 266 |
267 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("magic-data", magic_data, | 267 DEFINE_NODUMP_BASIC_LISP_OBJECT ("magic-data", magic_data, |
268 0, 0, 0, 0, 0, | 268 0, 0, 0, 0, 0, |
269 magic_data_description, | 269 magic_data_description, |
270 Lisp_Magic_Data); | 270 Lisp_Magic_Data); |
271 | 271 |
272 #endif /* EVENT_DATA_AS_OBJECTS */ | 272 #endif /* EVENT_DATA_AS_OBJECTS */ |
507 } | 507 } |
508 | 508 |
509 return 0; /* unreached */ | 509 return 0; /* unreached */ |
510 } | 510 } |
511 | 511 |
512 DEFINE_NONDUMPABLE_BASIC_LISP_OBJECT ("event", event, | 512 DEFINE_NODUMP_FROB_BLOCK_LISP_OBJECT ("event", event, |
513 mark_event, print_event, 0, | 513 mark_event, print_event, 0, |
514 event_equal, event_hash, | 514 event_equal, event_hash, |
515 event_description, | 515 event_description, |
516 Lisp_Event); | 516 Lisp_Event); |
517 | 517 |
518 DEFUN ("make-event", Fmake_event, 0, 2, 0, /* | 518 DEFUN ("make-event", Fmake_event, 0, 2, 0, /* |
519 Return a new event of type TYPE, with properties described by PLIST. | 519 Return a new event of type TYPE, with properties described by PLIST. |
520 | 520 |
521 TYPE is a symbol, either `empty', `key-press', `button-press', | 521 TYPE is a symbol, either `empty', `key-press', `button-press', |
1184 default: | 1184 default: |
1185 return 0; | 1185 return 0; |
1186 } | 1186 } |
1187 } | 1187 } |
1188 | 1188 |
1189 /* USE_CONSOLE_META_FLAG is as in `character-to-event'. | 1189 /* META_BEHAVIOR can be one of the following values, defined in events.h: |
1190 | |
1191 high_bit_is_meta | |
1192 use_console_meta_flag | |
1193 latin_1_maps_to_itself | |
1194 | |
1190 DO_BACKSPACE_MAPPING means that if CON is a TTY, and C is a the TTY's | 1195 DO_BACKSPACE_MAPPING means that if CON is a TTY, and C is a the TTY's |
1191 backspace character, the event will have keysym `backspace' instead of | 1196 backspace character, the event will have keysym `backspace' instead of |
1192 '(control h). It is clearly correct to do this conversion is the | 1197 '(control h). It is clearly correct to do this conversion is the |
1193 character was just read from a TTY, clearly incorrect inside of | 1198 character was just read from a TTY, clearly incorrect inside of |
1194 define-key, which must be able to handle all consoles. #### What about | 1199 define-key, which must be able to handle all consoles. #### What about |
1234 mappings. Of course, feedback from users of the Russian C-x facility | 1239 mappings. Of course, feedback from users of the Russian C-x facility |
1235 is still needed. */ | 1240 is still needed. */ |
1236 | 1241 |
1237 void | 1242 void |
1238 character_to_event (Ichar c, Lisp_Event *event, struct console *con, | 1243 character_to_event (Ichar c, Lisp_Event *event, struct console *con, |
1239 int use_console_meta_flag, | 1244 character_to_event_meta_behavior meta_behavior, |
1240 int USED_IF_TTY (do_backspace_mapping)) | 1245 int USED_IF_TTY (do_backspace_mapping)) |
1241 { | 1246 { |
1242 Lisp_Object k = Qnil; | 1247 Lisp_Object k = Qnil; |
1243 int m = 0; | 1248 int m = 0; |
1244 if (EVENT_TYPE (event) == dead_event) | 1249 if (EVENT_TYPE (event) == dead_event) |
1245 invalid_argument ("character-to-event called with a deallocated event!", Qunbound); | 1250 invalid_argument ("character-to-event called with a deallocated event!", Qunbound); |
1246 | 1251 |
1247 #ifndef MULE | 1252 #ifndef MULE |
1248 c &= 255; | 1253 c &= 255; |
1249 #endif | 1254 #endif |
1250 if (c > 127 && c <= 255) | 1255 if (meta_behavior != latin_1_maps_to_itself && c > 127 && c <= 255) |
1251 { | 1256 { |
1252 /* #### What if the user wanted a Latin-1 char? Perhaps the answer | |
1253 is what was suggested above. | |
1254 */ | |
1255 int meta_flag = 1; | 1257 int meta_flag = 1; |
1256 if (use_console_meta_flag && CONSOLE_TTY_P (con)) | 1258 if (meta_behavior == use_console_meta_flag && CONSOLE_TTY_P (con)) |
1257 meta_flag = TTY_FLAGS (con).meta_key; | 1259 meta_flag = TTY_FLAGS (con).meta_key; |
1258 switch (meta_flag) | 1260 switch (meta_flag) |
1259 { | 1261 { |
1260 case 0: /* ignore top bit; it's parity */ | 1262 case 0: /* ignore top bit; it's parity */ |
1261 c -= 128; | 1263 c -= 128; |
1440 | 1442 |
1441 Beware that character-to-event and event-to-character are not strictly | 1443 Beware that character-to-event and event-to-character are not strictly |
1442 inverse functions, since events contain much more information than the | 1444 inverse functions, since events contain much more information than the |
1443 Lisp character object type can encode. | 1445 Lisp character object type can encode. |
1444 */ | 1446 */ |
1445 (keystroke, event, console, use_console_meta_flag)) | 1447 (keystroke, event, console, use_console_meta_flag_)) |
1446 { | 1448 { |
1447 struct console *con = decode_console (console); | 1449 struct console *con = decode_console (console); |
1448 if (NILP (event)) | 1450 if (NILP (event)) |
1449 event = Fmake_event (Qnil, Qnil); | 1451 event = Fmake_event (Qnil, Qnil); |
1450 else | 1452 else |
1453 key_desc_list_to_event (keystroke, event, 1); | 1455 key_desc_list_to_event (keystroke, event, 1); |
1454 else | 1456 else |
1455 { | 1457 { |
1456 CHECK_CHAR_COERCE_INT (keystroke); | 1458 CHECK_CHAR_COERCE_INT (keystroke); |
1457 character_to_event (XCHAR (keystroke), XEVENT (event), con, | 1459 character_to_event (XCHAR (keystroke), XEVENT (event), con, |
1458 !NILP (use_console_meta_flag), 1); | 1460 (NILP (use_console_meta_flag_) ? |
1461 high_bit_is_meta : use_console_meta_flag), 1); | |
1459 } | 1462 } |
1460 return event; | 1463 return event; |
1461 } | 1464 } |
1462 | 1465 |
1463 void | 1466 void |
2639 | 2642 |
2640 void | 2643 void |
2641 reinit_vars_of_events (void) | 2644 reinit_vars_of_events (void) |
2642 { | 2645 { |
2643 Vevent_resource = Qnil; | 2646 Vevent_resource = Qnil; |
2647 #ifdef NEW_GC | |
2648 staticpro (&Vevent_resource); | |
2649 #endif /* NEW_GC */ | |
2644 } | 2650 } |
2645 | 2651 |
2646 void | 2652 void |
2647 vars_of_events (void) | 2653 vars_of_events (void) |
2648 { | 2654 { |