Mercurial > hg > xemacs-beta
comparison src/events.c @ 183:e121b013d1f0 r20-3b18
Import from CVS: tag r20-3b18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:54:23 +0200 |
parents | 8eaf7971accc |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
182:f07455f06202 | 183:e121b013d1f0 |
---|---|
264 !NILP (Fequal (e1->event.magic_eval.object, | 264 !NILP (Fequal (e1->event.magic_eval.object, |
265 e2->event.magic_eval.object))); | 265 e2->event.magic_eval.object))); |
266 | 266 |
267 case magic_event: | 267 case magic_event: |
268 { | 268 { |
269 Lisp_Object console; | 269 struct console *con = XCONSOLE (CDFW_CONSOLE (e1->channel)); |
270 | |
271 console = CDFW_CONSOLE (e1->channel); | |
272 | 270 |
273 #ifdef HAVE_X_WINDOWS | 271 #ifdef HAVE_X_WINDOWS |
274 /* XEvent is actually a union which means that we can't just use == */ | 272 if (CONSOLE_X_P (con)) |
275 if (CONSOLE_X_P (XCONSOLE (console))) | 273 return (e1->event.magic.underlying_x_event.xany.serial == |
276 return !memcmp ((XEvent *) &e1->event.magic.underlying_x_event, | 274 e2->event.magic.underlying_x_event.xany.serial); |
277 (XEvent *) &e2->event.magic.underlying_x_event, | |
278 sizeof (e1->event.magic.underlying_x_event)); | |
279 #endif | 275 #endif |
280 #ifdef HAVE_TTY | 276 #ifdef HAVE_TTY |
281 if (CONSOLE_TTY_P (XCONSOLE (console))) | 277 if (CONSOLE_TTY_P (con)) |
282 return (e1->event.magic.underlying_tty_event == | 278 return (e1->event.magic.underlying_tty_event == |
283 e2->event.magic.underlying_tty_event); | 279 e2->event.magic.underlying_tty_event); |
284 #endif | 280 #endif |
285 return 1; | 281 return 1; /* not reached */ |
286 } | 282 } |
287 | 283 |
288 case empty_event: /* Empty and deallocated events are equal. */ | 284 case empty_event: /* Empty and deallocated events are equal. */ |
289 case dead_event: | 285 case dead_event: |
290 return 1; | 286 return 1; |
332 (unsigned long) e->event.magic_eval.internal_function, | 328 (unsigned long) e->event.magic_eval.internal_function, |
333 internal_hash (e->event.magic_eval.object, depth + 1)); | 329 internal_hash (e->event.magic_eval.object, depth + 1)); |
334 | 330 |
335 case magic_event: | 331 case magic_event: |
336 { | 332 { |
337 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (e)); | 333 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e))); |
338 #ifdef HAVE_X_WINDOWS | 334 #ifdef HAVE_X_WINDOWS |
339 if (CONSOLE_X_P (XCONSOLE (console))) | 335 if (CONSOLE_X_P (con)) |
340 return | 336 return HASH2 (hash, e->event.magic.underlying_x_event.xany.serial); |
341 HASH2 (hash, | |
342 memory_hash (&e->event.magic.underlying_x_event, | |
343 sizeof (e->event.magic.underlying_x_event))); | |
344 #endif | 337 #endif |
345 return | 338 #ifdef HAVE_TTY |
346 HASH2 (hash, | 339 if (CONSOLE_TTY_P (con)) |
347 memory_hash (&e->event.magic.underlying_tty_event, | 340 return HASH2 (hash, e->event.magic.underlying_tty_event); |
348 sizeof (e->event.magic.underlying_tty_event))); | 341 #endif |
349 } | 342 } |
350 | 343 |
351 case empty_event: | 344 case empty_event: |
352 case dead_event: | 345 case dead_event: |
353 return hash; | 346 return hash; |
354 | 347 |
355 default: | 348 default: |
356 abort (); | 349 abort (); |
357 } | 350 } |
358 | 351 |
359 return 0; | 352 return 0; /* unreached */ |
360 } | 353 } |
361 | 354 |
362 | 355 |
363 /* #### This should accept a type and props (as returned by | 356 /* #### This should accept a type and props (as returned by |
364 event-properties) to allow creation of any type of event. | 357 event-properties) to allow creation of any type of event. |
922 key = make_char (event->event.button.button + '0'); | 915 key = make_char (event->event.button.button + '0'); |
923 break; | 916 break; |
924 } | 917 } |
925 case magic_event: | 918 case magic_event: |
926 { | 919 { |
927 CONST char *name = 0; | 920 CONST char *name = NULL; |
928 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); | |
929 | 921 |
930 #ifdef HAVE_X_WINDOWS | 922 #ifdef HAVE_X_WINDOWS |
931 if (CONSOLE_X_P (XCONSOLE (console))) | 923 { |
932 name = | 924 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); |
933 x_event_name (event->event.magic.underlying_x_event.xany.type); | 925 if (CONSOLE_X_P (XCONSOLE (console))) |
934 #endif | 926 name = x_event_name (event->event.magic.underlying_x_event.type); |
927 } | |
928 #endif /* HAVE_X_WINDOWS */ | |
935 if (name) strcpy (buf, name); | 929 if (name) strcpy (buf, name); |
936 else strcpy (buf, "???"); | 930 else strcpy (buf, "???"); |
937 return; | 931 return; |
938 } | 932 } |
939 case magic_eval_event: strcpy (buf, "magic-eval"); return; | 933 case magic_eval_event: strcpy (buf, "magic-eval"); return; |
940 case pointer_motion_event: strcpy (buf, "motion"); return; | 934 case pointer_motion_event: strcpy (buf, "motion"); return; |
941 case misc_user_event: strcpy (buf, "misc-user"); return; | 935 case misc_user_event: strcpy (buf, "misc-user"); return; |
942 case eval_event: strcpy (buf, "eval"); return; | 936 case eval_event: strcpy (buf, "eval"); return; |
943 case process_event: strcpy (buf, "process");return; | 937 case process_event: strcpy (buf, "process"); return; |
944 case timeout_event: strcpy (buf, "timeout");return; | 938 case timeout_event: strcpy (buf, "timeout"); return; |
945 case empty_event: strcpy (buf, "empty"); return; | 939 case empty_event: strcpy (buf, "empty"); return; |
946 case dead_event: strcpy (buf, "DEAD-EVENT"); return; | 940 case dead_event: strcpy (buf, "DEAD-EVENT"); return; |
947 default: | 941 default: |
948 abort (); | 942 abort (); |
949 } | 943 } |
950 #define modprint1(x) { strcpy (buf, (x)); buf += sizeof (x)-1; } | 944 #define modprint1(x) { strcpy (buf, (x)); buf += sizeof (x)-1; } |
951 #define modprint(x,y) { if (brief) modprint1 (y) else modprint1 (x) } | 945 #define modprint(x,y) { if (brief) modprint1 (y) else modprint1 (x) } |
987 memcpy (buf, str, i+1); | 981 memcpy (buf, str, i+1); |
988 str += i; | 982 str += i; |
989 } | 983 } |
990 else | 984 else |
991 { | 985 { |
992 memcpy (buf, string_data (XSYMBOL (key)->name), | 986 struct Lisp_String *name = XSYMBOL (key)->name; |
993 string_length (XSYMBOL (key)->name) + 1); | 987 memcpy (buf, string_data (name), string_length (name) + 1); |
994 str += string_length (XSYMBOL (key)->name); | 988 str += string_length (name); |
995 } | 989 } |
996 } | 990 } |
997 else | 991 else |
998 abort (); | 992 abort (); |
999 if (mouse_p) | 993 if (mouse_p) |
1155 #endif /* !HAVE_WINDOW_SYSTEM */ | 1149 #endif /* !HAVE_WINDOW_SYSTEM */ |
1156 } | 1150 } |
1157 | 1151 |
1158 DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /* | 1152 DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /* |
1159 Return a number representing the modifier keys which were down | 1153 Return a number representing the modifier keys which were down |
1160 when the given mouse or keyboard event was produced. See also the function | 1154 when the given mouse or keyboard event was produced. |
1161 event-modifiers. | 1155 See also the function event-modifiers. |
1162 */ | 1156 */ |
1163 (event)) | 1157 (event)) |
1164 { | 1158 { |
1165 again: | 1159 again: |
1166 CHECK_LIVE_EVENT (event); | 1160 CHECK_LIVE_EVENT (event); |
1167 if (XEVENT (event)->event_type == key_press_event) | 1161 switch (XEVENT (event)->event_type) |
1168 return make_int (XEVENT (event)->event.key.modifiers); | 1162 { |
1169 else if (XEVENT (event)->event_type == button_press_event || | 1163 case key_press_event: |
1170 XEVENT (event)->event_type == button_release_event) | 1164 return make_int (XEVENT (event)->event.key.modifiers); |
1171 return make_int (XEVENT (event)->event.button.modifiers); | 1165 case button_press_event: |
1172 else if (XEVENT (event)->event_type == pointer_motion_event) | 1166 case button_release_event: |
1173 return make_int (XEVENT (event)->event.motion.modifiers); | 1167 return make_int (XEVENT (event)->event.button.modifiers); |
1174 else | 1168 case pointer_motion_event: |
1175 { | 1169 return make_int (XEVENT (event)->event.motion.modifiers); |
1170 default: | |
1176 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); | 1171 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); |
1177 goto again; | 1172 goto again; |
1178 } | 1173 } |
1179 } | 1174 } |
1180 | 1175 |