comparison src/events.c @ 430:a5df635868b2 r21-2-23

Import from CVS: tag r21-2-23
author cvs
date Mon, 13 Aug 2007 11:29:08 +0200
parents 3ecd8885ac67
children 84b14dcb0985
comparison
equal deleted inserted replaced
429:8305706cbb93 430:a5df635868b2
761 761
762 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /* 762 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /*
763 Make a copy of the given event object. 763 Make a copy of the given event object.
764 If a second argument is given, the first event is copied into the second 764 If a second argument is given, the first event is copied into the second
765 and the second is returned. If the second argument is not supplied (or 765 and the second is returned. If the second argument is not supplied (or
766 is nil) then a new event will be made as with `allocate-event.' See also 766 is nil) then a new event will be made as with `make-event'. See also
767 the function `deallocate-event'. 767 the function `deallocate-event'.
768 */ 768 */
769 (event1, event2)) 769 (event1, event2))
770 { 770 {
771 CHECK_LIVE_EVENT (event1); 771 CHECK_LIVE_EVENT (event1);
772 if (NILP (event2)) 772 if (NILP (event2))
773 event2 = Fmake_event (Qnil, Qnil); 773 event2 = Fmake_event (Qnil, Qnil);
774 else CHECK_LIVE_EVENT (event2); 774 else
775 if (EQ (event1, event2)) 775 {
776 return signal_simple_continuable_error_2 776 CHECK_LIVE_EVENT (event2);
777 ("copy-event called with `eq' events", event1, event2); 777 if (EQ (event1, event2))
778 return signal_simple_continuable_error_2
779 ("copy-event called with `eq' events", event1, event2);
780 }
778 781
779 assert (XEVENT_TYPE (event1) <= last_event_type); 782 assert (XEVENT_TYPE (event1) <= last_event_type);
780 assert (XEVENT_TYPE (event2) <= last_event_type); 783 assert (XEVENT_TYPE (event2) <= last_event_type);
781 784
782 { 785 {
783 Lisp_Object save_next = XEVENT_NEXT (event2); 786 Lisp_Event *ev2 = XEVENT (event2);
784 787 Lisp_Event *ev1 = XEVENT (event1);
785 *XEVENT (event2) = *XEVENT (event1); 788
786 XSET_EVENT_NEXT (event2, save_next); 789 ev2->event_type = ev1->event_type;
790 ev2->channel = ev1->channel;
791 ev2->timestamp = ev1->timestamp;
792 ev2->event = ev1->event;
793
787 return event2; 794 return event2;
788 } 795 }
789 } 796 }
790 797
791 798