annotate src/events.c @ 934:c925bacdda60

[xemacs-hg @ 2002-07-29 09:21:12 by michaels] 2002-07-17 Marcus Crestani <crestani@informatik.uni-tuebingen.de> Markus Kaltenbach <makalten@informatik.uni-tuebingen.de> Mike Sperber <mike@xemacs.org> configure flag to turn these changes on: --use-kkcc First we added a dumpable flag to lrecord_implementation. It shows, if the object is dumpable and should be processed by the dumper. * lrecord.h (struct lrecord_implementation): added dumpable flag (MAKE_LRECORD_IMPLEMENTATION): fitted the different makro definitions to the new lrecord_implementation and their calls. Then we changed mark_object, that it no longer needs a mark method for those types that have pdump descritions. * alloc.c: (mark_object): If the object has a description, the new mark algorithm is called, and the object is marked according to its description. Otherwise it uses the mark method like before. These procedures mark objects according to their descriptions. They are modeled on the corresponding pdumper procedures. (mark_with_description): (get_indirect_count): (structure_size): (mark_struct_contents): These procedures still call mark_object, this is needed while there are Lisp_Objects without descriptions left. We added pdump descriptions for many Lisp_Objects: * extents.c: extent_auxiliary_description * database.c: database_description * gui.c: gui_item_description * scrollbar.c: scrollbar_instance_description * toolbar.c: toolbar_button_description * event-stream.c: command_builder_description * mule-charset.c: charset_description * device-msw.c: devmode_description * dialog-msw.c: mswindows_dialog_id_description * eldap.c: ldap_description * postgresql.c: pgconn_description pgresult_description * tooltalk.c: tooltalk_message_description tooltalk_pattern_description * ui-gtk.c: emacs_ffi_description emacs_gtk_object_description * events.c: * events.h: * event-stream.c: * event-Xt.c: * event-gtk.c: * event-tty.c: To write a pdump description for Lisp_Event, we converted every struct in the union event to a Lisp_Object. So we created nine new Lisp_Objects: Lisp_Key_Data, Lisp_Button_Data, Lisp_Motion_Data, Lisp_Process_Data, Lisp_Timeout_Data, Lisp_Eval_Data, Lisp_Misc_User_Data, Lisp_Magic_Data, Lisp_Magic_Eval_Data. We also wrote makro selectors and mutators for the fields of the new designed Lisp_Event and added everywhere these new abstractions. We implemented XD_UNION support in (mark_with_description), so we can describe exspecially console/device specific data with XD_UNION. To describe with XD_UNION, we added a field to these objects, which holds the variant type of the object. This field is initialized in the appendant constructor. The variant is an integer, it has also to be described in an description, if XD_UNION is used. XD_UNION is used in following descriptions: * console.c: console_description (get_console_variant): returns the variant (create_console): added variant initialization * console.h (console_variant): the different console types * console-impl.h (struct console): added enum console_variant contype * device.c: device_description (Fmake_device): added variant initialization * device-impl.h (struct device): added enum console_variant devtype * objects.c: image_instance_description font_instance_description (Fmake_color_instance): added variant initialization (Fmake_font_instance): added variant initialization * objects-impl.h (struct Lisp_Color_Instance): added color_instance_type * objects-impl.h (struct Lisp_Font_Instance): added font_instance_type * process.c: process_description (make_process_internal): added variant initialization * process.h (process_variant): the different process types
author michaels
date Mon, 29 Jul 2002 09:21:25 +0000
parents 79c6ff3eef26
children c891972d07fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Events: printing them, converting them to and from characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
4 Copyright (C) 2001, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* This file has been Mule-ized. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "console.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "device.h"
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
32 #include "extents.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "events.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
34 #include "frame-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "glyphs.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "keymap.h" /* for key_desc_list_to_event() */
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
37 #include "lstream.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "redisplay.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
39 #include "toolbar.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
42 #include "console-tty-impl.h" /* for stuff in character_to_event */
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
43
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
44 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
45 #include "console-x.h"
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
46 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
47
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 /* Where old events go when they are explicitly deallocated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 The event chain here is cut loose before GC, so these will be freed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 eventually.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 static Lisp_Object Vevent_resource;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 Lisp_Object Qeventp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 Lisp_Object Qevent_live_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 Lisp_Object Qkey_press_event_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Lisp_Object Qbutton_event_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 Lisp_Object Qmouse_event_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Lisp_Object Qprocess_event_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 Lisp_Object Qkey_press, Qbutton_press, Qbutton_release, Qmisc_user;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 Lisp_Object Qascii_character;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
64
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
65 /************************************************************************/
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
66 /* definition of event object */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
67 /************************************************************************/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 /* #### Ad-hoc hack. Should be part of define_lrecord_implementation */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 clear_event_resource (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 Vevent_resource = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
76 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
77 /* Make sure we lose quickly if we try to use this event */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
78 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
79 deinitialize_event (Lisp_Object ev)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
80 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
81 Lisp_Event *event = XEVENT (ev);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
82
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
83 set_event_type (event, dead_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
84 SET_EVENT_CHANNEL (event, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
85 set_lheader_implementation (&event->lheader, &lrecord_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
86 XSET_EVENT_NEXT (ev, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
87 XSET_EVENT_DATA (ev, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
88 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
89
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
90 /* Set everything to zero or nil so that it's predictable. */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
91 void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
92 zero_event (Lisp_Event *e)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
93 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
94 SET_EVENT_DATA (e, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
95 set_event_type (e, empty_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
96 SET_EVENT_NEXT (e, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
97 SET_EVENT_CHANNEL (e, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
98 SET_EVENT_TIMESTAMP_ZERO (e);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
99 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
100
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
101 static const struct lrecord_description event_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
102 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, next) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
103 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, channel) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
104 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, event_data) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
105 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
106 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
107
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
108 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
109 mark_event (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
110 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
111 mark_object (XEVENT_DATA(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
112 mark_object (XEVENT_CHANNEL(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
113 return (XEVENT_NEXT(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
114 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
115
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
116
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
117 static const struct lrecord_description key_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
118 { XD_LISP_OBJECT, offsetof (struct Lisp_Key_Data, keysym) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
119 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
120 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
121
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
122 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
123 mark_key_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
124 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
125 return (XKEY_DATA_KEYSYM(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
126 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
127
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
128
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
129 static const struct lrecord_description button_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
130 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
131 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
132
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
133 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
134 mark_button_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
135 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
136 return Qnil;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
137 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
138
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
139
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
140 static const struct lrecord_description motion_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
141 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
142 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
143
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
144 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
145 mark_motion_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
146 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
147 return Qnil;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
148 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
149
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
150
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
151 static const struct lrecord_description process_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
152 { XD_LISP_OBJECT, offsetof (struct Lisp_Process_Data, process) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
153 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
154 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
155
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
156 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
157 mark_process_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
158 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
159 return (XPROCESS_DATA_PROCESS(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
160 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
161
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
162
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
163 static const struct lrecord_description timeout_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
164 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, function) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
165 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, object) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
166 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
167 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
168
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
169 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
170 mark_timeout_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
171 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
172 mark_object (XTIMEOUT_DATA_FUNCTION(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
173 return (XTIMEOUT_DATA_OBJECT(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
174 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
175
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
176
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
177 static const struct lrecord_description eval_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
178 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, function) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
179 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, object) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
180 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
181 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
182
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
183 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
184 mark_eval_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
185 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
186 mark_object (XEVAL_DATA_FUNCTION(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
187 return (XEVAL_DATA_OBJECT(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
188 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
189
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
190
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
191 static const struct lrecord_description misc_user_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
192 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, function) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
193 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, object) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
194 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
195 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
196
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
197 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
198 mark_misc_user_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
199 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
200 mark_object (XMISC_USER_DATA_FUNCTION(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
201 return (XMISC_USER_DATA_OBJECT(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
202 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
203
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
204
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
205 static const struct lrecord_description magic_eval_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
206 { XD_LISP_OBJECT, offsetof (struct Lisp_Magic_Eval_Data, object) },
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
207 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
208 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
209
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
210 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
211 mark_magic_eval_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
212 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
213 return (XMAGIC_EVAL_DATA_OBJECT(obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
214 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
215
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
216
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
217 static const struct lrecord_description magic_data_description [] = {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
218 { XD_END }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
219 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
220
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
221 static Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
222 mark_magic_data (Lisp_Object obj)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
223 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
224 return Qnil;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
225 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
226
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
227
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
228
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
229 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
230 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
231 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
232 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
233 printing_unreadable_object ("#<event>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
234
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
235 switch (XEVENT_TYPE (obj))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
236 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
237 case key_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
238 write_c_string (printcharfun, "#<keypress-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
239 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
240 case button_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
241 write_c_string (printcharfun, "#<buttondown-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
242 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
243 case button_release_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
244 write_c_string (printcharfun, "#<buttonup-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
245 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
246 case magic_eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
247 write_c_string (printcharfun, "#<magic-eval-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
248 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
249 case magic_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
250 write_c_string (printcharfun, "#<magic-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
251 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
252 case pointer_motion_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
253 write_c_string (printcharfun, "#<motion-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
254 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
255 case process_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
256 write_c_string (printcharfun, "#<process-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
257 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
258 case timeout_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
259 write_c_string (printcharfun, "#<timeout-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
260 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
261 case misc_user_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
262 write_c_string (printcharfun, "#<misc-user-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
263 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
264 case eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
265 write_c_string (printcharfun, "#<eval-event ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
266 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
267 case empty_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
268 write_c_string (printcharfun, "#<empty-event>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
269 return;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
270 case dead_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
271 write_c_string (printcharfun, "#<DEALLOCATED-EVENT>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
272 return;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
273 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
274 write_c_string (printcharfun, "#<UNKNOWN-EVENT-TYPE>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
275 return;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
276 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
277
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
278 print_internal (XEVENT_DATA (obj), printcharfun, 1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
279 write_c_string (printcharfun, ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
280 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
281
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
282
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
283 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
284 print_key_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
285 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
286 char buf[128];
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
287 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
288 printing_unreadable_object ("#<key_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
289
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
290 sprintf (buf, "#<key_data ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
291 /* format_event_data_object (buf + 11, obj, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
292 sprintf (buf + strlen (buf), ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
293 write_c_string (printcharfun, buf);*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
294 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
295
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
296 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
297 print_button_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
298 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
299 char buf[128];
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
300 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
301 printing_unreadable_object ("#<button_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
302
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
303 sprintf (buf, "#<button_data ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
304 /* format_event_data_object (buf + 14, obj, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
305 sprintf (buf + strlen (buf), ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
306 write_c_string (printcharfun, buf);*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
307 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
308
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
309
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
310 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
311 print_motion_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
312 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
313 char buf[64];
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
314 Lisp_Object Vx, Vy;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
315
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
316 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
317 printing_unreadable_object ("#<motion_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
318
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
319 Vx = XMOTION_DATA_X (obj);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
320 Vy = XMOTION_DATA_Y (obj);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
321 sprintf (buf, "#<motion-data %ld, %ld>", (long) XINT (Vx), (long) XINT (Vy));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
322 write_c_string (printcharfun, buf);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
323 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
324
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
325
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
326 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
327 print_process_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
328 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
329 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
330 printing_unreadable_object ("#<process_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
331
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
332 write_c_string (print_readably, "#<process-data ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
333 print_internal (XPROCESS_DATA_PROCESS (obj), printcharfun, 1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
334 write_c_string (printcharfun, ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
335 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
336
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
337
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
338 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
339 print_timeout_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
340 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
341 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
342 printing_unreadable_object ("#<timeout_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
343
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
344 write_c_string (printcharfun, "#<timeout-data ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
345 print_internal (XTIMEOUT_DATA_OBJECT (obj), printcharfun, 1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
346 write_c_string (printcharfun, ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
347 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
348
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
349
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
350 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
351 print_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
352 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
353 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
354 printing_unreadable_object ("#<eval_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
355
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
356 write_c_string (printcharfun, "#<eval-data ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
357 print_internal (XEVAL_DATA_FUNCTION (obj), printcharfun, 1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
358 write_c_string (printcharfun, " ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
359 print_internal (XEVAL_DATA_OBJECT (obj), printcharfun, 1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
360 write_c_string (printcharfun, ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
361 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
362
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
363
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
364 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
365 print_misc_user_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
366 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
367 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
368 printing_unreadable_object ("#<misc_user_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
369
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
370 write_c_string (printcharfun, "#<misc-user-data ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
371 print_internal (XMISC_USER_DATA_FUNCTION (obj), printcharfun, 1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
372 write_c_string (printcharfun, " ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
373 print_internal (XMISC_USER_DATA_OBJECT (obj), printcharfun, 1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
374 write_c_string (printcharfun, ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
375 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
376
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
377
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
378 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
379 print_magic_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
380 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
381 // char buf[128];
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
382
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
383 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
384 printing_unreadable_object ("#<magic_eval_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
385
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
386 /* format_event_data_object (buf + 18, obj, 0);*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
387 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
388
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
389
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
390 static void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
391 print_magic_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
392 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
393 char buf[128];
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
394
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
395 if (print_readably)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
396 printing_unreadable_object ("#<magic_data>");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
397
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
398 sprintf (buf, "#<magic-data ");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
399 /* format_event_data_object (buf + 13, obj, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
400 sprintf (buf + strlen (buf), ">");
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
401 write_c_string (print_readably, buf);*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
402 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
403
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
404
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
405 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
406 event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
407 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
408 Lisp_Event *e1 = XEVENT (obj1);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
409 Lisp_Event *e2 = XEVENT (obj2);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
410
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
411 if (EVENT_TYPE (e1) != EVENT_TYPE (e2)) return 0;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
412 if (!EQ (EVENT_CHANNEL (e1), EVENT_CHANNEL (e2))) return 0;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
413 /* if (EVENT_TIMESTAMP (e1) != EVENT_TIMESTAMP (e2)) return 0; */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
414 switch (EVENT_TYPE (e1))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
415 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
416 default: abort ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
417
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
418 case process_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
419 case timeout_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
420 case pointer_motion_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
421 case key_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
422 case button_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
423 case button_release_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
424 case misc_user_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
425 case eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
426 case magic_eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
427 return internal_equal (EVENT_DATA (e1), EVENT_DATA (e2), 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
428
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
429 case magic_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
430 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
431 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
432
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
433 #ifdef HAVE_X_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
434 if (CONSOLE_X_P (con))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
435 return (XMAGIC_DATA_X_EVENT (EVENT_DATA (e1)).xany.serial ==
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
436 XMAGIC_DATA_X_EVENT (EVENT_DATA (e2)).xany.serial);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
437 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
438 #ifdef HAVE_GTK
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
439 if (CONSOLE_GTK_P (con))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
440 return (XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e1)) ==
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
441 XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e2)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
442 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
443 #ifdef HAVE_MS_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
444 if (CONSOLE_MSWINDOWS_P (con))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
445 return (!memcmp(&XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e1)),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
446 &XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e2)),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
447 sizeof (union magic_data)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
448 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
449 abort ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
450 return 1; /* not reached */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
451 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
452
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
453 case empty_event: /* Empty and deallocated events are equal. */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
454 case dead_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
455 return 1;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
456 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
457 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
458
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
459 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
460 key_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
461 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
462 return (EQ (XKEY_DATA_KEYSYM (obj1), XKEY_DATA_KEYSYM (obj2)) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
463 (XKEY_DATA_MODIFIERS (obj1) == XKEY_DATA_MODIFIERS (obj2)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
464 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
465
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
466 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
467 button_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
468 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
469 return (XBUTTON_DATA_BUTTON (obj1) == XBUTTON_DATA_BUTTON (obj2) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
470 XBUTTON_DATA_MODIFIERS (obj1) == XBUTTON_DATA_MODIFIERS (obj2));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
471 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
472
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
473 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
474 motion_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
475 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
476 return (XMOTION_DATA_X (obj1) == XMOTION_DATA_X (obj2) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
477 XMOTION_DATA_Y (obj1) == XMOTION_DATA_Y (obj2));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
478 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
479
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
480 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
481 process_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
482 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
483 return EQ (XPROCESS_DATA_PROCESS (obj1), XPROCESS_DATA_PROCESS (obj2));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
484 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
485
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
486 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
487 timeout_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
488 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
489 return (internal_equal (XTIMEOUT_DATA_FUNCTION (obj1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
490 XTIMEOUT_DATA_FUNCTION (obj2), 0) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
491 internal_equal (XTIMEOUT_DATA_OBJECT (obj1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
492 XTIMEOUT_DATA_OBJECT (obj2), 0));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
493 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
494
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
495 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
496 eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
497 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
498 return (internal_equal (XEVAL_DATA_FUNCTION (obj1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
499 XEVAL_DATA_FUNCTION (obj2), 0) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
500 internal_equal (XEVAL_DATA_OBJECT (obj1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
501 XEVAL_DATA_OBJECT (obj2), 0));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
502 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
503
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
504 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
505 misc_user_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
506 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
507 return (internal_equal (XMISC_USER_DATA_FUNCTION (obj1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
508 XMISC_USER_DATA_FUNCTION (obj2), 0) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
509 internal_equal (XMISC_USER_DATA_OBJECT (obj1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
510 XMISC_USER_DATA_OBJECT (obj2), 0) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
511 /* is this really needed for equality
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
512 or is x and y also important? */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
513 XMISC_USER_DATA_BUTTON (obj1) == XMISC_USER_DATA_BUTTON (obj2) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
514 XMISC_USER_DATA_MODIFIERS (obj1) ==
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
515 XMISC_USER_DATA_MODIFIERS (obj2));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
516 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
517
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
518 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
519 magic_eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
520 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
521 return (XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj1) ==
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
522 XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj2) &&
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
523 internal_equal (XMAGIC_EVAL_DATA_OBJECT (obj1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
524 XMAGIC_EVAL_DATA_OBJECT (obj2), 0));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
525 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
526
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
527 static int
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
528 magic_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
529 {assert (0); return 0;}
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
530
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
531 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
532 event_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
533 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
534 Lisp_Event *e = XEVENT (obj);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
535 unsigned long hash;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
536
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
537 hash = HASH2 (EVENT_TYPE (e), LISP_HASH (EVENT_CHANNEL (e)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
538 switch (EVENT_TYPE (e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
539 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
540 case process_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
541 case timeout_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
542 case key_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
543 case button_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
544 case button_release_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
545 case pointer_motion_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
546 case misc_user_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
547 case eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
548 case magic_eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
549 return HASH2 (hash, internal_hash (EVENT_DATA (e), depth + 1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
550
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
551 case magic_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
552 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
553 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
554 #ifdef HAVE_X_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
555 if (CONSOLE_X_P (con))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
556 return HASH2 (hash, XMAGIC_DATA_X_EVENT (EVENT_DATA (e)).xany.serial);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
557 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
558 #ifdef HAVE_GTK
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
559 if (CONSOLE_GTK_P (con))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
560 return HASH2 (hash, XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
561 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
562 #ifdef HAVE_MS_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
563 if (CONSOLE_MSWINDOWS_P (con))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
564 return HASH2 (hash, XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
565 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
566 abort ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
567 return 0;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
568 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
569
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
570 case empty_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
571 case dead_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
572 return hash;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
573
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
574 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
575 abort ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
576 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
577
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
578 return 0; /* unreached */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
579 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
580
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
581 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
582 key_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
583 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
584 return HASH2 (LISP_HASH (XKEY_DATA_KEYSYM (obj)),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
585 XKEY_DATA_MODIFIERS (obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
586 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
587
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
588 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
589 button_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
590 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
591 return HASH2 (XBUTTON_DATA_BUTTON (obj), XBUTTON_DATA_MODIFIERS (obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
592 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
593
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
594 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
595 motion_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
596 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
597 return HASH2 (XMOTION_DATA_X (obj), XMOTION_DATA_Y (obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
598 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
599
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
600 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
601 process_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
602 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
603 return LISP_HASH (XPROCESS_DATA_PROCESS (obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
604 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
605
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
606 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
607 timeout_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
608 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
609 return HASH2 (internal_hash (XTIMEOUT_DATA_FUNCTION (obj), depth + 1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
610 internal_hash (XTIMEOUT_DATA_OBJECT (obj), depth + 1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
611 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
612
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
613 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
614 eval_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
615 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
616 return HASH2 (internal_hash (XEVAL_DATA_FUNCTION (obj), depth + 1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
617 internal_hash (XEVAL_DATA_OBJECT (obj), depth + 1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
618 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
619
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
620 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
621 misc_user_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
622 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
623 return HASH4 (internal_hash (XMISC_USER_DATA_FUNCTION (obj), depth + 1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
624 internal_hash (XMISC_USER_DATA_OBJECT (obj), depth + 1),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
625 XMISC_USER_DATA_BUTTON (obj), XMISC_USER_DATA_MODIFIERS (obj));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
626 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
627
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
628 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
629 magic_eval_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
630 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
631 return HASH2 ((unsigned long) XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
632 internal_hash (XMAGIC_EVAL_DATA_OBJECT (obj), depth + 1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
633 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
634
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
635 static unsigned long
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
636 magic_data_hash (Lisp_Object obj, int depth)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
637 {assert(0); return 1;}
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
638
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
639 DEFINE_LRECORD_IMPLEMENTATION ("key-data", key_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
640 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
641 mark_key_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
642 print_key_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
643 key_data_equal, key_data_hash, key_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
644 Lisp_Key_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
645
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
646 DEFINE_LRECORD_IMPLEMENTATION ("button-data", button_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
647 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
648 mark_button_data, print_button_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
649 button_data_equal, button_data_hash, button_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
650 Lisp_Button_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
651
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
652 DEFINE_LRECORD_IMPLEMENTATION ("motion-data", motion_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
653 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
654 mark_motion_data, print_motion_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
655 motion_data_equal, motion_data_hash, motion_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
656 Lisp_Motion_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
657
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
658 DEFINE_LRECORD_IMPLEMENTATION ("process-data", process_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
659 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
660 mark_process_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
661 print_process_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
662 process_data_equal, process_data_hash, process_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
663 Lisp_Process_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
664
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
665 DEFINE_LRECORD_IMPLEMENTATION ("timeout-data", timeout_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
666 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
667 mark_timeout_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
668 print_timeout_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
669 timeout_data_equal, timeout_data_hash, timeout_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
670 Lisp_Timeout_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
671
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
672 DEFINE_LRECORD_IMPLEMENTATION ("eval-data", eval_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
673 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
674 mark_eval_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
675 print_eval_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
676 eval_data_equal, eval_data_hash, eval_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
677 Lisp_Eval_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
678
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
679 DEFINE_LRECORD_IMPLEMENTATION ("misc-user-data", misc_user_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
680 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
681 mark_misc_user_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
682 print_misc_user_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
683 0, misc_user_data_equal,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
684 misc_user_data_hash, misc_user_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
685 Lisp_Misc_User_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
686
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
687 DEFINE_LRECORD_IMPLEMENTATION ("magic-eval-data", magic_eval_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
688 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
689 mark_magic_eval_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
690 print_magic_eval_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
691 magic_eval_data_equal,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
692 magic_eval_data_hash, magic_eval_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
693 Lisp_Magic_Eval_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
694
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
695 DEFINE_LRECORD_IMPLEMENTATION ("magic-data", magic_data,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
696 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
697 mark_magic_data, print_magic_data, 0,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
698 magic_data_equal, magic_data_hash, magic_data_description,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
699 Lisp_Magic_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
700
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
701
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
702
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
703 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 /* Make sure we lose quickly if we try to use this event */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 deinitialize_event (Lisp_Object ev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 int i;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
709 Lisp_Event *event = XEVENT (ev);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
711 for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 ((int *) event) [i] = 0xdeadbeef;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 event->event_type = dead_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 event->channel = Qnil;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
715 set_lheader_implementation (&event->lheader, &lrecord_event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 XSET_EVENT_NEXT (ev, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 /* Set everything to zero or nil so that it's predictable. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
721 zero_event (Lisp_Event *e)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 xzero (*e);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
724 set_lheader_implementation (&e->lheader, &lrecord_event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 e->event_type = empty_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 e->next = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 e->channel = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 mark_event (Lisp_Object obj)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
733 Lisp_Event *event = XEVENT (obj);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 switch (event->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 mark_object (event->event.key.keysym);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 case process_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 mark_object (event->event.process.process);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 case timeout_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 mark_object (event->event.timeout.function);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 mark_object (event->event.timeout.object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 case eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 mark_object (event->event.eval.function);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 mark_object (event->event.eval.object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 case magic_eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 mark_object (event->event.magic_eval.object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 case pointer_motion_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 case magic_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 case empty_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 case dead_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 mark_object (event->channel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 return event->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
770 print_event_1 (const char *str, Lisp_Object obj, Lisp_Object printcharfun)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
772 DECLARE_EISTRING_MALLOC (ei);
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
773 write_c_string (printcharfun, str);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
774 format_event_object (ei, XEVENT (obj), 0);
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
775 write_eistring (printcharfun, ei);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
776 eifree (ei);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 if (print_readably)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
783 printing_unreadable_object ("#<event>");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 switch (XEVENT (obj)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 print_event_1 ("#<keypress-event ", obj, printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 print_event_1 ("#<buttondown-event ", obj, printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 print_event_1 ("#<buttonup-event ", obj, printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 case magic_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 case magic_eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 print_event_1 ("#<magic-event ", obj, printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 case pointer_motion_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 Lisp_Object Vx, Vy;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 Vx = Fevent_x_pixel (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 assert (INTP (Vx));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 Vy = Fevent_y_pixel (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 assert (INTP (Vy));
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
807 write_fmt_string (printcharfun, "#<motion-event %ld, %ld",
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
808 (long) XINT (Vx), (long) XINT (Vy));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 case process_event:
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
812 write_fmt_string_lisp (printcharfun, "#<process-event %S", 1, XEVENT (obj)->event.process.process);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 case timeout_event:
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
815 write_fmt_string_lisp (printcharfun, "#<timeout-event %S", 1, XEVENT (obj)->event.timeout.object);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 case empty_event:
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
818 write_c_string (printcharfun, "#<empty-event");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 case misc_user_event:
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
821 write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S", 1, XEVENT (obj)->event.misc.function);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
822 write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.misc.object);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 case eval_event:
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
825 write_fmt_string_lisp (printcharfun, "#<eval-event (%S", 1, XEVENT (obj)->event.eval.function);
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
826 write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.eval.object);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 case dead_event:
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
829 write_c_string (printcharfun, "#<DEALLOCATED-EVENT");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 default:
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
832 write_c_string (printcharfun, "#<UNKNOWN-EVENT-TYPE");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 }
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
835 write_c_string (printcharfun, ">");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
841 Lisp_Event *e1 = XEVENT (obj1);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
842 Lisp_Event *e2 = XEVENT (obj2);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 if (e1->event_type != e2->event_type) return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 if (!EQ (e1->channel, e2->channel)) return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 /* if (e1->timestamp != e2->timestamp) return 0; */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 switch (e1->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 default: abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 case process_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 return EQ (e1->event.process.process, e2->event.process.process);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 case timeout_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 return (internal_equal (e1->event.timeout.function,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 e2->event.timeout.function, 0) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 internal_equal (e1->event.timeout.object,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 e2->event.timeout.object, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 return (EQ (e1->event.key.keysym, e2->event.key.keysym) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 (e1->event.key.modifiers == e2->event.key.modifiers));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 return (e1->event.button.button == e2->event.button.button &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 e1->event.button.modifiers == e2->event.button.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 case pointer_motion_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 return (e1->event.motion.x == e2->event.motion.x &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 e1->event.motion.y == e2->event.motion.y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 return (internal_equal (e1->event.eval.function,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 e2->event.eval.function, 0) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 internal_equal (e1->event.eval.object,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 e2->event.eval.object, 0) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 /* is this really needed for equality
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 or is x and y also important? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 e1->event.misc.button == e2->event.misc.button &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 e1->event.misc.modifiers == e2->event.misc.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 case eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 return (internal_equal (e1->event.eval.function,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 e2->event.eval.function, 0) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 internal_equal (e1->event.eval.object,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 e2->event.eval.object, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 case magic_eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 return (e1->event.magic_eval.internal_function ==
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 e2->event.magic_eval.internal_function &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 internal_equal (e1->event.magic_eval.object,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 e2->event.magic_eval.object, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 case magic_event:
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
896 return event_stream_compare_magic_event (e1, e2);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 case empty_event: /* Empty and deallocated events are equal. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 case dead_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
904 static Hashcode
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 event_hash (Lisp_Object obj, int depth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
907 Lisp_Event *e = XEVENT (obj);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
908 Hashcode hash;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 hash = HASH2 (e->event_type, LISP_HASH (e->channel));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 switch (e->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 case process_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 return HASH2 (hash, LISP_HASH (e->event.process.process));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 case timeout_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 return HASH3 (hash, internal_hash (e->event.timeout.function, depth + 1),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 internal_hash (e->event.timeout.object, depth + 1));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 return HASH3 (hash, LISP_HASH (e->event.key.keysym),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 e->event.key.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 return HASH3 (hash, e->event.button.button, e->event.button.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 case pointer_motion_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 return HASH3 (hash, e->event.motion.x, e->event.motion.y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 return HASH5 (hash, internal_hash (e->event.misc.function, depth + 1),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 internal_hash (e->event.misc.object, depth + 1),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 e->event.misc.button, e->event.misc.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 case eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 return HASH3 (hash, internal_hash (e->event.eval.function, depth + 1),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 internal_hash (e->event.eval.object, depth + 1));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 case magic_eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 return HASH3 (hash,
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
942 (Hashcode) e->event.magic_eval.internal_function,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 internal_hash (e->event.magic_eval.object, depth + 1));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 case magic_event:
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
946 return HASH2 (hash, event_stream_hash_magic_event (e));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 case empty_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 case dead_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 return hash;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 return 0; /* unreached */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 }
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
958 #endif /* not USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
959
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
960
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
961 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
962 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
963 0, /*dumpable-flag*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
964 mark_event, print_event, 0, event_equal,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
965 event_hash, 0/*event_description*/, Lisp_Event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
966 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 mark_event, print_event, 0, event_equal,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
969 event_hash, 0, Lisp_Event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
970 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 DEFUN ("make-event", Fmake_event, 0, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 Return a new event of type TYPE, with properties described by PLIST.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 TYPE is a symbol, either `empty', `key-press', `button-press',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 `button-release', `misc-user' or `motion'. If TYPE is nil, it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 defaults to `empty'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 PLIST is a property list, the properties being compatible to those
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 returned by `event-properties'. The following properties are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 allowed:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 channel -- The event channel, a frame or a console. For
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 button-press, button-release, misc-user and motion events,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 this must be a frame. For key-press events, it must be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 a console. If channel is unspecified, it will be set to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 the selected frame or selected console, as appropriate.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 key -- The event key, a symbol or character. Allowed only for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 keypress events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 button -- The event button, integer 1, 2 or 3. Allowed for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 button-press, button-release and misc-user events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 modifiers -- The event modifiers, a list of modifier symbols. Allowed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 for key-press, button-press, button-release, motion and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 misc-user events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 function -- Function. Allowed for misc-user events only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 object -- An object, function's parameter. Allowed for misc-user
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 events only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 x -- The event X coordinate, an integer. This is relative
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 to the left of CHANNEL's root window. Allowed for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 motion, button-press, button-release and misc-user events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 y -- The event Y coordinate, an integer. This is relative
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 to the top of CHANNEL's root window. Allowed for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 motion, button-press, button-release and misc-user events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 timestamp -- The event timestamp, a non-negative integer. Allowed for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 all types of events. If unspecified, it will be set to 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 by default.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 For event type `empty', PLIST must be nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 `button-release', or `motion'. If TYPE is left out, it defaults to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 `empty'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 PLIST is a list of properties, as returned by `event-properties'. Not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 all properties are allowed for all kinds of events, and some are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 required.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 WARNING: the event object returned may be a reused one; see the function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 `deallocate-event'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 (type, plist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 Lisp_Object event = Qnil;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1021 Lisp_Event *e;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 EMACS_INT coord_x = 0, coord_y = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 GCPRO1 (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 if (NILP (type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 type = Qempty;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 if (!NILP (Vevent_resource))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 event = Vevent_resource;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 Vevent_resource = XEVENT_NEXT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 event = allocate_event ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 e = XEVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 zero_event (e);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 if (EQ (type, Qempty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 /* For empty event, we return immediately, without processing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 PLIST. In fact, processing PLIST would be wrong, because the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 sanitizing process would fill in the properties
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 (e.g. CHANNEL), which we don't want in empty events. */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1048 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1049 set_event_type (e, empty_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1050 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 e->event_type = empty_event;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1052 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 if (!NILP (plist))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1054 invalid_operation ("Cannot set properties of empty event", plist);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 return event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 else if (EQ (type, Qkey_press))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1060 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1061 set_event_type (e, key_press_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1062 XSET_KEY_DATA_KEYSYM (EVENT_DATA (e), Qunbound);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1063 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 e->event_type = key_press_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 e->event.key.keysym = Qunbound;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1066 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 else if (EQ (type, Qbutton_press))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1069 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1070 set_event_type (e, button_press_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1071 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 e->event_type = button_press_event;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1073 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 else if (EQ (type, Qbutton_release))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1075 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1076 set_event_type (e, button_release_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1077 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 e->event_type = button_release_event;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1079 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 else if (EQ (type, Qmotion))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1081 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1082 set_event_type (e, pointer_motion_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1083 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 e->event_type = pointer_motion_event;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1085 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 else if (EQ (type, Qmisc_user))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1088 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1089 set_event_type (e, misc_user_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1090 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1091 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1092 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 e->event_type = misc_user_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 e->event.eval.function = e->event.eval.object = Qnil;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1095 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1100 invalid_constant ("Invalid event type", type);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 EVENT_CHANNEL (e) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 plist = Fcopy_sequence (plist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 Fcanonicalize_plist (plist, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1108 #define WRONG_EVENT_TYPE_FOR_PROPERTY(event_type, prop) \
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1109 invalid_argument_2 ("Invalid property for event type", prop, event_type)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1111 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1112 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1113 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1114 if (EQ (keyword, Qchannel))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1115 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1116 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1117 if (EVENT_TYPE(e) == key_press_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1118 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1119 if (e->event_type == key_press_event)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1120 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1121 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1122 if (!CONSOLEP (value))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1123 value = wrong_type_argument (Qconsolep, value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1124 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1125 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1126 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1127 if (!FRAMEP (value))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1128 value = wrong_type_argument (Qframep, value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1129 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1130 EVENT_CHANNEL (e) = value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1131 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1132 else if (EQ (keyword, Qkey))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1133 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1134 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1135 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1136 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1137 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1138 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1139 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1140 case key_press_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1141 if (!SYMBOLP (value) && !CHARP (value))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1142 invalid_argument ("Invalid event key", value);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1143 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1144 XSET_KEY_DATA_KEYSYM (EVENT_DATA(e), value);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1145 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1146 e->event.key.keysym = value;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1147 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1148 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1149 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1150 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1151 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1152 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1153 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1154 else if (EQ (keyword, Qbutton))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1155 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1156 CHECK_NATNUM (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1157 check_int_range (XINT (value), 0, 7);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1159 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1160 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1161 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1162 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1163 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1164 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1165 case button_press_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1166 case button_release_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1167 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1168 XSET_BUTTON_DATA_BUTTON (EVENT_DATA (e), XINT (value));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1169 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1170 e->event.button.button = XINT (value);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1171 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1172 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1173 case misc_user_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1174 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1175 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (e), XINT (value));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1176 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1177 e->event.misc.button = XINT (value);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1178 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1179 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1180 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1181 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1182 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1183 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1184 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1185 else if (EQ (keyword, Qmodifiers))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1186 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1187 int modifiers = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1189 EXTERNAL_LIST_LOOP_2 (sym, value)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1190 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1191 if (EQ (sym, Qcontrol)) modifiers |= XEMACS_MOD_CONTROL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1192 else if (EQ (sym, Qmeta)) modifiers |= XEMACS_MOD_META;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1193 else if (EQ (sym, Qsuper)) modifiers |= XEMACS_MOD_SUPER;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1194 else if (EQ (sym, Qhyper)) modifiers |= XEMACS_MOD_HYPER;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1195 else if (EQ (sym, Qalt)) modifiers |= XEMACS_MOD_ALT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1196 else if (EQ (sym, Qsymbol)) modifiers |= XEMACS_MOD_ALT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1197 else if (EQ (sym, Qshift)) modifiers |= XEMACS_MOD_SHIFT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1198 else if (EQ (sym, Qbutton1)) modifiers |= XEMACS_MOD_BUTTON1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1199 else if (EQ (sym, Qbutton2)) modifiers |= XEMACS_MOD_BUTTON2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1200 else if (EQ (sym, Qbutton3)) modifiers |= XEMACS_MOD_BUTTON3;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1201 else if (EQ (sym, Qbutton4)) modifiers |= XEMACS_MOD_BUTTON4;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1202 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1203 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1204 invalid_constant ("Invalid key modifier", sym);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1205 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1207 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1208 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1209 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1210 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1211 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1212 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1213 case key_press_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1214 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1215 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1216 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1217 e->event.key.modifiers = modifiers;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1218 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1219 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1220 case button_press_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1221 case button_release_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1222 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1223 XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1224 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1225 e->event.button.modifiers = modifiers;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1226 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1227 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1228 case pointer_motion_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1229 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1230 XSET_MOTION_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1231 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1232 e->event.motion.modifiers = modifiers;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1233 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1234 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1235 case misc_user_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1236 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1237 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1238 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1239 e->event.misc.modifiers = modifiers;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1240 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1241 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1242 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1243 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1244 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1245 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1246 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1247 else if (EQ (keyword, Qx))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1248 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1249 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1250 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1251 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1252 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1253 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1254 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1255 case pointer_motion_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1256 case button_press_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1257 case button_release_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1258 case misc_user_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1259 /* Allow negative values, so we can specify toolbar
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1260 positions. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1261 CHECK_INT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1262 coord_x = XINT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1263 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1264 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1265 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1266 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1267 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1268 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1269 else if (EQ (keyword, Qy))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1270 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1271 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1272 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1273 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1274 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1275 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1276 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1277 case pointer_motion_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1278 case button_press_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1279 case button_release_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1280 case misc_user_event:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1281 /* Allow negative values; see above. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1282 CHECK_INT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1283 coord_y = XINT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1284 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1285 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1286 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1287 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1288 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1289 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1290 else if (EQ (keyword, Qtimestamp))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1291 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1292 CHECK_NATNUM (value);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1293 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1294 SET_EVENT_TIMESTAMP (e, XINT (value));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1295 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1296 e->timestamp = XINT (value);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1297 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1298 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1299 else if (EQ (keyword, Qfunction))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1300 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1301 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1302 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1303 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1304 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1305 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1306 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1307 case misc_user_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1308 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1309 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), value);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1310 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1311 e->event.eval.function = value;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1312 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1313 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1314 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1315 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1316 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1317 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1318 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1319 else if (EQ (keyword, Qobject))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1320 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1321 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1322 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1323 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1324 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1325 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1326 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1327 case misc_user_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1328 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1329 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), value);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1330 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1331 e->event.eval.object = value;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1332 #endif /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1333 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1334 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1335 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1336 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1337 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1338 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1339 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1340 invalid_constant_2 ("Invalid property", keyword, value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1341 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1342 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 /* Insert the channel, if missing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 if (NILP (EVENT_CHANNEL (e)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1347 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1348 if (EVENT_TYPE (e) == key_press_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1349 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 if (e->event_type == key_press_event)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1351 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 EVENT_CHANNEL (e) = Vselected_console;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 EVENT_CHANNEL (e) = Fselected_frame (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 /* Fevent_properties, Fevent_x_pixel, etc. work with pixels relative
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 to the frame, so we must adjust accordingly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 if (FRAMEP (EVENT_CHANNEL (e)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 coord_x += FRAME_REAL_LEFT_TOOLBAR_WIDTH (XFRAME (EVENT_CHANNEL (e)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 coord_y += FRAME_REAL_TOP_TOOLBAR_HEIGHT (XFRAME (EVENT_CHANNEL (e)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 switch (e->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 case pointer_motion_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1367 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1368 XSET_MOTION_DATA_X (EVENT_DATA (e), coord_x);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1369 XSET_MOTION_DATA_Y (EVENT_DATA (e), coord_y);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1370 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 e->event.motion.x = coord_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 e->event.motion.y = coord_y;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1373 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 case button_release_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1377 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1378 XSET_BUTTON_DATA_X (EVENT_DATA (e), coord_x);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1379 XSET_BUTTON_DATA_Y (EVENT_DATA (e), coord_y);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1380 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 e->event.button.x = coord_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 e->event.button.y = coord_y;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1383 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 case misc_user_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1386 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1387 XSET_MISC_USER_DATA_X (EVENT_DATA (e), coord_x);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1388 XSET_MISC_USER_DATA_Y (EVENT_DATA (e), coord_y);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1389 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 e->event.misc.x = coord_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 e->event.misc.y = coord_y;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1392 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 abort();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 /* Finally, do some more validation. */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1400 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1401 switch (EVENT_TYPE(e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1402 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1404 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 case key_press_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1407 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1408 if (UNBOUNDP (XKEY_DATA_KEYSYM (EVENT_DATA (e))))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1409 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 if (UNBOUNDP (e->event.key.keysym))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1411 #endif /* not USE_KKCC */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1412 sferror ("A key must be specified to make a keypress event",
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1413 plist);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 case button_press_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1416 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1417 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e)))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1418 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419 if (!e->event.button.button)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1420 #endif /* not USE_KKCC */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1421 sferror
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1422 ("A button must be specified to make a button-press event",
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1423 plist);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 case button_release_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1426 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1427 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e)))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1428 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 if (!e->event.button.button)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1430 #endif /* not USE_KKCC */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1431 sferror
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1432 ("A button must be specified to make a button-release event",
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1433 plist);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 case misc_user_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1436 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1437 if (NILP (XMISC_USER_DATA_FUNCTION (EVENT_DATA (e))))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1438 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 if (NILP (e->event.misc.function))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1440 #endif /* not USE_KKCC */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1441 sferror ("A function must be specified to make a misc-user event",
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1442 plist);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1447
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1448 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449 return event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1452
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1453 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1454
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1455 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1456 make_key_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1457 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1458 Lisp_Object data = allocate_key_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1459
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1460 XSET_KEY_DATA_KEYSYM (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1461 XSET_KEY_DATA_MODIFIERS (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1462
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1463 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1464 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1465
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1466 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1467 make_button_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1468 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1469 Lisp_Object data = allocate_button_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1470
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1471 XSET_BUTTON_DATA_BUTTON (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1472 XSET_BUTTON_DATA_MODIFIERS (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1473 XSET_BUTTON_DATA_X (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1474 XSET_BUTTON_DATA_Y (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1475
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1476 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1477 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1478
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1479 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1480 make_motion_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1481 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1482 Lisp_Object data = allocate_motion_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1483
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1484 XSET_MOTION_DATA_X (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1485 XSET_MOTION_DATA_Y (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1486 XSET_MOTION_DATA_MODIFIERS (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1487
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1488 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1489 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1490
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1491 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1492 make_process_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1493 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1494 Lisp_Object data = allocate_process_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1495
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1496 XSET_PROCESS_DATA_PROCESS (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1497
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1498 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1499 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1500
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1501 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1502 make_timeout_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1503 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1504 Lisp_Object data = allocate_timeout_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1505
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1506 XSET_TIMEOUT_DATA_INTERVAL_ID (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1507 XSET_TIMEOUT_DATA_ID_NUMBER(data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1508 XSET_TIMEOUT_DATA_FUNCTION(data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1509 XSET_TIMEOUT_DATA_OBJECT (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1510
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1511 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1512 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1513
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1514 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1515 make_magic_eval_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1516 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1517 Lisp_Object data = allocate_magic_eval_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1518
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1519 XSET_MAGIC_EVAL_DATA_OBJECT (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1520 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1521
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1522 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1523 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1524
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1525 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1526 make_eval_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1527 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1528 Lisp_Object data = allocate_eval_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1529
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1530 XSET_EVAL_DATA_FUNCTION (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1531 XSET_EVAL_DATA_OBJECT (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1532
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1533 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1534 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1535
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1536 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1537 make_magic_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1538 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1539 return allocate_magic_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1540 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1541
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1542 Lisp_Object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1543 make_misc_user_data (void)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1544 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1545 Lisp_Object data = allocate_misc_user_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1546
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1547 XSET_MISC_USER_DATA_FUNCTION (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1548 XSET_MISC_USER_DATA_OBJECT (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1549 XSET_MISC_USER_DATA_BUTTON (data, Qnil);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1550 XSET_MISC_USER_DATA_MODIFIERS (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1551 XSET_MISC_USER_DATA_X (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1552 XSET_MISC_USER_DATA_Y (data, 0);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1553
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1554 return data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1555 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1556 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1557
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1558
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1559
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 Allow the given event structure to be reused.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 You MUST NOT use this event object after calling this function with it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 You will lose. It is not necessary to call this function, as event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 objects are garbage-collected like all other objects; however, it may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 be more efficient to explicitly deallocate events when you are sure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 that it is safe to do so.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 CHECK_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 if (XEVENT_TYPE (event) == dead_event)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1573 invalid_argument ("this event is already deallocated!", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575 assert (XEVENT_TYPE (event) <= last_event_type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 int i, len;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 if (EQ (event, Vlast_command_event) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 EQ (event, Vlast_input_event) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 EQ (event, Vunread_command_event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 len = XVECTOR_LENGTH (Vthis_command_keys);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 for (i = 0; i < len; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 if (EQ (event, XVECTOR_DATA (Vthis_command_keys) [i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590 if (!NILP (Vrecent_keys_ring))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 int recent_ring_len = XVECTOR_LENGTH (Vrecent_keys_ring);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 for (i = 0; i < recent_ring_len; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 if (EQ (event, XVECTOR_DATA (Vrecent_keys_ring) [i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598 #endif /* 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 assert (!EQ (event, Vevent_resource));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601 deinitialize_event (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602 #ifndef ALLOC_NO_POOLS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 XSET_EVENT_NEXT (event, Vevent_resource);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 Vevent_resource = event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1609 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1610 void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1611 copy_event_data (Lisp_Object dest, Lisp_Object src)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1612 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1613 switch (XRECORD_LHEADER (dest)->type) {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1614 case lrecord_type_key_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1615 XSET_KEY_DATA_KEYSYM (dest, XKEY_DATA_KEYSYM (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1616 XSET_KEY_DATA_MODIFIERS (dest, XKEY_DATA_MODIFIERS (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1617 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1618 case lrecord_type_button_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1619 XSET_BUTTON_DATA_BUTTON (dest, XBUTTON_DATA_BUTTON (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1620 XSET_BUTTON_DATA_MODIFIERS (dest, XBUTTON_DATA_MODIFIERS (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1621 XSET_BUTTON_DATA_X (dest, XBUTTON_DATA_X (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1622 XSET_BUTTON_DATA_Y (dest, XBUTTON_DATA_Y (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1623 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1624 case lrecord_type_motion_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1625 XSET_MOTION_DATA_X (dest, XMOTION_DATA_X (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1626 XSET_MOTION_DATA_Y (dest, XMOTION_DATA_Y (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1627 XSET_MOTION_DATA_MODIFIERS (dest, XMOTION_DATA_MODIFIERS (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1628 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1629 case lrecord_type_process_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1630 XSET_PROCESS_DATA_PROCESS (dest, XPROCESS_DATA_PROCESS (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1631 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1632 case lrecord_type_timeout_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1633 XSET_TIMEOUT_DATA_INTERVAL_ID (dest, XTIMEOUT_DATA_INTERVAL_ID (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1634 XSET_TIMEOUT_DATA_ID_NUMBER (dest, XTIMEOUT_DATA_ID_NUMBER (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1635 XSET_TIMEOUT_DATA_FUNCTION (dest, XTIMEOUT_DATA_FUNCTION (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1636 XSET_TIMEOUT_DATA_OBJECT (dest, XTIMEOUT_DATA_OBJECT (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1637 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1638 case lrecord_type_eval_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1639 XSET_EVAL_DATA_FUNCTION (dest, XEVAL_DATA_FUNCTION (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1640 XSET_EVAL_DATA_OBJECT (dest, XEVAL_DATA_OBJECT (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1641 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1642 case lrecord_type_misc_user_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1643 XSET_MISC_USER_DATA_FUNCTION (dest, XMISC_USER_DATA_FUNCTION (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1644 XSET_MISC_USER_DATA_OBJECT (dest, XMISC_USER_DATA_OBJECT (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1645 XSET_MISC_USER_DATA_BUTTON (dest, XMISC_USER_DATA_BUTTON (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1646 XSET_MISC_USER_DATA_MODIFIERS (dest, XMISC_USER_DATA_MODIFIERS (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1647 XSET_MISC_USER_DATA_X (dest, XMISC_USER_DATA_X (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1648 XSET_MISC_USER_DATA_Y (dest, XMISC_USER_DATA_Y (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1649 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1650 case lrecord_type_magic_eval_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1651 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION (dest, XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1652 XSET_MAGIC_EVAL_DATA_OBJECT (dest, XMAGIC_EVAL_DATA_OBJECT (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1653 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1654 case lrecord_type_magic_data:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1655 XSET_MAGIC_DATA_UNDERLYING (dest, XMAGIC_DATA_UNDERLYING (src));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1656 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1657 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1658 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1659 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1660 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1661 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1662
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1664 Make a copy of the event object EVENT1.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1665 If a second event argument EVENT2 is given, EVENT1 is copied into
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1666 EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1667 then a new event will be made as with `make-event'. See also the
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1668 function `deallocate-event'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 (event1, event2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 CHECK_LIVE_EVENT (event1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673 if (NILP (event2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 event2 = Fmake_event (Qnil, Qnil);
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1675 else
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1676 {
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1677 CHECK_LIVE_EVENT (event2);
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1678 if (EQ (event1, event2))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1679 return signal_continuable_error_2
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1680 (Qinvalid_argument,
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1681 "copy-event called with `eq' events", event1, event2);
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1682 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 assert (XEVENT_TYPE (event1) <= last_event_type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685 assert (XEVENT_TYPE (event2) <= last_event_type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1687 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1688 XSET_EVENT_TYPE (event2, XEVENT_TYPE (event1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1689 XSET_EVENT_CHANNEL (event2, XEVENT_CHANNEL (event1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1690 XSET_EVENT_TIMESTAMP (event2, XEVENT_TIMESTAMP (event1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1691 copy_event_data (XEVENT_DATA (event2), XEVENT_DATA (event1));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1692
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1693 return event2;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1694 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1695 {
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1696 Lisp_Event *ev2 = XEVENT (event2);
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1697 Lisp_Event *ev1 = XEVENT (event1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1699 ev2->event_type = ev1->event_type;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1700 ev2->channel = ev1->channel;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1701 ev2->timestamp = ev1->timestamp;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1702 ev2->event = ev1->event;
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
1703
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 return event2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705 }
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1706 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1710 /************************************************************************/
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1711 /* event chain functions */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1712 /************************************************************************/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 /* Given a chain of events (or possibly nil), deallocate them all. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 deallocate_event_chain (Lisp_Object event_chain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 while (!NILP (event_chain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 Lisp_Object next = XEVENT_NEXT (event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 Fdeallocate_event (event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723 event_chain = next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 /* Return the last event in a chain.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 NOTE: You cannot pass nil as a value here! The routine will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 abort if you do. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 event_chain_tail (Lisp_Object event_chain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734 while (1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736 Lisp_Object next = XEVENT_NEXT (event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737 if (NILP (next))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1738 return event_chain;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 event_chain = next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 /* Enqueue a single event onto the end of a chain of events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744 HEAD points to the first event in the chain, TAIL to the last event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 If the chain is empty, both values should be nil. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748 enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 assert (NILP (XEVENT_NEXT (event)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751 assert (!EQ (*tail, event));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 if (!NILP (*tail))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 XSET_EVENT_NEXT (*tail, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756 *head = event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757 *tail = event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1759 assert (!EQ (event, XEVENT_NEXT (event)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1760 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 /* Remove an event off the head of a chain of events and return it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 HEAD points to the first event in the chain, TAIL to the last event. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 dequeue_event (Lisp_Object *head, Lisp_Object *tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1767 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1768 Lisp_Object event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1770 event = *head;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 *head = XEVENT_NEXT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 XSET_EVENT_NEXT (event, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773 if (NILP (*head))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774 *tail = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775 return event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 /* Enqueue a chain of events (or possibly nil) onto the end of another
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1779 chain of events. HEAD points to the first event in the chain being
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 queued onto, TAIL to the last event. If the chain is empty, both values
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781 should be nil. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1783 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784 enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785 Lisp_Object *tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1786 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 if (NILP (event_chain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790 if (NILP (*head))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 *head = event_chain;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793 *tail = event_chain;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797 XSET_EVENT_NEXT (*tail, event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1798 *tail = event_chain_tail (event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1799 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1801
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1802 /* Return the number of events (possibly 0) on an event chain. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1803
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1804 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1805 event_chain_count (Lisp_Object event_chain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1806 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 Lisp_Object event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 int n = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 EVENT_CHAIN_LOOP (event, event_chain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811 n++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813 return n;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1815
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1816 /* Find the event before EVENT in an event chain. This aborts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1817 if the event is not in the chain. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1818
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1819 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820 event_chain_find_previous (Lisp_Object event_chain, Lisp_Object event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 Lisp_Object previous = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1823
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1824 while (!NILP (event_chain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 if (EQ (event_chain, event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827 return previous;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 previous = event_chain;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1829 event_chain = XEVENT_NEXT (event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1832 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1833 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1836 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 event_chain_nth (Lisp_Object event_chain, int n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 Lisp_Object event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 EVENT_CHAIN_LOOP (event, event_chain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 if (!n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843 return event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844 n--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1849 /* Return a freshly allocated copy of all events in the given chain. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1850
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 copy_event_chain (Lisp_Object event_chain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 Lisp_Object new_chain = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 Lisp_Object new_chain_tail = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856 Lisp_Object event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 EVENT_CHAIN_LOOP (event, event_chain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 Lisp_Object copy = Fcopy_event (event, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 enqueue_event (copy, &new_chain, &new_chain_tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 return new_chain;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1867 /* Given a pointer (maybe nil) into an old chain (also maybe nil, if
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1868 pointer is nil) and a new chain which is a copy of the old, return
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1869 the corresponding new pointer. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1870 Lisp_Object
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1871 transfer_event_chain_pointer (Lisp_Object pointer, Lisp_Object old_chain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1872 Lisp_Object new_chain)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1873 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1874 if (NILP (pointer))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1875 return Qnil;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1876 assert (!NILP (old_chain));
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1877 #ifdef ERROR_CHECK_STRUCTURES
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1878 /* make sure we're actually in the chain */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1879 event_chain_find_previous (old_chain, pointer);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1880 assert (event_chain_count (old_chain) == event_chain_count (new_chain));
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1881 #endif /* ERROR_CHECK_STRUCTURES */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1882 return event_chain_nth (new_chain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1883 event_chain_count (old_chain) -
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1884 event_chain_count (pointer));
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1885 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1886
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1888 /************************************************************************/
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1889 /* higher level functions */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1890 /************************************************************************/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892 Lisp_Object QKbackspace, QKtab, QKlinefeed, QKreturn, QKescape,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 QKspace, QKdelete;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 command_event_p (Lisp_Object event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898 switch (XEVENT_TYPE (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 void
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
1912 character_to_event (Ichar c, Lisp_Event *event, struct console *con,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 int use_console_meta_flag, int do_backspace_mapping)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 Lisp_Object k = Qnil;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1916 int m = 0;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1917 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1918 if (EVENT_TYPE (event) == dead_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1919 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 if (event->event_type == dead_event)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1921 #endif /* not USE_KKCC */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
1922 invalid_argument ("character-to-event called with a deallocated event!", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 #ifndef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 c &= 255;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 if (c > 127 && c <= 255)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 int meta_flag = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 if (use_console_meta_flag && CONSOLE_TTY_P (con))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931 meta_flag = TTY_FLAGS (con).meta_key;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 switch (meta_flag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 case 0: /* ignore top bit; it's parity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 c -= 128;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 case 1: /* top bit is meta */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 c -= 128;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1939 m = XEMACS_MOD_META;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 default: /* this is a real character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1945 if (c < ' ') c += '@', m |= XEMACS_MOD_CONTROL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1946 if (m & XEMACS_MOD_CONTROL)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 switch (c)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1950 case 'I': k = QKtab; m &= ~XEMACS_MOD_CONTROL; break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1951 case 'J': k = QKlinefeed; m &= ~XEMACS_MOD_CONTROL; break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1952 case 'M': k = QKreturn; m &= ~XEMACS_MOD_CONTROL; break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1953 case '[': k = QKescape; m &= ~XEMACS_MOD_CONTROL; break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955 #if defined(HAVE_TTY)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956 if (do_backspace_mapping &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957 CHARP (con->tty_erase_char) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1958 c - '@' == XCHAR (con->tty_erase_char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1959 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 k = QKbackspace;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1961 m &= ~XEMACS_MOD_CONTROL;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1963 #endif /* defined(HAVE_TTY) && !defined(CYGWIN) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1964 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1965 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966 if (c >= 'A' && c <= 'Z') c -= 'A'-'a';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 #if defined(HAVE_TTY)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 else if (do_backspace_mapping &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 CHARP (con->tty_erase_char) && c == XCHAR (con->tty_erase_char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 k = QKbackspace;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1972 #endif /* defined(HAVE_TTY) && !defined(CYGWIN) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973 else if (c == 127)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974 k = QKdelete;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 else if (c == ' ')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 k = QKspace;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1978 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1979 set_event_type (event, key_press_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1980 SET_EVENT_TIMESTAMP_ZERO (event); /* #### */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1981 SET_EVENT_CHANNEL (event, wrap_console (con));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1982 XSET_KEY_DATA_KEYSYM (EVENT_DATA (event), (!NILP (k) ? k : make_char (c)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1983 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (event), m);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1984 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 event->event_type = key_press_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986 event->timestamp = 0; /* #### */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1987 event->channel = wrap_console (con);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988 event->event.key.keysym = (!NILP (k) ? k : make_char (c));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 event->event.key.modifiers = m;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1990 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 /* This variable controls what character name -> character code mapping
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 we are using. Window-system-specific code sets this to some symbol,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 and we use that symbol as the plist key to convert keysyms into 8-bit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 codes. In this way one can have several character sets predefined and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 switch them by changing this.
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1998
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1999 #### This is utterly bogus and should be removed.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 Lisp_Object Vcharacter_set_property;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
2003 Ichar
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2004 event_to_character (Lisp_Event *event,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 int allow_extra_modifiers,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006 int allow_meta,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 int allow_non_ascii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2008 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
2009 Ichar c = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010 Lisp_Object code;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2012 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2013 if (EVENT_TYPE (event) != key_press_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2014 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015 if (event->event_type != key_press_event)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2016 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2018 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2019 assert (EVENT_TYPE (event) != dead_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2020 #else /* not USE_KKCC */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 430
diff changeset
2021 assert (event->event_type != dead_event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2022 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023 return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025 if (!allow_extra_modifiers &&
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2026 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2027 XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2028 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2029 event->event.key.modifiers & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2030 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 return -1;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2032 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2033 if (CHAR_OR_CHAR_INTP (XKEY_DATA_KEYSYM (EVENT_DATA (event))))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2034 c = XCHAR_OR_CHAR_INT (XKEY_DATA_KEYSYM (EVENT_DATA (event)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2035 else if (!SYMBOLP (XKEY_DATA_KEYSYM (EVENT_DATA (event))))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2036 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2037 if (CHAR_OR_CHAR_INTP (event->event.key.keysym))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2038 c = XCHAR_OR_CHAR_INT (event->event.key.keysym);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2039 else if (!SYMBOLP (event->event.key.keysym))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2040 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2041 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2042 else if (allow_non_ascii && !NILP (Vcharacter_set_property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2043 /* Allow window-system-specific extensibility of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2044 keysym->code mapping */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2045 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2046 && CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2047 Vcharacter_set_property,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2048 Qnil)))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2049 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2050 && CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2051 Vcharacter_set_property,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2052 Qnil)))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2053 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2054 c = XCHAR_OR_CHAR_INT (code);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2055 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2056 else if (CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)),
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2057 Qascii_character, Qnil)))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2058 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2059 else if (CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2060 Qascii_character, Qnil)))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2061 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 c = XCHAR_OR_CHAR_INT (code);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2064 return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2065
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2066 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2067 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_CONTROL)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2068 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2069 if (event->event.key.modifiers & XEMACS_MOD_CONTROL)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2070 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2071 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2072 if (c >= 'a' && c <= 'z')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2073 c -= ('a' - 'A');
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2074 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2075 /* reject Control-Shift- keys */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2076 if (c >= 'A' && c <= 'Z' && !allow_extra_modifiers)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2077 return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079 if (c >= '@' && c <= '_')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080 c -= '@';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2081 else if (c == ' ') /* C-space and C-@ are the same. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 c = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2083 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2084 /* reject keys that can't take Control- modifiers */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2085 if (! allow_extra_modifiers) return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2086 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2087
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2088 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2089 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_META)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2090 #else /* not USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2091 if (event->event.key.modifiers & XEMACS_MOD_META)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2092 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2093 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2094 if (! allow_meta) return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095 if (c & 0200) return -1; /* don't allow M-oslash (overlap) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2096 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2097 if (c >= 256) return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2098 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2099 c |= 0200;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2100 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2101 return c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2102 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2104 DEFUN ("event-to-character", Fevent_to_character, 1, 4, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2105 Return the closest ASCII approximation to the given event object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2106 If the event isn't a keypress, this returns nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2107 If the ALLOW-EXTRA-MODIFIERS argument is non-nil, then this is lenient in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108 its translation; it will ignore modifier keys other than control and meta,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109 and will ignore the shift modifier on those characters which have no
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2110 shifted ASCII equivalent (Control-Shift-A for example, will be mapped to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2111 the same ASCII code as Control-A).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2112 If the ALLOW-META argument is non-nil, then the Meta modifier will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2113 represented by turning on the high bit of the byte returned; otherwise, nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2114 will be returned for events containing the Meta modifier.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2115 If the ALLOW-NON-ASCII argument is non-nil, then characters which are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2116 present in the prevailing character set (see the `character-set-property'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2117 variable) will be returned as their code in that character set, instead of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2118 the return value being restricted to ASCII.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2119 Note that specifying both ALLOW-META and ALLOW-NON-ASCII is ambiguous, as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2120 both use the high bit; `M-x' and `oslash' will be indistinguishable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2121 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2122 (event, allow_extra_modifiers, allow_meta, allow_non_ascii))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2123 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
2124 Ichar c;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2125 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2126 c = event_to_character (XEVENT (event),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2127 !NILP (allow_extra_modifiers),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2128 !NILP (allow_meta),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2129 !NILP (allow_non_ascii));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2130 return c < 0 ? Qnil : make_char (c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2131 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2133 DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2134 Convert KEY-DESCRIPTION into an event structure, replete with bucky bits.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2135
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2136 KEY-DESCRIPTION is the first argument, and the event to fill in is the
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2137 second. This function contains knowledge about what various kinds of
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2138 arguments ``mean'' -- for example, the number 9 is converted to the
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2139 character ``Tab'', not the distinct character ``Control-I''.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2140
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2141 KEY-DESCRIPTION can be an integer, a character, a symbol such as 'clear,
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2142 or a list such as '(control backspace).
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2143
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2144 If the optional second argument EVENT is an event, it is modified and
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2145 returned; otherwise, a new event object is created and returned.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2147 Optional third arg CONSOLE is the console to store in the event, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2148 defaults to the selected console.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2149
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2150 If KEY-DESCRIPTION is an integer or character, the high bit may be
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2151 interpreted as the meta key. (This is done for backward compatibility
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2152 in lots of places.) If USE-CONSOLE-META-FLAG is nil, this will always
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2153 be the case. If USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2154 CONSOLE affects whether the high bit is interpreted as a meta
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2155 key. (See `set-input-mode'.) If you don't want this silly meta
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2156 interpretation done, you should pass in a list containing the
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2157 character.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2159 Beware that character-to-event and event-to-character are not strictly
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2160 inverse functions, since events contain much more information than the
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2161 Lisp character object type can encode.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2162 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2163 (keystroke, event, console, use_console_meta_flag))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2165 struct console *con = decode_console (console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2166 if (NILP (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167 event = Fmake_event (Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2168 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2169 CHECK_LIVE_EVENT (event);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2170 if (CONSP (keystroke) || SYMBOLP (keystroke))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2171 key_desc_list_to_event (keystroke, event, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2172 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2173 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2174 CHECK_CHAR_COERCE_INT (keystroke);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2175 character_to_event (XCHAR (keystroke), XEVENT (event), con,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2176 !NILP (use_console_meta_flag), 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2177 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2178 return event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2179 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2181 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2182 nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2183 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2184 assert (STRINGP (seq) || VECTORP (seq));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2185 assert (n < XINT (Flength (seq)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2187 if (STRINGP (seq))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2188 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
2189 Ichar ch = string_ichar (seq, n);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2190 Fcharacter_to_event (make_char (ch), event, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2191 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2192 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2193 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194 Lisp_Object keystroke = XVECTOR_DATA (seq)[n];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195 if (EVENTP (keystroke))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196 Fcopy_event (keystroke, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 Fcharacter_to_event (keystroke, event, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2203 key_sequence_to_event_chain (Lisp_Object seq)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2205 int len = XINT (Flength (seq));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207 Lisp_Object head = Qnil, tail = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209 for (i = 0; i < len; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2211 Lisp_Object event = Fmake_event (Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212 nth_of_key_sequence_as_event (seq, i, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2213 enqueue_event (event, &head, &tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2214 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2216 return head;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2217 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2218
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2219
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2220 /* Concatenate a string description of EVENT onto the end of BUF. If
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2221 BRIEF, use short forms for keys, e.g. C- instead of control-. */
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2222
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2223 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2224 void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2225 format_event_object (Eistring *buf, Lisp_Object event, int brief)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2226 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2227 void
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2228 format_event_object (Eistring *buf, Lisp_Event *event, int brief)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2229 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2230 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231 int mouse_p = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2232 int mod = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2233 Lisp_Object key;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2234
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2235 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2236 switch (EVENT_TYPE (XEVENT(event)))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2237 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2238 switch (event->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2239 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2243 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2244 mod = XKEY_DATA_MODIFIERS (XEVENT_DATA(event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2245 key = XKEY_DATA_KEYSYM (XEVENT_DATA(event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2246 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2247 mod = event->event.key.modifiers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2248 key = event->event.key.keysym;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2249 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2250 /* Hack. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2251 if (! brief && CHARP (key) &&
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2252 mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER |
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2253 XEMACS_MOD_HYPER))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2254 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2255 int k = XCHAR (key);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2256 if (k >= 'a' && k <= 'z')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2257 key = make_char (k - ('a' - 'A'));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2258 else if (k >= 'A' && k <= 'Z')
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2259 mod |= XEMACS_MOD_SHIFT;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2260 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2262 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2264 mouse_p++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2265 /* Fall through */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2267 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2268 mouse_p++;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2269 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2270 mod = XBUTTON_DATA_MODIFIERS (XEVENT_DATA(event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2271 key = make_char (XBUTTON_DATA_BUTTON (XEVENT_DATA(event)) + '0');
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2272 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273 mod = event->event.button.modifiers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2274 key = make_char (event->event.button.button + '0');
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2275 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2276 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2277 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2278 case magic_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2279 {
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2280 Lisp_Object stream;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2281 struct gcpro gcpro1;
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2282 GCPRO1 (stream);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2283
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2284 stream = make_resizing_buffer_output_stream ();
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2285 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2286 event_stream_format_magic_event (XEVENT(event), stream);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2287 #else /* not USE_KKCC */
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2288 event_stream_format_magic_event (event, stream);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2289 #endif /* not USE_KKCC */
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2290 Lstream_flush (XLSTREAM (stream));
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2291 eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)),
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2292 Lstream_byte_count (XLSTREAM (stream)));
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2293 Lstream_delete (XLSTREAM (stream));
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
2294 UNGCPRO;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2295 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2296 }
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2297 case magic_eval_event: eicat_c (buf, "magic-eval"); return;
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2298 case pointer_motion_event: eicat_c (buf, "motion"); return;
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2299 case misc_user_event: eicat_c (buf, "misc-user"); return;
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2300 case eval_event: eicat_c (buf, "eval"); return;
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2301 case process_event: eicat_c (buf, "process"); return;
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2302 case timeout_event: eicat_c (buf, "timeout"); return;
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2303 case empty_event: eicat_c (buf, "empty"); return;
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2304 case dead_event: eicat_c (buf, "DEAD-EVENT"); return;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2305 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2306 abort ();
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2307 return;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2308 }
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2309 #define modprint(x,y) \
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2310 do { if (brief) eicat_c (buf, (y)); else eicat_c (buf, (x)); } while (0)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2311 if (mod & XEMACS_MOD_CONTROL) modprint ("control-", "C-");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2312 if (mod & XEMACS_MOD_META) modprint ("meta-", "M-");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2313 if (mod & XEMACS_MOD_SUPER) modprint ("super-", "S-");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2314 if (mod & XEMACS_MOD_HYPER) modprint ("hyper-", "H-");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2315 if (mod & XEMACS_MOD_ALT) modprint ("alt-", "A-");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2316 if (mod & XEMACS_MOD_SHIFT) modprint ("shift-", "Sh-");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2317 if (mouse_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2318 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2319 eicat_c (buf, "button");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2320 --mouse_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2321 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2322
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2323 #undef modprint
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2325 if (CHARP (key))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2326 eicat_ch (buf, XCHAR (key));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 else if (SYMBOLP (key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2329 const Char_ASCII *str = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2330 if (brief)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2331 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2332 if (EQ (key, QKlinefeed)) str = "LFD";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 else if (EQ (key, QKtab)) str = "TAB";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2334 else if (EQ (key, QKreturn)) str = "RET";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2335 else if (EQ (key, QKescape)) str = "ESC";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2336 else if (EQ (key, QKdelete)) str = "DEL";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2337 else if (EQ (key, QKspace)) str = "SPC";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2338 else if (EQ (key, QKbackspace)) str = "BS";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2339 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2340 if (str)
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2341 eicat_c (buf, str);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2342 else
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2343 eicat_lstr (buf, XSYMBOL (key)->name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2344 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2345 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2346 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2347 if (mouse_p)
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
2348 eicat_c (buf, "up");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2349 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2350
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2351
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2352 DEFUN ("eventp", Feventp, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2353 True if OBJECT is an event object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2354 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2355 (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2356 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2357 return EVENTP (object) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2358 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2360 DEFUN ("event-live-p", Fevent_live_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2361 True if OBJECT is an event object that has not been deallocated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2362 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2363 (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2364 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2365 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2366 return EVENTP (object) && XEVENT_TYPE (object) != dead_event ?
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2367 Qt : Qnil;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2368 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2369 return EVENTP (object) && XEVENT (object)->event_type != dead_event ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2370 Qt : Qnil;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2371 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2372 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2373
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2374 #if 0 /* debugging functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2375
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
2376 DEFUN ("event-next", Fevent_next, 1, 1, 0, /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2377 Return the event object's `next' event, or nil if it has none.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2378 The `next-event' field is changed by calling `set-next-event'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2379 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2380 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2381 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2382 Lisp_Event *e;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2383 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2385 return XEVENT_NEXT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2386 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2387
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
2388 DEFUN ("set-event-next", Fset_event_next, 2, 2, 0, /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2389 Set the `next event' of EVENT to NEXT-EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2390 NEXT-EVENT must be an event object or nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2391 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2392 (event, next_event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2393 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2394 Lisp_Object ev;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2395
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2396 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2397 if (NILP (next_event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2398 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2399 XSET_EVENT_NEXT (event, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2400 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2401 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2402
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2403 CHECK_LIVE_EVENT (next_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2404
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2405 EVENT_CHAIN_LOOP (ev, XEVENT_NEXT (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2406 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2407 QUIT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2408 if (EQ (ev, event))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
2409 invalid_operation_2 ("Cyclic event-next", event, next_event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2410 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2411 XSET_EVENT_NEXT (event, next_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2412 return next_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2413 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2414
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2415 #endif /* 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2416
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2417 DEFUN ("event-type", Fevent_type, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2418 Return the type of EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2419 This will be a symbol; one of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2421 key-press A key was pressed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2422 button-press A mouse button was pressed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2423 button-release A mouse button was released.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2424 misc-user Some other user action happened; typically, this is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2425 a menu selection or scrollbar action.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2426 motion The mouse moved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2427 process Input is available from a subprocess.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2428 timeout A timeout has expired.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2429 eval This causes a specified action to occur when dispatched.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2430 magic Some window-system-specific event has occurred.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2431 empty The event has been allocated but not assigned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2433 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2434 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2435 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2436 CHECK_LIVE_EVENT (event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2437 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2438 switch (XEVENT_TYPE (event))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2439 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2440 switch (XEVENT (event)->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2441 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2442 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2443 case key_press_event: return Qkey_press;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2444 case button_press_event: return Qbutton_press;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2445 case button_release_event: return Qbutton_release;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2446 case misc_user_event: return Qmisc_user;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2447 case pointer_motion_event: return Qmotion;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2448 case process_event: return Qprocess;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2449 case timeout_event: return Qtimeout;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2450 case eval_event: return Qeval;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2451 case magic_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2452 case magic_eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2453 return Qmagic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2454
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2455 case empty_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2456 return Qempty;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2457
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2458 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2459 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2460 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2461 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2462 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2463
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2464 DEFUN ("event-timestamp", Fevent_timestamp, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2465 Return the timestamp of the event object EVENT.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2466 Timestamps are measured in milliseconds since the start of the window system.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2467 They are NOT related to any current time measurement.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2468 They should be compared with `event-timestamp<'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2469 See also `current-event-timestamp'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2470 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2471 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2472 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2473 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2474 /* This junk is so that timestamps don't get to be negative, but contain
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2475 as many bits as this particular emacs will allow.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2476 */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2477 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2478 return make_int (((1L << (VALBITS - 1)) - 1) &
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2479 XEVENT_TIMESTAMP (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2480 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2481 return make_int (((1L << (VALBITS - 1)) - 1) &
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2482 XEVENT (event)->timestamp);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2483 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2484 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2485
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2486 #define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2487
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2488 DEFUN ("event-timestamp<", Fevent_timestamp_lessp, 2, 2, 0, /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2489 Return true if timestamp TIME1 is earlier than timestamp TIME2.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2490 This correctly handles timestamp wrap.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2491 See also `event-timestamp' and `current-event-timestamp'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2492 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2493 (time1, time2))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2494 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2495 EMACS_INT t1, t2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2496
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2497 CHECK_NATNUM (time1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2498 CHECK_NATNUM (time2);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2499 t1 = XINT (time1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2500 t2 = XINT (time2);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2501
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2502 if (t1 < t2)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2503 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2504 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2505 return t1 - t2 < TIMESTAMP_HALFSPACE ? Qnil : Qt;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2506 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2507
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2508 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2509 #define CHECK_EVENT_TYPE(e,t1,sym) do { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2510 CHECK_LIVE_EVENT (e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2511 if (XEVENT_TYPE (e) != (t1)) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2512 e = wrong_type_argument (sym,e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2513 } while (0)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2514 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2515 #define CHECK_EVENT_TYPE(e,t1,sym) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2516 CHECK_LIVE_EVENT (e); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2517 if (XEVENT(e)->event_type != (t1)) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2518 e = wrong_type_argument (sym,e); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2519 } while (0)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2520 #endif /* not USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2521
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2522 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2523 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2524 CHECK_LIVE_EVENT (e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2525 { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2526 emacs_event_type CET_type = XEVENT_TYPE (e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2527 if (CET_type != (t1) && \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2528 CET_type != (t2)) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2529 e = wrong_type_argument (sym,e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2530 } \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2531 } while (0)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2532 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2533 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2534 CHECK_LIVE_EVENT (e); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2535 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2536 emacs_event_type CET_type = XEVENT (e)->event_type; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2537 if (CET_type != (t1) && \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2538 CET_type != (t2)) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2539 e = wrong_type_argument (sym,e); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2540 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2541 } while (0)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2542 #endif /* not USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2543
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2544 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2545 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2546 CHECK_LIVE_EVENT (e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2547 { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2548 emacs_event_type CET_type = XEVENT_TYPE (e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2549 if (CET_type != (t1) && \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2550 CET_type != (t2) && \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2551 CET_type != (t3)) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2552 e = wrong_type_argument (sym,e); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2553 } \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2554 } while (0)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2555 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2556 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2557 CHECK_LIVE_EVENT (e); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2558 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2559 emacs_event_type CET_type = XEVENT (e)->event_type; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2560 if (CET_type != (t1) && \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2561 CET_type != (t2) && \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2562 CET_type != (t3)) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2563 e = wrong_type_argument (sym,e); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2564 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2565 } while (0)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2566 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2567
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2568 DEFUN ("event-key", Fevent_key, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2569 Return the Keysym of the key-press event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2570 This will be a character if the event is associated with one, else a symbol.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2571 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2572 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2573 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2574 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2575 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2576 return XKEY_DATA_KEYSYM (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2577 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2578 return XEVENT (event)->event.key.keysym;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2579 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2580 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2581
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2582 DEFUN ("event-button", Fevent_button, 1, 1, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2583 Return the button-number of the button-press or button-release event EVENT.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2584 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2585 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2586 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2587
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2588 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2589 misc_user_event, Qbutton_event_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2590 #ifdef HAVE_WINDOW_SYSTEM
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2591 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2592 if ( XEVENT_TYPE (event) == misc_user_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2593 return make_int (XMISC_USER_DATA_BUTTON (XEVENT_DATA (event)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2594 else
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2595 return make_int (XBUTTON_DATA_BUTTON (XEVENT_DATA (event)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2596 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2597 if ( XEVENT (event)->event_type == misc_user_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2598 return make_int (XEVENT (event)->event.misc.button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2599 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2600 return make_int (XEVENT (event)->event.button.button);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2601 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2602 #else /* !HAVE_WINDOW_SYSTEM */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2603 return Qzero;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2604 #endif /* !HAVE_WINDOW_SYSTEM */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2605
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2606 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2607
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2608 DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /*
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2609 Return a number representing the modifier keys and buttons which were down
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2610 when the given mouse or keyboard event was produced.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2611 See also the function `event-modifiers'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2612 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2613 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2614 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2615 again:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2616 CHECK_LIVE_EVENT (event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2617 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2618 switch (XEVENT_TYPE (event))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2619 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2620 case key_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2621 return make_int (XKEY_DATA_MODIFIERS (XEVENT_DATA (event)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2622 case button_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2623 case button_release_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2624 return make_int (XBUTTON_DATA_MODIFIERS (XEVENT_DATA (event)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2625 case pointer_motion_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2626 return make_int (XMOTION_DATA_MODIFIERS (XEVENT_DATA (event)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2627 case misc_user_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2628 return make_int (XMISC_USER_DATA_MODIFIERS (XEVENT_DATA (event)));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2629 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2630 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2631 goto again;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2632 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2633 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2634 switch (XEVENT (event)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2635 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2636 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2637 return make_int (XEVENT (event)->event.key.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2638 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2639 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2640 return make_int (XEVENT (event)->event.button.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2641 case pointer_motion_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2642 return make_int (XEVENT (event)->event.motion.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2643 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2644 return make_int (XEVENT (event)->event.misc.modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2645 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2646 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2647 goto again;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2648 }
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2649 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2650 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2651
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2652 DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /*
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2653 Return a list of symbols, the names of the modifier keys and buttons
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2654 which were down when the given mouse or keyboard event was produced.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2655 See also the function `event-modifier-bits'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2656
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2657 The possible symbols in the list are
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2658
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2659 `shift': The Shift key. Will not appear, in general, on key events
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2660 where the keysym is an ASCII character, because using Shift
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2661 on such a character converts it into another character rather
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2662 than actually just adding a Shift modifier.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2663
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2664 `control': The Control key.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2665
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2666 `meta': The Meta key. On PC's and PC-style keyboards, this is generally
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2667 labelled \"Alt\"; Meta is a holdover from early Lisp Machines and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2668 such, propagated through the X Window System. On Sun keyboards,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2669 this key is labelled with a diamond.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2670
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2671 `alt': The \"Alt\" key. Alt is in quotes because this does not refer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2672 to what it obviously should refer to, namely the Alt key on PC
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2673 keyboards. Instead, it refers to the key labelled Alt on Sun
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2674 keyboards, and to no key at all on PC keyboards.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2675
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2676 `super': The Super key. Most keyboards don't have any such key, but
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2677 under X Windows using `xmodmap' you can assign any key (such as
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2678 an underused right-shift, right-control, or right-alt key) to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2679 this key modifier. No support currently exists under MS Windows
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2680 for generating these modifiers.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2681
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2682 `hyper': The Hyper key. Works just like the Super key.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2683
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2684 `button1': The mouse buttons. This means that the specified button was held
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2685 `button2': down at the time the event occurred. NOTE: For button-press
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2686 `button3': events, the button that was just pressed down does NOT appear in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2687 `button4': the modifiers.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2688 `button5':
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2689
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2690 Button modifiers are currently ignored when defining and looking up key and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2691 mouse strokes in keymaps. This could be changed, which would allow a user to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2692 create button-chord actions, use a button as a key modifier and do other
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2693 clever things.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2694 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2695 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2696 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2697 int mod = XINT (Fevent_modifier_bits (event));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2698 Lisp_Object result = Qnil;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2699 struct gcpro gcpro1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2700
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2701 GCPRO1 (result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2702 if (mod & XEMACS_MOD_SHIFT) result = Fcons (Qshift, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2703 if (mod & XEMACS_MOD_ALT) result = Fcons (Qalt, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2704 if (mod & XEMACS_MOD_HYPER) result = Fcons (Qhyper, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2705 if (mod & XEMACS_MOD_SUPER) result = Fcons (Qsuper, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2706 if (mod & XEMACS_MOD_META) result = Fcons (Qmeta, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2707 if (mod & XEMACS_MOD_CONTROL) result = Fcons (Qcontrol, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2708 if (mod & XEMACS_MOD_BUTTON1) result = Fcons (Qbutton1, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2709 if (mod & XEMACS_MOD_BUTTON2) result = Fcons (Qbutton2, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2710 if (mod & XEMACS_MOD_BUTTON3) result = Fcons (Qbutton3, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2711 if (mod & XEMACS_MOD_BUTTON4) result = Fcons (Qbutton4, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2712 if (mod & XEMACS_MOD_BUTTON5) result = Fcons (Qbutton5, result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2713 RETURN_UNGCPRO (Fnreverse (result));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2714 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2715
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2716 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2717 event_x_y_pixel_internal (Lisp_Object event, int *x, int *y, int relative)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2718 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2719 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2720 struct frame *f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2721
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2722 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2723 if (XEVENT_TYPE (event) == pointer_motion_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2724 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2725 *x = XMOTION_DATA_X (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2726 *y = XMOTION_DATA_Y (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2727 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2728 else if (XEVENT_TYPE (event) == button_press_event ||
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2729 XEVENT_TYPE (event) == button_release_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2730 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2731 *x = XBUTTON_DATA_X (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2732 *y = XBUTTON_DATA_Y (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2733 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2734 else if (XEVENT_TYPE (event) == misc_user_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2735 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2736 *x = XMISC_USER_DATA_X (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2737 *y = XMISC_USER_DATA_Y (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2738 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2739 else
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2740 return 0;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2741 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2742 if (XEVENT (event)->event_type == pointer_motion_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2743 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2744 *x = XEVENT (event)->event.motion.x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2745 *y = XEVENT (event)->event.motion.y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2746 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2747 else if (XEVENT (event)->event_type == button_press_event ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2748 XEVENT (event)->event_type == button_release_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2749 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2750 *x = XEVENT (event)->event.button.x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2751 *y = XEVENT (event)->event.button.y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2752 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2753 else if (XEVENT (event)->event_type == misc_user_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2754 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2755 *x = XEVENT (event)->event.misc.x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2756 *y = XEVENT (event)->event.misc.y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2757 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2758 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2759 return 0;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2760 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2761 f = XFRAME (EVENT_CHANNEL (XEVENT (event)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2762
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2763 if (relative)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2764 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2765 w = find_window_by_pixel_pos (*x, *y, f->root_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2766
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2767 if (!w)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2768 return 1; /* #### What should really happen here? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2769
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2770 *x -= w->pixel_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2771 *y -= w->pixel_top;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2772 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2773 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2774 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2775 *y -= FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2776 FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2777 *x -= FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2778 FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2779 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2780
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2781 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2782 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2783
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2784 DEFUN ("event-window-x-pixel", Fevent_window_x_pixel, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2785 Return the X position in pixels of mouse event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2786 The value returned is relative to the window the event occurred in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2787 This will signal an error if the event is not a mouse event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2788 See also `mouse-event-p' and `event-x-pixel'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2789 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2790 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2792 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2793
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2794 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2795
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2796 if (!event_x_y_pixel_internal (event, &x, &y, 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2797 return wrong_type_argument (Qmouse_event_p, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2798 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2799 return make_int (x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2800 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2801
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2802 DEFUN ("event-window-y-pixel", Fevent_window_y_pixel, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2803 Return the Y position in pixels of mouse event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2804 The value returned is relative to the window the event occurred in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2805 This will signal an error if the event is not a mouse event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2806 See also `mouse-event-p' and `event-y-pixel'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2807 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2808 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2809 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2810 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2811
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2812 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2813
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2814 if (!event_x_y_pixel_internal (event, &x, &y, 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2815 return wrong_type_argument (Qmouse_event_p, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2816 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2817 return make_int (y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2818 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2819
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2820 DEFUN ("event-x-pixel", Fevent_x_pixel, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2821 Return the X position in pixels of mouse event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2822 The value returned is relative to the frame the event occurred in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2823 This will signal an error if the event is not a mouse event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2824 See also `mouse-event-p' and `event-window-x-pixel'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2825 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2826 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2827 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2828 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2829
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2830 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2831
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2832 if (!event_x_y_pixel_internal (event, &x, &y, 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2833 return wrong_type_argument (Qmouse_event_p, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2834 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2835 return make_int (x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2836 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2837
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2838 DEFUN ("event-y-pixel", Fevent_y_pixel, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2839 Return the Y position in pixels of mouse event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2840 The value returned is relative to the frame the event occurred in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2841 This will signal an error if the event is not a mouse event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2842 See also `mouse-event-p' `event-window-y-pixel'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2843 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2844 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2845 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2846 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2847
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2848 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2849
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2850 if (!event_x_y_pixel_internal (event, &x, &y, 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2851 return wrong_type_argument (Qmouse_event_p, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2852 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2853 return make_int (y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2854 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2855
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2856 /* Given an event, return a value:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2858 OVER_TOOLBAR: over one of the 4 frame toolbars
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2859 OVER_MODELINE: over a modeline
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2860 OVER_BORDER: over an internal border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2861 OVER_NOTHING: over the text area, but not over text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2862 OVER_OUTSIDE: outside of the frame border
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2863 OVER_TEXT: over text in the text area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2864 OVER_V_DIVIDER: over windows vertical divider
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2865
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2866 and return:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2867
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2868 The X char position in CHAR_X, if not a null pointer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2869 The Y char position in CHAR_Y, if not a null pointer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2870 (These last two values are relative to the window the event is over.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2871 The window it's over in W, if not a null pointer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2872 The buffer position it's over in BUFP, if not a null pointer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2873 The closest buffer position in CLOSEST, if not a null pointer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2874
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2875 OBJ_X, OBJ_Y, OBJ1, and OBJ2 are as in pixel_to_glyph_translation().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2876 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2877
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2878 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2879 event_pixel_translation (Lisp_Object event, int *char_x, int *char_y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2880 int *obj_x, int *obj_y,
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
2881 struct window **w, Charbpos *bufp, Charbpos *closest,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2882 Charcount *modeline_closest,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2883 Lisp_Object *obj1, Lisp_Object *obj2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2884 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2885 int pix_x = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2886 int pix_y = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2887 int result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2888 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2889
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2890 int ret_x, ret_y, ret_obj_x, ret_obj_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2891 struct window *ret_w;
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
2892 Charbpos ret_bufp, ret_closest;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2893 Charcount ret_modeline_closest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2894 Lisp_Object ret_obj1, ret_obj2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2895
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2896 CHECK_LIVE_EVENT (event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2897 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2898 frame = XEVENT_CHANNEL (event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2899 switch (XEVENT_TYPE (event))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2900 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2901 case pointer_motion_event :
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2902 pix_x = XMOTION_DATA_X (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2903 pix_y = XMOTION_DATA_Y (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2904 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2905 case button_press_event :
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2906 case button_release_event :
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2907 pix_x = XBUTTON_DATA_X (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2908 pix_y = XBUTTON_DATA_Y (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2909 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2910 case misc_user_event :
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2911 pix_x = XMISC_USER_DATA_X (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2912 pix_y = XMISC_USER_DATA_Y (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2913 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2914 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2915 dead_wrong_type_argument (Qmouse_event_p, event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2916 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2917 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2918 frame = XEVENT (event)->channel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2919 switch (XEVENT (event)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2920 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2921 case pointer_motion_event :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2922 pix_x = XEVENT (event)->event.motion.x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2923 pix_y = XEVENT (event)->event.motion.y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2924 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2925 case button_press_event :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2926 case button_release_event :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2927 pix_x = XEVENT (event)->event.button.x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2928 pix_y = XEVENT (event)->event.button.y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2929 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2930 case misc_user_event :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2931 pix_x = XEVENT (event)->event.misc.x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2932 pix_y = XEVENT (event)->event.misc.y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2933 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2934 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2935 dead_wrong_type_argument (Qmouse_event_p, event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2936 }
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
2937 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2938
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2939 result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2940 &ret_x, &ret_y, &ret_obj_x, &ret_obj_y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2941 &ret_w, &ret_bufp, &ret_closest,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2942 &ret_modeline_closest,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2943 &ret_obj1, &ret_obj2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2944
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2945 if (result == OVER_NOTHING || result == OVER_OUTSIDE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2946 ret_bufp = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2947 else if (ret_w && NILP (ret_w->buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2948 /* Why does this happen? (Does it still happen?)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2949 I guess the window has gotten reused as a non-leaf... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2950 ret_w = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2951
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2952 /* #### pixel_to_glyph_translation() sometimes returns garbage...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2953 The word has type Lisp_Type_Record (presumably meaning `extent') but the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2954 pointer points to random memory, often filled with 0, sometimes not.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2955 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2956 /* #### Chuck, do we still need this crap? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2957 if (!NILP (ret_obj1) && !(GLYPHP (ret_obj1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2958 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2959 || TOOLBAR_BUTTONP (ret_obj1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2960 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2961 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2962 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2963 if (!NILP (ret_obj2) && !(EXTENTP (ret_obj2) || CONSP (ret_obj2)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2964 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2965
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2966 if (char_x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2967 *char_x = ret_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2968 if (char_y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2969 *char_y = ret_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2970 if (obj_x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2971 *obj_x = ret_obj_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2972 if (obj_y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2973 *obj_y = ret_obj_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2974 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2975 *w = ret_w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2976 if (bufp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2977 *bufp = ret_bufp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2978 if (closest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2979 *closest = ret_closest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2980 if (modeline_closest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2981 *modeline_closest = ret_modeline_closest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2982 if (obj1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2983 *obj1 = ret_obj1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2984 if (obj2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2985 *obj2 = ret_obj2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2986
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2987 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2988 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2989
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2990 DEFUN ("event-over-text-area-p", Fevent_over_text_area_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2991 Return t if the mouse event EVENT occurred over the text area of a window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2992 The modeline is not considered to be part of the text area.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2993 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2994 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2995 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2996 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2997
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2998 return result == OVER_TEXT || result == OVER_NOTHING ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2999 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3001 DEFUN ("event-over-modeline-p", Fevent_over_modeline_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3002 Return t if the mouse event EVENT occurred over the modeline of a window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3003 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3004 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3005 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3006 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3007
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3008 return result == OVER_MODELINE ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3009 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3011 DEFUN ("event-over-border-p", Fevent_over_border_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3012 Return t if the mouse event EVENT occurred over an internal border.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3013 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3014 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3015 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3016 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3017
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3018 return result == OVER_BORDER ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3019 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3020
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3021 DEFUN ("event-over-toolbar-p", Fevent_over_toolbar_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3022 Return t if the mouse event EVENT occurred over a toolbar.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3023 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3024 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3025 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3026 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3027
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3028 return result == OVER_TOOLBAR ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3029 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3030
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3031 DEFUN ("event-over-vertical-divider-p", Fevent_over_vertical_divider_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3032 Return t if the mouse event EVENT occurred over a window divider.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3033 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3034 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3035 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3036 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3037
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3038 return result == OVER_V_DIVIDER ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3039 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3040
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3041 struct console *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3042 event_console_or_selected (Lisp_Object event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3043 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3044 Lisp_Object channel = EVENT_CHANNEL (XEVENT (event));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3045 Lisp_Object console = CDFW_CONSOLE (channel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3046
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3047 if (NILP (console))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3048 console = Vselected_console;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3049
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3050 return XCONSOLE (console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3051 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3052
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3053 DEFUN ("event-channel", Fevent_channel, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3054 Return the channel that the event EVENT occurred on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3055 This will be a frame, device, console, or nil for some types
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3056 of events (e.g. eval events).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3057 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3058 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3059 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3060 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3061 return EVENT_CHANNEL (XEVENT (event));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3062 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3063
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3064 DEFUN ("event-window", Fevent_window, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3065 Return the window over which mouse event EVENT occurred.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3066 This may be nil if the event occurred in the border or over a toolbar.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3067 The modeline is considered to be within the window it describes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3068 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3069 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3070 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3071 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3072
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3073 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3074
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3075 if (!w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3076 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3077 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3078 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
3079 return wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3080 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3081 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3082
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3083 DEFUN ("event-point", Fevent_point, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3084 Return the character position of the mouse event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3085 If the event did not occur over a window, or did not occur over text,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3086 then this returns nil. Otherwise, it returns a position in the buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3087 visible in the event's window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3088 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3089 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3090 {
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
3091 Charbpos bufp;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3092 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3093
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3094 event_pixel_translation (event, 0, 0, 0, 0, &w, &bufp, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3095
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3096 return w && bufp ? make_int (bufp) : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3097 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3098
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3099 DEFUN ("event-closest-point", Fevent_closest_point, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3100 Return the character position closest to the mouse event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3101 If the event did not occur over a window or over text, return the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3102 closest point to the location of the event. If the Y pixel position
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3103 overlaps a window and the X pixel position is to the left of that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3104 window, the closest point is the beginning of the line containing the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3105 Y position. If the Y pixel position overlaps a window and the X pixel
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3106 position is to the right of that window, the closest point is the end
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3107 of the line containing the Y position. If the Y pixel position is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3108 above a window, return 0. If it is below the last character in a window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3109 return the value of (window-end).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3110 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3111 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3112 {
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
3113 Charbpos bufp;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3115 event_pixel_translation (event, 0, 0, 0, 0, 0, 0, &bufp, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3117 return bufp ? make_int (bufp) : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3118 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3120 DEFUN ("event-x", Fevent_x, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3121 Return the X position of the mouse event EVENT in characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3122 This is relative to the window the event occurred over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3123 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3124 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3125 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3126 int char_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3128 event_pixel_translation (event, &char_x, 0, 0, 0, 0, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3130 return make_int (char_x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3131 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3133 DEFUN ("event-y", Fevent_y, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3134 Return the Y position of the mouse event EVENT in characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3135 This is relative to the window the event occurred over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3136 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3137 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3138 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3139 int char_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3140
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3141 event_pixel_translation (event, 0, &char_y, 0, 0, 0, 0, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3143 return make_int (char_y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3144 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3146 DEFUN ("event-modeline-position", Fevent_modeline_position, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3147 Return the character position in the modeline that EVENT occurred over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3148 EVENT should be a mouse event. If EVENT did not occur over a modeline,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3149 nil is returned. You can determine the actual character that the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3150 event occurred over by looking in `generated-modeline-string' at the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3151 returned character position. Note that `generated-modeline-string'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3152 is buffer-local, and you must use EVENT's buffer when retrieving
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3153 `generated-modeline-string' in order to get accurate results.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3154 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3155 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3156 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3157 Charcount mbufp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3158 int where;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3159
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3160 where = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, &mbufp, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3162 return (mbufp < 0 || where != OVER_MODELINE) ? Qnil : make_int (mbufp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3165 DEFUN ("event-glyph", Fevent_glyph, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3166 Return the glyph that the mouse event EVENT occurred over, or nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3167 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3168 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3169 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3170 Lisp_Object glyph;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3171 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3172
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3173 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, &glyph, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3175 return w && GLYPHP (glyph) ? glyph : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3176 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3178 DEFUN ("event-glyph-extent", Fevent_glyph_extent, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3179 Return the extent of the glyph that the mouse event EVENT occurred over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3180 If the event did not occur over a glyph, nil is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3181 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3182 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3183 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3184 Lisp_Object extent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3185 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3187 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, 0, &extent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3189 return w && EXTENTP (extent) ? extent : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3190 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3192 DEFUN ("event-glyph-x-pixel", Fevent_glyph_x_pixel, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3193 Return the X pixel position of EVENT relative to the glyph it occurred over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3194 EVENT should be a mouse event. If the event did not occur over a glyph,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3195 nil is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3196 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3197 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3198 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3199 Lisp_Object extent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3200 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3201 int obj_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3203 event_pixel_translation (event, 0, 0, &obj_x, 0, &w, 0, 0, 0, 0, &extent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3205 return w && EXTENTP (extent) ? make_int (obj_x) : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3206 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3208 DEFUN ("event-glyph-y-pixel", Fevent_glyph_y_pixel, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3209 Return the Y pixel position of EVENT relative to the glyph it occurred over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3210 EVENT should be a mouse event. If the event did not occur over a glyph,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3211 nil is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3212 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3213 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3214 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3215 Lisp_Object extent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3216 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3217 int obj_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3219 event_pixel_translation (event, 0, 0, 0, &obj_y, &w, 0, 0, 0, 0, &extent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3220
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3221 return w && EXTENTP (extent) ? make_int (obj_y) : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3222 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3223
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3224 DEFUN ("event-toolbar-button", Fevent_toolbar_button, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3225 Return the toolbar button that the mouse event EVENT occurred over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3226 If the event did not occur over a toolbar button, nil is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3227 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3228 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3229 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3230 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3231 Lisp_Object button;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3233 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, &button, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3235 return result == OVER_TOOLBAR && TOOLBAR_BUTTONP (button) ? button : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3236 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3237 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3238 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3239 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3241 DEFUN ("event-process", Fevent_process, 1, 1, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3242 Return the process of the process-output event EVENT.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3243 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3244 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3245 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3246 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3247 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3248 return XPROCESS_DATA_PROCESS (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3249 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3250 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3251 return XEVENT (event)->event.process.process;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3252 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3253 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3254
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3255 DEFUN ("event-function", Fevent_function, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3256 Return the callback function of EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3257 EVENT should be a timeout, misc-user, or eval event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3258 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3259 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3260 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3261 again:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3262 CHECK_LIVE_EVENT (event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3263 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3264 switch (XEVENT_TYPE (event))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3265 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3266 case timeout_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3267 return XTIMEOUT_DATA_FUNCTION (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3268 case misc_user_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3269 return XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3270 case eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3271 return XEVAL_DATA_FUNCTION (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3272 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3273 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3274 goto again;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3275 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3276 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3277 switch (XEVENT (event)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3278 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3279 case timeout_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3280 return XEVENT (event)->event.timeout.function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3281 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3282 return XEVENT (event)->event.misc.function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3283 case eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3284 return XEVENT (event)->event.eval.function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3285 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3286 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3287 goto again;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3288 }
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3289 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3290 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3292 DEFUN ("event-object", Fevent_object, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3293 Return the callback function argument of EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3294 EVENT should be a timeout, misc-user, or eval event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3295 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3296 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3297 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3298 again:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3299 CHECK_LIVE_EVENT (event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3300 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3301 switch (XEVENT_TYPE (event))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3302 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3303 case timeout_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3304 return XTIMEOUT_DATA_OBJECT (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3305 case misc_user_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3306 return XMISC_USER_DATA_OBJECT (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3307 case eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3308 return XEVAL_DATA_OBJECT (XEVENT_DATA (event));
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3309 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3310 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3311 goto again;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3312 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3313 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3314 switch (XEVENT (event)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3315 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3316 case timeout_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3317 return XEVENT (event)->event.timeout.object;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3318 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3319 return XEVENT (event)->event.misc.object;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3320 case eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3321 return XEVENT (event)->event.eval.object;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3322 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3323 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3324 goto again;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3325 }
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3326 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3327 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3329 DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3330 Return a list of all of the properties of EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3331 This is in the form of a property list (alternating keyword/value pairs).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3332 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3333 (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3334 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3335 Lisp_Object props = Qnil;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
3336 Lisp_Event *e;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3337 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3339 CHECK_LIVE_EVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3340 e = XEVENT (event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3341 GCPRO1 (props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3343 props = cons3 (Qtimestamp, Fevent_timestamp (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3344
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3345 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3346 switch (EVENT_TYPE (e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3347 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3348 switch (e->event_type)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3349 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3350 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3351 default: abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3352
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3353 case process_event:
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3354 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3355 props = cons3 (Qprocess, XPROCESS_DATA_PROCESS (EVENT_DATA (e)), props);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3356 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3357 props = cons3 (Qprocess, e->event.process.process, props);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3358 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3359 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3361 case timeout_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3362 props = cons3 (Qobject, Fevent_object (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3363 props = cons3 (Qfunction, Fevent_function (event), props);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3364 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3365 props = cons3 (Qid, make_int (XTIMEOUT_DATA_ID_NUMBER (EVENT_DATA (e))), props);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3366 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3367 props = cons3 (Qid, make_int (e->event.timeout.id_number), props);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3368 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3369 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3371 case key_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3372 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3373 props = cons3 (Qkey, Fevent_key (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3374 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3375
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3376 case button_press_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3377 case button_release_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3378 props = cons3 (Qy, Fevent_y_pixel (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3379 props = cons3 (Qx, Fevent_x_pixel (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3380 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3381 props = cons3 (Qbutton, Fevent_button (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3382 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3383
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3384 case pointer_motion_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3385 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3386 props = cons3 (Qy, Fevent_y_pixel (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3387 props = cons3 (Qx, Fevent_x_pixel (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3388 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3390 case misc_user_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3391 props = cons3 (Qobject, Fevent_object (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3392 props = cons3 (Qfunction, Fevent_function (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3393 props = cons3 (Qy, Fevent_y_pixel (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3394 props = cons3 (Qx, Fevent_x_pixel (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3395 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3396 props = cons3 (Qbutton, Fevent_button (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3397 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3398
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3399 case eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3400 props = cons3 (Qobject, Fevent_object (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3401 props = cons3 (Qfunction, Fevent_function (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3402 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3404 case magic_eval_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3405 case magic_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3406 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3407
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3408 case empty_event:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3409 RETURN_UNGCPRO (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3410 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3411 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3413 props = cons3 (Qchannel, Fevent_channel (event), props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3414 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3415
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3416 return props;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3417 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3418
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3419
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3420 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3421 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3422 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3424 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3425 syms_of_events (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3426 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3427 INIT_LRECORD_IMPLEMENTATION (event);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3428 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3429 INIT_LRECORD_IMPLEMENTATION (key_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3430 INIT_LRECORD_IMPLEMENTATION (button_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3431 INIT_LRECORD_IMPLEMENTATION (motion_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3432 INIT_LRECORD_IMPLEMENTATION (process_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3433 INIT_LRECORD_IMPLEMENTATION (timeout_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3434 INIT_LRECORD_IMPLEMENTATION (eval_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3435 INIT_LRECORD_IMPLEMENTATION (misc_user_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3436 INIT_LRECORD_IMPLEMENTATION (magic_eval_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3437 INIT_LRECORD_IMPLEMENTATION (magic_data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
3438 #endif /* USE_KKCC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3439
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3440 DEFSUBR (Fcharacter_to_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3441 DEFSUBR (Fevent_to_character);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3442
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3443 DEFSUBR (Fmake_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3444 DEFSUBR (Fdeallocate_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3445 DEFSUBR (Fcopy_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3446 DEFSUBR (Feventp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3447 DEFSUBR (Fevent_live_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3448 DEFSUBR (Fevent_type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3449 DEFSUBR (Fevent_properties);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3450
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3451 DEFSUBR (Fevent_timestamp);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3452 DEFSUBR (Fevent_timestamp_lessp);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3453 DEFSUBR (Fevent_key);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3454 DEFSUBR (Fevent_button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3455 DEFSUBR (Fevent_modifier_bits);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3456 DEFSUBR (Fevent_modifiers);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3457 DEFSUBR (Fevent_x_pixel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3458 DEFSUBR (Fevent_y_pixel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3459 DEFSUBR (Fevent_window_x_pixel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3460 DEFSUBR (Fevent_window_y_pixel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3461 DEFSUBR (Fevent_over_text_area_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3462 DEFSUBR (Fevent_over_modeline_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3463 DEFSUBR (Fevent_over_border_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3464 DEFSUBR (Fevent_over_toolbar_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3465 DEFSUBR (Fevent_over_vertical_divider_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3466 DEFSUBR (Fevent_channel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3467 DEFSUBR (Fevent_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3468 DEFSUBR (Fevent_point);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3469 DEFSUBR (Fevent_closest_point);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3470 DEFSUBR (Fevent_x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3471 DEFSUBR (Fevent_y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3472 DEFSUBR (Fevent_modeline_position);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3473 DEFSUBR (Fevent_glyph);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3474 DEFSUBR (Fevent_glyph_extent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3475 DEFSUBR (Fevent_glyph_x_pixel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3476 DEFSUBR (Fevent_glyph_y_pixel);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3477 DEFSUBR (Fevent_toolbar_button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3478 DEFSUBR (Fevent_process);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3479 DEFSUBR (Fevent_function);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3480 DEFSUBR (Fevent_object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3481
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3482 DEFSYMBOL (Qeventp);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3483 DEFSYMBOL (Qevent_live_p);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3484 DEFSYMBOL (Qkey_press_event_p);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3485 DEFSYMBOL (Qbutton_event_p);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3486 DEFSYMBOL (Qmouse_event_p);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3487 DEFSYMBOL (Qprocess_event_p);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3488 DEFSYMBOL (Qkey_press);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3489 DEFSYMBOL (Qbutton_press);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3490 DEFSYMBOL (Qbutton_release);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3491 DEFSYMBOL (Qmisc_user);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 502
diff changeset
3492 DEFSYMBOL (Qascii_character);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3493
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3494 defsymbol (&QKbackspace, "backspace");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3495 defsymbol (&QKtab, "tab");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3496 defsymbol (&QKlinefeed, "linefeed");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3497 defsymbol (&QKreturn, "return");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3498 defsymbol (&QKescape, "escape");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3499 defsymbol (&QKspace, "space");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3500 defsymbol (&QKdelete, "delete");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3501 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3502
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3503
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3504 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3505 reinit_vars_of_events (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3506 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3507 Vevent_resource = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3508 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3509
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3510 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3511 vars_of_events (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3512 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3513 reinit_vars_of_events ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3514
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3515 DEFVAR_LISP ("character-set-property", &Vcharacter_set_property /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3516 A symbol used to look up the 8-bit character of a keysym.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3517 To convert a keysym symbol to an 8-bit code, as when that key is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3518 bound to self-insert-command, we will look up the property that this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3519 variable names on the property list of the keysym-symbol. The window-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3520 system-specific code will set up appropriate properties and set this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3521 variable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3522 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3523 Vcharacter_set_property = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3524 }