comparison 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
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
1 /* Events: printing them, converting them to and from characters. 1 /* Events: printing them, converting them to and from characters.
2 Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 2 Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. 3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
4 Copyright (C) 2001 Ben Wing.
4 5
5 This file is part of XEmacs. 6 This file is part of XEmacs.
6 7
7 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
53 Lisp_Object Qprocess_event_p; 54 Lisp_Object Qprocess_event_p;
54 55
55 Lisp_Object Qkey_press, Qbutton_press, Qbutton_release, Qmisc_user; 56 Lisp_Object Qkey_press, Qbutton_press, Qbutton_release, Qmisc_user;
56 Lisp_Object Qascii_character; 57 Lisp_Object Qascii_character;
57 58
58 EXFUN (Fevent_x_pixel, 1); 59
59 EXFUN (Fevent_y_pixel, 1); 60 /************************************************************************/
61 /* definition of event object */
62 /************************************************************************/
60 63
61 /* #### Ad-hoc hack. Should be part of define_lrecord_implementation */ 64 /* #### Ad-hoc hack. Should be part of define_lrecord_implementation */
62 void 65 void
63 clear_event_resource (void) 66 clear_event_resource (void)
64 { 67 {
377 380
378 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event, 381 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
379 mark_event, print_event, 0, event_equal, 382 mark_event, print_event, 0, event_equal,
380 event_hash, 0, Lisp_Event); 383 event_hash, 0, Lisp_Event);
381 384
382
383 DEFUN ("make-event", Fmake_event, 0, 2, 0, /* 385 DEFUN ("make-event", Fmake_event, 0, 2, 0, /*
384 Return a new event of type TYPE, with properties described by PLIST. 386 Return a new event of type TYPE, with properties described by PLIST.
385 387
386 TYPE is a symbol, either `empty', `key-press', `button-press', 388 TYPE is a symbol, either `empty', `key-press', `button-press',
387 `button-release', `misc-user' or `motion'. If TYPE is nil, it 389 `button-release', `misc-user' or `motion'. If TYPE is nil, it
807 return event2; 809 return event2;
808 } 810 }
809 } 811 }
810 812
811 813
814 /************************************************************************/
815 /* event chain functions */
816 /************************************************************************/
812 817
813 /* Given a chain of events (or possibly nil), deallocate them all. */ 818 /* Given a chain of events (or possibly nil), deallocate them all. */
814 819
815 void 820 void
816 deallocate_event_chain (Lisp_Object event_chain) 821 deallocate_event_chain (Lisp_Object event_chain)
943 n--; 948 n--;
944 } 949 }
945 return Qnil; 950 return Qnil;
946 } 951 }
947 952
953 /* Return a freshly allocated copy of all events in the given chain. */
954
948 Lisp_Object 955 Lisp_Object
949 copy_event_chain (Lisp_Object event_chain) 956 copy_event_chain (Lisp_Object event_chain)
950 { 957 {
951 Lisp_Object new_chain = Qnil; 958 Lisp_Object new_chain = Qnil;
952 Lisp_Object new_chain_tail = Qnil; 959 Lisp_Object new_chain_tail = Qnil;
959 } 966 }
960 967
961 return new_chain; 968 return new_chain;
962 } 969 }
963 970
971 /* Given a pointer (maybe nil) into an old chain (also maybe nil, if
972 pointer is nil) and a new chain which is a copy of the old, return
973 the corresponding new pointer. */
974 Lisp_Object
975 transfer_event_chain_pointer (Lisp_Object pointer, Lisp_Object old_chain,
976 Lisp_Object new_chain)
977 {
978 if (NILP (pointer))
979 return Qnil;
980 assert (!NILP (old_chain));
981 #ifdef ERROR_CHECK_TYPECHECK
982 /* make sure we're actually in the chain */
983 event_chain_find_previous (old_chain, pointer);
984 assert (event_chain_count (old_chain) == event_chain_count (new_chain));
985 #endif /* ERROR_CHECK_TYPECHECK */
986 return event_chain_nth (new_chain,
987 event_chain_count (old_chain) -
988 event_chain_count (pointer));
989 }
990
964 991
992 /************************************************************************/
993 /* higher level functions */
994 /************************************************************************/
965 995
966 Lisp_Object QKbackspace, QKtab, QKlinefeed, QKreturn, QKescape, 996 Lisp_Object QKbackspace, QKtab, QKlinefeed, QKreturn, QKescape,
967 QKspace, QKdelete; 997 QKspace, QKdelete;
968 998
969 int 999 int
1045 else if (c == ' ') 1075 else if (c == ' ')
1046 k = QKspace; 1076 k = QKspace;
1047 1077
1048 event->event_type = key_press_event; 1078 event->event_type = key_press_event;
1049 event->timestamp = 0; /* #### */ 1079 event->timestamp = 0; /* #### */
1050 event->channel = make_console (con); 1080 event->channel = wrap_console (con);
1051 event->event.key.keysym = (!NILP (k) ? k : make_char (c)); 1081 event->event.key.keysym = (!NILP (k) ? k : make_char (c));
1052 event->event.key.modifiers = m; 1082 event->event.key.modifiers = m;
1053 } 1083 }
1054 1084
1055 /* This variable controls what character name -> character code mapping 1085 /* This variable controls what character name -> character code mapping