diff src/events.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents fdefd0186b75
children 026c5bf9c134
line wrap: on
line diff
--- a/src/events.c	Fri Mar 08 13:33:14 2002 +0000
+++ b/src/events.c	Wed Mar 13 08:54:06 2002 +0000
@@ -1,6 +1,7 @@
 /* Events: printing them, converting them to and from characters.
    Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
    Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
+   Copyright (C) 2001 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -55,8 +56,10 @@
 Lisp_Object Qkey_press, Qbutton_press, Qbutton_release, Qmisc_user;
 Lisp_Object Qascii_character;
 
-EXFUN (Fevent_x_pixel, 1);
-EXFUN (Fevent_y_pixel, 1);
+
+/************************************************************************/
+/*                       definition of event object                     */
+/************************************************************************/
 
 /* #### Ad-hoc hack.  Should be part of define_lrecord_implementation */
 void
@@ -379,7 +382,6 @@
 				     mark_event, print_event, 0, event_equal,
 				     event_hash, 0, Lisp_Event);
 
-
 DEFUN ("make-event", Fmake_event, 0, 2, 0, /*
 Return a new event of type TYPE, with properties described by PLIST.
 
@@ -809,6 +811,9 @@
 }
 
 
+/************************************************************************/
+/*                          event chain functions                       */
+/************************************************************************/
 
 /* Given a chain of events (or possibly nil), deallocate them all. */
 
@@ -945,6 +950,8 @@
   return Qnil;
 }
 
+/* Return a freshly allocated copy of all events in the given chain. */
+
 Lisp_Object
 copy_event_chain (Lisp_Object event_chain)
 {
@@ -961,7 +968,30 @@
   return new_chain;
 }
 
+/* Given a pointer (maybe nil) into an old chain (also maybe nil, if
+   pointer is nil) and a new chain which is a copy of the old, return
+   the corresponding new pointer. */
+Lisp_Object
+transfer_event_chain_pointer (Lisp_Object pointer, Lisp_Object old_chain,
+			      Lisp_Object new_chain)
+{
+  if (NILP (pointer))
+    return Qnil;
+  assert (!NILP (old_chain));
+#ifdef ERROR_CHECK_TYPECHECK
+  /* make sure we're actually in the chain */
+  event_chain_find_previous (old_chain, pointer);
+  assert (event_chain_count (old_chain) == event_chain_count (new_chain));
+#endif /* ERROR_CHECK_TYPECHECK */
+  return event_chain_nth (new_chain,
+			  event_chain_count (old_chain) -
+			  event_chain_count (pointer));
+}
+
 
+/************************************************************************/
+/*                         higher level functions                       */
+/************************************************************************/
 
 Lisp_Object QKbackspace, QKtab, QKlinefeed, QKreturn, QKescape,
  QKspace, QKdelete;
@@ -1047,7 +1077,7 @@
 
   event->event_type	     = key_press_event;
   event->timestamp	     = 0; /* #### */
-  event->channel	     = make_console (con);
+  event->channel	     = wrap_console (con);
   event->event.key.keysym    = (!NILP (k) ? k : make_char (c));
   event->event.key.modifiers = m;
 }