Mercurial > hg > xemacs-beta
comparison src/events.c @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | 0784d089fdc9 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
760 #endif | 760 #endif |
761 return Qnil; | 761 return Qnil; |
762 } | 762 } |
763 | 763 |
764 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /* | 764 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /* |
765 Make a copy of the given event object. | 765 Make a copy of the event object EVENT1. |
766 If a second argument is given, the first event is copied into the second | 766 If a second event argument EVENT2 is given, EVENT1 is copied into |
767 and the second is returned. If the second argument is not supplied (or | 767 EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil) |
768 is nil) then a new event will be made as with `make-event'. See also | 768 then a new event will be made as with `make-event'. See also the |
769 the function `deallocate-event'. | 769 function `deallocate-event'. |
770 */ | 770 */ |
771 (event1, event2)) | 771 (event1, event2)) |
772 { | 772 { |
773 CHECK_LIVE_EVENT (event1); | 773 CHECK_LIVE_EVENT (event1); |
774 if (NILP (event2)) | 774 if (NILP (event2)) |
1143 !NILP (allow_non_ascii)); | 1143 !NILP (allow_non_ascii)); |
1144 return c < 0 ? Qnil : make_char (c); | 1144 return c < 0 ? Qnil : make_char (c); |
1145 } | 1145 } |
1146 | 1146 |
1147 DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /* | 1147 DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /* |
1148 Convert keystroke CH into an event structure ,replete with bucky bits. | 1148 Convert KEY-DESCRIPTION into an event structure, replete with bucky bits. |
1149 The keystroke is the first argument, and the event to fill | 1149 |
1150 in is the second. This function contains knowledge about what the codes | 1150 KEY-DESCRIPTION is the first argument, and the event to fill in is the |
1151 ``mean'' -- for example, the number 9 is converted to the character ``Tab'', | 1151 second. This function contains knowledge about what various kinds of |
1152 not the distinct character ``Control-I''. | 1152 arguments ``mean'' -- for example, the number 9 is converted to the |
1153 | 1153 character ``Tab'', not the distinct character ``Control-I''. |
1154 Note that CH (the keystroke specifier) can be an integer, a character, | 1154 |
1155 a symbol such as 'clear, or a list such as '(control backspace). | 1155 KEY-DESCRIPTION can be an integer, a character, a symbol such as 'clear, |
1156 | 1156 or a list such as '(control backspace). |
1157 If the optional second argument is an event, it is modified; | 1157 |
1158 otherwise, a new event object is created. | 1158 If the optional second argument EVENT is an event, it is modified and |
1159 returned; otherwise, a new event object is created and returned. | |
1159 | 1160 |
1160 Optional third arg CONSOLE is the console to store in the event, and | 1161 Optional third arg CONSOLE is the console to store in the event, and |
1161 defaults to the selected console. | 1162 defaults to the selected console. |
1162 | 1163 |
1163 If CH is an integer or character, the high bit may be interpreted as the | 1164 If KEY-DESCRIPTION is an integer or character, the high bit may be |
1164 meta key. (This is done for backward compatibility in lots of places.) | 1165 interpreted as the meta key. (This is done for backward compatibility |
1165 If USE-CONSOLE-META-FLAG is nil, this will always be the case. If | 1166 in lots of places.) If USE-CONSOLE-META-FLAG is nil, this will always |
1166 USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for CONSOLE affects | 1167 be the case. If USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for |
1167 whether the high bit is interpreted as a meta key. (See `set-input-mode'.) | 1168 CONSOLE affects whether the high bit is interpreted as a meta |
1168 If you don't want this silly meta interpretation done, you should pass | 1169 key. (See `set-input-mode'.) If you don't want this silly meta |
1169 in a list containing the character. | 1170 interpretation done, you should pass in a list containing the |
1171 character. | |
1170 | 1172 |
1171 Beware that character-to-event and event-to-character are not strictly | 1173 Beware that character-to-event and event-to-character are not strictly |
1172 inverse functions, since events contain much more information than the | 1174 inverse functions, since events contain much more information than the |
1173 ASCII character set can encode. | 1175 Lisp character object type can encode. |
1174 */ | 1176 */ |
1175 (ch, event, console, use_console_meta_flag)) | 1177 (keystroke, event, console, use_console_meta_flag)) |
1176 { | 1178 { |
1177 struct console *con = decode_console (console); | 1179 struct console *con = decode_console (console); |
1178 if (NILP (event)) | 1180 if (NILP (event)) |
1179 event = Fmake_event (Qnil, Qnil); | 1181 event = Fmake_event (Qnil, Qnil); |
1180 else | 1182 else |
1181 CHECK_LIVE_EVENT (event); | 1183 CHECK_LIVE_EVENT (event); |
1182 if (CONSP (ch) || SYMBOLP (ch)) | 1184 if (CONSP (keystroke) || SYMBOLP (keystroke)) |
1183 key_desc_list_to_event (ch, event, 1); | 1185 key_desc_list_to_event (keystroke, event, 1); |
1184 else | 1186 else |
1185 { | 1187 { |
1186 CHECK_CHAR_COERCE_INT (ch); | 1188 CHECK_CHAR_COERCE_INT (keystroke); |
1187 character_to_event (XCHAR (ch), XEVENT (event), con, | 1189 character_to_event (XCHAR (keystroke), XEVENT (event), con, |
1188 !NILP (use_console_meta_flag), 1); | 1190 !NILP (use_console_meta_flag), 1); |
1189 } | 1191 } |
1190 return event; | 1192 return event; |
1191 } | 1193 } |
1192 | 1194 |
1525 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p); | 1527 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p); |
1526 return XEVENT (event)->event.key.keysym; | 1528 return XEVENT (event)->event.key.keysym; |
1527 } | 1529 } |
1528 | 1530 |
1529 DEFUN ("event-button", Fevent_button, 1, 1, 0, /* | 1531 DEFUN ("event-button", Fevent_button, 1, 1, 0, /* |
1530 Return the button-number of the given button-press or button-release event. | 1532 Return the button-number of the button-press or button-release event EVENT. |
1531 */ | 1533 */ |
1532 (event)) | 1534 (event)) |
1533 { | 1535 { |
1534 | 1536 |
1535 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event, | 1537 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event, |
2120 return Qnil; | 2122 return Qnil; |
2121 #endif | 2123 #endif |
2122 } | 2124 } |
2123 | 2125 |
2124 DEFUN ("event-process", Fevent_process, 1, 1, 0, /* | 2126 DEFUN ("event-process", Fevent_process, 1, 1, 0, /* |
2125 Return the process of the given process-output event. | 2127 Return the process of the process-output event EVENT. |
2126 */ | 2128 */ |
2127 (event)) | 2129 (event)) |
2128 { | 2130 { |
2129 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); | 2131 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); |
2130 return XEVENT (event)->event.process.process; | 2132 return XEVENT (event)->event.process.process; |