llvmpipe: Remove unnecessary header.
[mesa.git] / src / glx / glx_pbuffer.c
1 /*
2 * (C) Copyright IBM Corporation 2004
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25 /**
26 * \file glx_pbuffer.c
27 * Implementation of pbuffer related functions.
28 *
29 * \author Ian Romanick <idr@us.ibm.com>
30 */
31
32 #include <inttypes.h>
33 #include "glxclient.h"
34 #include <X11/extensions/extutil.h>
35 #include <X11/extensions/Xext.h>
36 #include <assert.h>
37 #include <string.h>
38 #include "glxextensions.h"
39
40 #define WARN_ONCE_GLX_1_3(a, b) { \
41 static int warned=1; \
42 if(warned) { \
43 warn_GLX_1_3((a), b ); \
44 warned=0; \
45 } \
46 }
47
48 /**
49 * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
50 */
51 static void
52 warn_GLX_1_3(Display *dpy, const char *function_name)
53 {
54 __GLXdisplayPrivate *priv = __glXInitialize(dpy);
55
56 if (priv->minorVersion < 3) {
57 fprintf(stderr,
58 "WARNING: Application calling GLX 1.3 function \"%s\" "
59 "when GLX 1.3 is not supported! This is an application bug!\n",
60 function_name);
61 }
62 }
63
64
65 /**
66 * Change a drawable's attribute.
67 *
68 * This function is used to implement \c glXSelectEvent and
69 * \c glXSelectEventSGIX.
70 *
71 * \note
72 * This function dynamically determines whether to use the SGIX_pbuffer
73 * version of the protocol or the GLX 1.3 version of the protocol.
74 *
75 * \todo
76 * This function needs to be modified to work with direct-rendering drivers.
77 */
78 static void
79 ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
80 const CARD32 * attribs, size_t num_attribs)
81 {
82 __GLXdisplayPrivate *priv = __glXInitialize(dpy);
83 CARD32 *output;
84 CARD8 opcode;
85
86 if ((dpy == NULL) || (drawable == 0)) {
87 return;
88 }
89
90 opcode = __glXSetupForCommand(dpy);
91 if (!opcode)
92 return;
93
94 LockDisplay(dpy);
95
96 if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
97 xGLXChangeDrawableAttributesReq *req;
98
99 GetReqExtra(GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req);
100 output = (CARD32 *) (req + 1);
101
102 req->reqType = opcode;
103 req->glxCode = X_GLXChangeDrawableAttributes;
104 req->drawable = drawable;
105 req->numAttribs = (CARD32) num_attribs;
106 }
107 else {
108 xGLXVendorPrivateWithReplyReq *vpreq;
109
110 GetReqExtra(GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq);
111 output = (CARD32 *) (vpreq + 1);
112
113 vpreq->reqType = opcode;
114 vpreq->glxCode = X_GLXVendorPrivateWithReply;
115 vpreq->vendorCode = X_GLXvop_ChangeDrawableAttributesSGIX;
116
117 output[0] = (CARD32) drawable;
118 output++;
119 }
120
121 (void) memcpy(output, attribs, sizeof(CARD32) * 2 * num_attribs);
122
123 UnlockDisplay(dpy);
124 SyncHandle();
125
126 return;
127 }
128
129
130 #ifdef GLX_DIRECT_RENDERING
131 static GLenum
132 determineTextureTarget(const int *attribs, int numAttribs)
133 {
134 GLenum target = 0;
135 int i;
136
137 for (i = 0; i < numAttribs; i++) {
138 if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
139 switch (attribs[2 * i + 1]) {
140 case GLX_TEXTURE_2D_EXT:
141 target = GL_TEXTURE_2D;
142 break;
143 case GLX_TEXTURE_RECTANGLE_EXT:
144 target = GL_TEXTURE_RECTANGLE_ARB;
145 break;
146 }
147 }
148 }
149
150 return target;
151 }
152
153 static GLenum
154 determineTextureFormat(const int *attribs, int numAttribs)
155 {
156 int i;
157
158 for (i = 0; i < numAttribs; i++) {
159 if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
160 return attribs[2 * i + 1];
161 }
162
163 return 0;
164 }
165
166 static void
167 CreateDRIDrawable(Display *dpy, const __GLcontextModes *fbconfig,
168 XID drawable, XID glxdrawable,
169 const int *attrib_list, size_t num_attribs)
170 {
171 __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
172 __GLXDRIdrawable *pdraw;
173 __GLXscreenConfigs *psc;
174
175 psc = &priv->screenConfigs[fbconfig->screen];
176 if (psc->driScreen == NULL)
177 return;
178
179 pdraw = psc->driScreen->createDrawable(psc, drawable,
180 glxdrawable, fbconfig);
181 if (pdraw == NULL) {
182 fprintf(stderr, "failed to create drawable\n");
183 return;
184 }
185
186 if (__glxHashInsert(psc->drawHash, glxdrawable, pdraw)) {
187 (*pdraw->destroyDrawable) (pdraw);
188 return; /* FIXME: Check what we're supposed to do here... */
189 }
190
191 pdraw->textureTarget = determineTextureTarget(attrib_list, num_attribs);
192 pdraw->textureFormat = determineTextureFormat(attrib_list, num_attribs);
193 }
194
195 static void
196 DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
197 {
198 int screen;
199 __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
200 __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
201 __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
202
203 if (pdraw != NULL) {
204 if (destroy_xdrawable)
205 XFreePixmap(psc->dpy, pdraw->xDrawable);
206 (*pdraw->destroyDrawable) (pdraw);
207 __glxHashDelete(psc->drawHash, drawable);
208 }
209 }
210
211 #else
212
213 static void
214 CreateDRIDrawable(Display *dpy, const __GLcontextModes * fbconfig,
215 XID drawable, XID glxdrawable,
216 const int *attrib_list, size_t num_attribs)
217 {
218 }
219
220 static void
221 DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
222 {
223 }
224
225 #endif
226
227 /**
228 * Get a drawable's attribute.
229 *
230 * This function is used to implement \c glXGetSelectedEvent and
231 * \c glXGetSelectedEventSGIX.
232 *
233 * \note
234 * This function dynamically determines whether to use the SGIX_pbuffer
235 * version of the protocol or the GLX 1.3 version of the protocol.
236 *
237 * \todo
238 * The number of attributes returned is likely to be small, probably less than
239 * 10. Given that, this routine should try to use an array on the stack to
240 * capture the reply rather than always calling Xmalloc.
241 *
242 * \todo
243 * This function needs to be modified to work with direct-rendering drivers.
244 */
245 static int
246 GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
247 int attribute, unsigned int *value)
248 {
249 __GLXdisplayPrivate *priv;
250 xGLXGetDrawableAttributesReply reply;
251 CARD32 *data;
252 CARD8 opcode;
253 unsigned int length;
254 unsigned int i;
255 unsigned int num_attributes;
256 GLboolean use_glx_1_3;
257
258 if ((dpy == NULL) || (drawable == 0)) {
259 return 0;
260 }
261
262 priv = __glXInitialize(dpy);
263 use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
264
265 *value = 0;
266
267
268 opcode = __glXSetupForCommand(dpy);
269 if (!opcode)
270 return 0;
271
272 LockDisplay(dpy);
273
274 if (use_glx_1_3) {
275 xGLXGetDrawableAttributesReq *req;
276
277 GetReqExtra(GLXGetDrawableAttributes, 4, req);
278 req->reqType = opcode;
279 req->glxCode = X_GLXGetDrawableAttributes;
280 req->drawable = drawable;
281 }
282 else {
283 xGLXVendorPrivateWithReplyReq *vpreq;
284
285 GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
286 data = (CARD32 *) (vpreq + 1);
287 data[0] = (CARD32) drawable;
288
289 vpreq->reqType = opcode;
290 vpreq->glxCode = X_GLXVendorPrivateWithReply;
291 vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
292 }
293
294 _XReply(dpy, (xReply *) & reply, 0, False);
295
296 if (reply.type == X_Error) {
297 UnlockDisplay(dpy);
298 SyncHandle();
299 return 0;
300 }
301
302 length = reply.length;
303 if (length) {
304 num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
305 data = (CARD32 *) Xmalloc(length * sizeof(CARD32));
306 if (data == NULL) {
307 /* Throw data on the floor */
308 _XEatData(dpy, length);
309 }
310 else {
311 _XRead(dpy, (char *) data, length * sizeof(CARD32));
312
313 /* Search the set of returned attributes for the attribute requested by
314 * the caller.
315 */
316 for (i = 0; i < num_attributes; i++) {
317 if (data[i * 2] == attribute) {
318 *value = data[(i * 2) + 1];
319 break;
320 }
321 }
322
323 #ifdef GLX_DIRECT_RENDERING
324 {
325 __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
326
327 if (pdraw != NULL && !pdraw->textureTarget)
328 pdraw->textureTarget =
329 determineTextureTarget((const int *) data, num_attributes);
330 if (pdraw != NULL && !pdraw->textureFormat)
331 pdraw->textureFormat =
332 determineTextureFormat((const int *) data, num_attributes);
333 }
334 #endif
335
336 Xfree(data);
337 }
338 }
339
340 UnlockDisplay(dpy);
341 SyncHandle();
342
343 return 0;
344 }
345
346 /**
347 * Create a non-pbuffer GLX drawable.
348 *
349 * \todo
350 * This function needs to be modified to work with direct-rendering drivers.
351 */
352 static GLXDrawable
353 CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig,
354 Drawable drawable, const int *attrib_list, CARD8 glxCode)
355 {
356 xGLXCreateWindowReq *req;
357 CARD32 *data;
358 unsigned int i;
359 CARD8 opcode;
360
361 i = 0;
362 if (attrib_list) {
363 while (attrib_list[i * 2] != None)
364 i++;
365 }
366
367 opcode = __glXSetupForCommand(dpy);
368 if (!opcode)
369 return None;
370
371 LockDisplay(dpy);
372 GetReqExtra(GLXCreateWindow, 8 * i, req);
373 data = (CARD32 *) (req + 1);
374
375 req->reqType = opcode;
376 req->glxCode = glxCode;
377 req->screen = (CARD32) fbconfig->screen;
378 req->fbconfig = fbconfig->fbconfigID;
379 req->window = (CARD32) drawable;
380 req->glxwindow = (GLXWindow) XAllocID(dpy);
381 req->numAttribs = (CARD32) i;
382
383 if (attrib_list)
384 memcpy(data, attrib_list, 8 * i);
385
386 UnlockDisplay(dpy);
387 SyncHandle();
388
389 CreateDRIDrawable(dpy, fbconfig, drawable, req->glxwindow, attrib_list, i);
390
391 return (GLXDrawable) req->glxwindow;
392 }
393
394
395 /**
396 * Destroy a non-pbuffer GLX drawable.
397 */
398 static void
399 DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode)
400 {
401 xGLXDestroyPbufferReq *req;
402 CARD8 opcode;
403
404 if ((dpy == NULL) || (drawable == 0)) {
405 return;
406 }
407
408
409 opcode = __glXSetupForCommand(dpy);
410 if (!opcode)
411 return;
412
413 LockDisplay(dpy);
414
415 GetReqExtra(GLXDestroyPbuffer, 4, req);
416 req->reqType = opcode;
417 req->glxCode = glxCode;
418 req->pbuffer = (GLXPbuffer) drawable;
419
420 UnlockDisplay(dpy);
421 SyncHandle();
422
423 DestroyDRIDrawable(dpy, drawable, GL_FALSE);
424
425 return;
426 }
427
428
429 /**
430 * Create a pbuffer.
431 *
432 * This function is used to implement \c glXCreatePbuffer and
433 * \c glXCreateGLXPbufferSGIX.
434 *
435 * \note
436 * This function dynamically determines whether to use the SGIX_pbuffer
437 * version of the protocol or the GLX 1.3 version of the protocol.
438 *
439 * \todo
440 * This function needs to be modified to work with direct-rendering drivers.
441 */
442 static GLXDrawable
443 CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig,
444 unsigned int width, unsigned int height,
445 const int *attrib_list, GLboolean size_in_attribs)
446 {
447 __GLXdisplayPrivate *priv = __glXInitialize(dpy);
448 GLXDrawable id = 0;
449 CARD32 *data;
450 CARD8 opcode;
451 unsigned int i;
452 Pixmap pixmap;
453
454 i = 0;
455 if (attrib_list) {
456 while (attrib_list[i * 2])
457 i++;
458 }
459
460 opcode = __glXSetupForCommand(dpy);
461 if (!opcode)
462 return None;
463
464 LockDisplay(dpy);
465 id = XAllocID(dpy);
466
467 if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
468 xGLXCreatePbufferReq *req;
469 unsigned int extra = (size_in_attribs) ? 0 : 2;
470
471 GetReqExtra(GLXCreatePbuffer, (8 * (i + extra)), req);
472 data = (CARD32 *) (req + 1);
473
474 req->reqType = opcode;
475 req->glxCode = X_GLXCreatePbuffer;
476 req->screen = (CARD32) fbconfig->screen;
477 req->fbconfig = fbconfig->fbconfigID;
478 req->pbuffer = (GLXPbuffer) id;
479 req->numAttribs = (CARD32) (i + extra);
480
481 if (!size_in_attribs) {
482 data[(2 * i) + 0] = GLX_PBUFFER_WIDTH;
483 data[(2 * i) + 1] = width;
484 data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT;
485 data[(2 * i) + 3] = height;
486 data += 4;
487 }
488 }
489 else {
490 xGLXVendorPrivateReq *vpreq;
491
492 GetReqExtra(GLXVendorPrivate, 20 + (8 * i), vpreq);
493 data = (CARD32 *) (vpreq + 1);
494
495 vpreq->reqType = opcode;
496 vpreq->glxCode = X_GLXVendorPrivate;
497 vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX;
498
499 data[0] = (CARD32) fbconfig->screen;
500 data[1] = (CARD32) fbconfig->fbconfigID;
501 data[2] = (CARD32) id;
502 data[3] = (CARD32) width;
503 data[4] = (CARD32) height;
504 data += 5;
505 }
506
507 (void) memcpy(data, attrib_list, sizeof(CARD32) * 2 * i);
508
509 UnlockDisplay(dpy);
510 SyncHandle();
511
512 pixmap = XCreatePixmap(dpy, RootWindow(dpy, fbconfig->screen),
513 width, height, fbconfig->rgbBits);
514
515 CreateDRIDrawable(dpy, fbconfig, pixmap, id, attrib_list, i);
516
517 return id;
518 }
519
520 /**
521 * Destroy a pbuffer.
522 *
523 * This function is used to implement \c glXDestroyPbuffer and
524 * \c glXDestroyGLXPbufferSGIX.
525 *
526 * \note
527 * This function dynamically determines whether to use the SGIX_pbuffer
528 * version of the protocol or the GLX 1.3 version of the protocol.
529 */
530 static void
531 DestroyPbuffer(Display * dpy, GLXDrawable drawable)
532 {
533 __GLXdisplayPrivate *priv = __glXInitialize(dpy);
534 CARD8 opcode;
535
536 if ((dpy == NULL) || (drawable == 0)) {
537 return;
538 }
539
540 opcode = __glXSetupForCommand(dpy);
541 if (!opcode)
542 return;
543
544 LockDisplay(dpy);
545
546 if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
547 xGLXDestroyPbufferReq *req;
548
549 GetReq(GLXDestroyPbuffer, req);
550 req->reqType = opcode;
551 req->glxCode = X_GLXDestroyPbuffer;
552 req->pbuffer = (GLXPbuffer) drawable;
553 }
554 else {
555 xGLXVendorPrivateWithReplyReq *vpreq;
556 CARD32 *data;
557
558 GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
559 data = (CARD32 *) (vpreq + 1);
560
561 data[0] = (CARD32) drawable;
562
563 vpreq->reqType = opcode;
564 vpreq->glxCode = X_GLXVendorPrivateWithReply;
565 vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX;
566 }
567
568 UnlockDisplay(dpy);
569 SyncHandle();
570
571 DestroyDRIDrawable(dpy, drawable, GL_TRUE);
572
573 return;
574 }
575
576 /**
577 * Create a new pbuffer.
578 */
579 PUBLIC GLXPbufferSGIX
580 glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
581 unsigned int width, unsigned int height,
582 int *attrib_list)
583 {
584 return (GLXPbufferSGIX) CreatePbuffer(dpy, (__GLcontextModes *) config,
585 width, height,
586 attrib_list, GL_FALSE);
587 }
588
589
590 /**
591 * Create a new pbuffer.
592 */
593 PUBLIC GLXPbuffer
594 glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
595 {
596 int i, width, height;
597
598 width = 0;
599 height = 0;
600
601 WARN_ONCE_GLX_1_3(dpy, __func__);
602
603 for (i = 0; attrib_list[i * 2]; i++) {
604 switch (attrib_list[i * 2]) {
605 case GLX_PBUFFER_WIDTH:
606 width = attrib_list[i * 2 + 1];
607 break;
608 case GLX_PBUFFER_HEIGHT:
609 height = attrib_list[i * 2 + 1];
610 break;
611 }
612 }
613
614 return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config,
615 width, height, attrib_list, GL_TRUE);
616 }
617
618
619 /**
620 * Destroy an existing pbuffer.
621 */
622 PUBLIC void
623 glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf)
624 {
625 DestroyPbuffer(dpy, pbuf);
626 }
627
628
629 /**
630 * Query an attribute of a drawable.
631 */
632 PUBLIC void
633 glXQueryDrawable(Display * dpy, GLXDrawable drawable,
634 int attribute, unsigned int *value)
635 {
636 WARN_ONCE_GLX_1_3(dpy, __func__);
637 GetDrawableAttribute(dpy, drawable, attribute, value);
638 }
639
640
641 /**
642 * Query an attribute of a pbuffer.
643 */
644 PUBLIC int
645 glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
646 int attribute, unsigned int *value)
647 {
648 return GetDrawableAttribute(dpy, drawable, attribute, value);
649 }
650
651
652 /**
653 * Select the event mask for a drawable.
654 */
655 PUBLIC void
656 glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
657 {
658 CARD32 attribs[2];
659
660 attribs[0] = (CARD32) GLX_EVENT_MASK;
661 attribs[1] = (CARD32) mask;
662
663 ChangeDrawableAttribute(dpy, drawable, attribs, 1);
664 }
665
666
667 /**
668 * Get the selected event mask for a drawable.
669 */
670 PUBLIC void
671 glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
672 {
673 unsigned int value;
674
675
676 /* The non-sense with value is required because on LP64 platforms
677 * sizeof(unsigned int) != sizeof(unsigned long). On little-endian
678 * we could just type-cast the pointer, but why?
679 */
680
681 GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
682 *mask = value;
683 }
684
685
686 PUBLIC GLXPixmap
687 glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
688 const int *attrib_list)
689 {
690 WARN_ONCE_GLX_1_3(dpy, __func__);
691
692 return CreateDrawable(dpy, (__GLcontextModes *) config,
693 (Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
694 }
695
696
697 PUBLIC GLXWindow
698 glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
699 const int *attrib_list)
700 {
701 WARN_ONCE_GLX_1_3(dpy, __func__);
702
703 return CreateDrawable(dpy, (__GLcontextModes *) config,
704 (Drawable) win, attrib_list, X_GLXCreateWindow);
705 }
706
707
708 PUBLIC void
709 glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
710 {
711 WARN_ONCE_GLX_1_3(dpy, __func__);
712
713 DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
714 }
715
716
717 PUBLIC void
718 glXDestroyWindow(Display * dpy, GLXWindow win)
719 {
720 WARN_ONCE_GLX_1_3(dpy, __func__);
721
722 DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
723 }
724
725
726 PUBLIC
727 GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
728 (Display * dpy, GLXPbufferSGIX pbuf),
729 (dpy, pbuf), glXDestroyPbuffer)
730
731 PUBLIC
732 GLX_ALIAS_VOID(glXSelectEventSGIX,
733 (Display * dpy, GLXDrawable drawable,
734 unsigned long mask), (dpy, drawable, mask), glXSelectEvent)
735
736 PUBLIC
737 GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
738 (Display * dpy, GLXDrawable drawable,
739 unsigned long *mask), (dpy, drawable, mask),
740 glXGetSelectedEvent)
741