11ab64890Smrg
21ab64890Smrg/*
31ab64890Smrg
41ab64890SmrgCopyright 1985, 1986, 1987, 1998  The Open Group
51ab64890Smrg
61ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its
71ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that
81ab64890Smrgthe above copyright notice appear in all copies and that both that
91ab64890Smrgcopyright notice and this permission notice appear in supporting
101ab64890Smrgdocumentation.
111ab64890Smrg
121ab64890SmrgThe above copyright notice and this permission notice shall be included
131ab64890Smrgin all copies or substantial portions of the Software.
141ab64890Smrg
151ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
161ab64890SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
171ab64890SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
181ab64890SmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
191ab64890SmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
201ab64890SmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
211ab64890SmrgOTHER DEALINGS IN THE SOFTWARE.
221ab64890Smrg
231ab64890SmrgExcept as contained in this notice, the name of The Open Group shall
241ab64890Smrgnot be used in advertising or otherwise to promote the sale, use or
251ab64890Smrgother dealings in this Software without prior written authorization
261ab64890Smrgfrom The Open Group.
271ab64890Smrg
281ab64890Smrg*/
291ab64890Smrg
301ab64890Smrg/*
311ab64890Smrg *	XEvToWire.c - Internal support routines for the C subroutine
321ab64890Smrg *	interface library (Xlib) to the X Window System Protocol V11.0.
331ab64890Smrg */
341ab64890Smrg
351ab64890Smrg#ifdef HAVE_CONFIG_H
361ab64890Smrg#include <config.h>
371ab64890Smrg#endif
381ab64890Smrg#include "Xlibint.h"
391ab64890Smrg
401ab64890Smrg/*
41b4ee4795Smrg * Reformat an XEvent structure to a wire event of the right type.
42b4ee4795Smrg * Return True on success.  If the type is unrecognized, return what
43b4ee4795Smrg * _XUnknownNativeEvent returns (i.e., False).
441ab64890Smrg */
451ab64890SmrgStatus
461ab64890Smrg_XEventToWire(
47b4ee4795Smrg    register Display *dpy,
48b4ee4795Smrg    register XEvent *re,        /* in: from */
49b4ee4795Smrg    register xEvent *event)     /* out: to */
501ab64890Smrg{
511ab64890Smrg	switch (event->u.u.type = re->type) {
521ab64890Smrg	      case KeyPress:
531ab64890Smrg	      case KeyRelease:
541ab64890Smrg	        {
551ab64890Smrg			register XKeyEvent *ev = (XKeyEvent*) re;
561ab64890Smrg			event->u.keyButtonPointer.root	= ev->root;
571ab64890Smrg			event->u.keyButtonPointer.event	 = ev->window;
581ab64890Smrg			event->u.keyButtonPointer.child  = ev->subwindow;
591ab64890Smrg			event->u.keyButtonPointer.time	 = ev->time;
601ab64890Smrg			event->u.keyButtonPointer.eventX = ev->x ;
611ab64890Smrg			event->u.keyButtonPointer.eventY = ev->y ;
621ab64890Smrg			event->u.keyButtonPointer.rootX	 = ev->x_root;
631ab64890Smrg			event->u.keyButtonPointer.rootY  = ev->y_root;
641ab64890Smrg			event->u.keyButtonPointer.state  = ev->state;
651ab64890Smrg			event->u.keyButtonPointer.sameScreen = ev->same_screen;
661ab64890Smrg			event->u.u.detail = ev->keycode;
671ab64890Smrg		}
681ab64890Smrg	      	break;
691ab64890Smrg	      case ButtonPress:
701ab64890Smrg	      case ButtonRelease:
711ab64890Smrg	        {
721ab64890Smrg			register XButtonEvent *ev =  (XButtonEvent *) re;
731ab64890Smrg			event->u.keyButtonPointer.root	 = ev->root;
741ab64890Smrg			event->u.keyButtonPointer.event	 = ev->window;
751ab64890Smrg			event->u.keyButtonPointer.child	 = ev->subwindow;
761ab64890Smrg			event->u.keyButtonPointer.time	 = ev->time;
771ab64890Smrg			event->u.keyButtonPointer.eventX = ev->x;
781ab64890Smrg			event->u.keyButtonPointer.eventY = ev->y;
791ab64890Smrg			event->u.keyButtonPointer.rootX	 = ev->x_root;
801ab64890Smrg			event->u.keyButtonPointer.rootY	 = ev->y_root;
811ab64890Smrg			event->u.keyButtonPointer.state	 = ev->state;
821ab64890Smrg			event->u.keyButtonPointer.sameScreen	= ev->same_screen;
831ab64890Smrg			event->u.u.detail		= ev->button;
841ab64890Smrg		}
851ab64890Smrg	        break;
861ab64890Smrg	      case MotionNotify:
871ab64890Smrg	        {
881ab64890Smrg			register XMotionEvent *ev =   (XMotionEvent *)re;
891ab64890Smrg			event->u.keyButtonPointer.root	= ev->root;
901ab64890Smrg			event->u.keyButtonPointer.event	= ev->window;
911ab64890Smrg			event->u.keyButtonPointer.child	= ev->subwindow;
921ab64890Smrg			event->u.keyButtonPointer.time	= ev->time;
931ab64890Smrg			event->u.keyButtonPointer.eventX= ev->x;
941ab64890Smrg			event->u.keyButtonPointer.eventY= ev->y;
951ab64890Smrg			event->u.keyButtonPointer.rootX	= ev->x_root;
961ab64890Smrg			event->u.keyButtonPointer.rootY	= ev->y_root;
971ab64890Smrg			event->u.keyButtonPointer.state	= ev->state;
981ab64890Smrg			event->u.keyButtonPointer.sameScreen= ev->same_screen;
991ab64890Smrg			event->u.u.detail		= ev->is_hint;
1001ab64890Smrg		}
1011ab64890Smrg	        break;
1021ab64890Smrg	      case EnterNotify:
1031ab64890Smrg	      case LeaveNotify:
1041ab64890Smrg		{
1051ab64890Smrg			register XCrossingEvent *ev   = (XCrossingEvent *) re;
1061ab64890Smrg			event->u.enterLeave.root	= ev->root;
1071ab64890Smrg			event->u.enterLeave.event	= ev->window;
1081ab64890Smrg			event->u.enterLeave.child	= ev->subwindow;
1091ab64890Smrg			event->u.enterLeave.time	= ev->time;
1101ab64890Smrg			event->u.enterLeave.eventX	= ev->x;
1111ab64890Smrg			event->u.enterLeave.eventY	= ev->y;
1121ab64890Smrg			event->u.enterLeave.rootX	= ev->x_root;
1131ab64890Smrg			event->u.enterLeave.rootY	= ev->y_root;
1141ab64890Smrg			event->u.enterLeave.state	= ev->state;
1151ab64890Smrg			event->u.enterLeave.mode	= ev->mode;
1161ab64890Smrg			event->u.enterLeave.flags	= 0;
1171ab64890Smrg			if (ev->same_screen) {
1181ab64890Smrg				event->u.enterLeave.flags |= ELFlagSameScreen;
1191ab64890Smrg				}
1201ab64890Smrg			if (ev->focus) {
1211ab64890Smrg				event->u.enterLeave.flags |= ELFlagFocus;
1221ab64890Smrg				}
1231ab64890Smrg			event->u.u.detail		= ev->detail;
1241ab64890Smrg		}
1251ab64890Smrg		  break;
1261ab64890Smrg	      case FocusIn:
1271ab64890Smrg	      case FocusOut:
1281ab64890Smrg		{
1291ab64890Smrg			register XFocusChangeEvent *ev = (XFocusChangeEvent *) re;
1301ab64890Smrg			event->u.focus.window	= ev->window;
1311ab64890Smrg			event->u.focus.mode	= ev->mode;
1321ab64890Smrg			event->u.u.detail	= ev->detail;
1331ab64890Smrg		}
1341ab64890Smrg		  break;
1351ab64890Smrg	      case KeymapNotify:
1361ab64890Smrg		{
1371ab64890Smrg			register XKeymapEvent *ev = (XKeymapEvent *) re;
1381ab64890Smrg			memcpy ((char *)(((xKeymapEvent *) event)->map),
1391ab64890Smrg				&ev->key_vector[1],
1401ab64890Smrg				sizeof (((xKeymapEvent *) event)->map));
1411ab64890Smrg		}
1421ab64890Smrg		break;
1431ab64890Smrg	      case Expose:
1441ab64890Smrg		{
1451ab64890Smrg			register XExposeEvent *ev = (XExposeEvent *) re;
1461ab64890Smrg			event->u.expose.window		= ev->window;
1471ab64890Smrg			event->u.expose.x		= ev->x;
1481ab64890Smrg			event->u.expose.y		= ev->y;
1491ab64890Smrg			event->u.expose.width		= ev->width;
1501ab64890Smrg			event->u.expose.height		= ev->height;
1511ab64890Smrg			event->u.expose.count		= ev->count;
1521ab64890Smrg		}
1531ab64890Smrg		break;
1541ab64890Smrg	      case GraphicsExpose:
1551ab64890Smrg		{
1561ab64890Smrg		    register XGraphicsExposeEvent *ev =
1571ab64890Smrg			(XGraphicsExposeEvent *) re;
1581ab64890Smrg		    event->u.graphicsExposure.drawable	= ev->drawable;
1591ab64890Smrg		    event->u.graphicsExposure.x		= ev->x;
1601ab64890Smrg		    event->u.graphicsExposure.y		= ev->y;
1611ab64890Smrg		    event->u.graphicsExposure.width	= ev->width;
1621ab64890Smrg		    event->u.graphicsExposure.height	= ev->height;
1631ab64890Smrg		    event->u.graphicsExposure.count	= ev->count;
1641ab64890Smrg		    event->u.graphicsExposure.majorEvent= ev->major_code;
1651ab64890Smrg		    event->u.graphicsExposure.minorEvent= ev->minor_code;
1661ab64890Smrg		}
1671ab64890Smrg		break;
1681ab64890Smrg	      case NoExpose:
1691ab64890Smrg		{
1701ab64890Smrg		    register XNoExposeEvent *ev = (XNoExposeEvent *) re;
1711ab64890Smrg		    event->u.noExposure.drawable	= ev->drawable;
1721ab64890Smrg		    event->u.noExposure.majorEvent	= ev->major_code;
1731ab64890Smrg		    event->u.noExposure.minorEvent	= ev->minor_code;
1741ab64890Smrg		}
1751ab64890Smrg		break;
1761ab64890Smrg	      case VisibilityNotify:
1771ab64890Smrg		{
1781ab64890Smrg		    register XVisibilityEvent *ev = (XVisibilityEvent *) re;
1791ab64890Smrg		    event->u.visibility.window		= ev->window;
1801ab64890Smrg		    event->u.visibility.state		= ev->state;
1811ab64890Smrg		}
1821ab64890Smrg		break;
1831ab64890Smrg	      case CreateNotify:
1841ab64890Smrg		{
1851ab64890Smrg		    register XCreateWindowEvent *ev =
1861ab64890Smrg			 (XCreateWindowEvent *) re;
1871ab64890Smrg		    event->u.createNotify.window	= ev->window;
1881ab64890Smrg		    event->u.createNotify.parent	= ev->parent;
1891ab64890Smrg		    event->u.createNotify.x		= ev->x;
1901ab64890Smrg		    event->u.createNotify.y		= ev->y;
1911ab64890Smrg		    event->u.createNotify.width		= ev->width;
1921ab64890Smrg		    event->u.createNotify.height	= ev->height;
1931ab64890Smrg		    event->u.createNotify.borderWidth	= ev->border_width;
1941ab64890Smrg		    event->u.createNotify.override	= ev->override_redirect;
1951ab64890Smrg		}
1961ab64890Smrg		break;
1971ab64890Smrg	      case DestroyNotify:
1981ab64890Smrg		{
1991ab64890Smrg		    register XDestroyWindowEvent *ev =
2001ab64890Smrg				(XDestroyWindowEvent *) re;
2011ab64890Smrg		    event->u.destroyNotify.window	= ev->window;
2021ab64890Smrg		    event->u.destroyNotify.event	= ev->event;
2031ab64890Smrg		}
2041ab64890Smrg		break;
2051ab64890Smrg	      case UnmapNotify:
2061ab64890Smrg		{
2071ab64890Smrg		    register XUnmapEvent *ev = (XUnmapEvent *) re;
2081ab64890Smrg		    event->u.unmapNotify.window	= ev->window;
2091ab64890Smrg		    event->u.unmapNotify.event	= ev->event;
2101ab64890Smrg		    event->u.unmapNotify.fromConfigure	= ev->from_configure;
2111ab64890Smrg		}
2121ab64890Smrg		break;
2131ab64890Smrg	      case MapNotify:
2141ab64890Smrg		{
2151ab64890Smrg		    register XMapEvent *ev = (XMapEvent *) re;
2161ab64890Smrg		    event->u.mapNotify.window	= ev->window;
2171ab64890Smrg		    event->u.mapNotify.event	= ev->event;
2181ab64890Smrg		    event->u.mapNotify.override	= ev->override_redirect;
2191ab64890Smrg		}
2201ab64890Smrg		break;
2211ab64890Smrg	      case MapRequest:
2221ab64890Smrg		{
2231ab64890Smrg		    register XMapRequestEvent *ev = (XMapRequestEvent *) re;
2241ab64890Smrg		    event->u.mapRequest.window	= ev->window;
2251ab64890Smrg		    event->u.mapRequest.parent	= ev->parent;
2261ab64890Smrg		}
2271ab64890Smrg		break;
2281ab64890Smrg	      case ReparentNotify:
2291ab64890Smrg		{
2301ab64890Smrg		    register XReparentEvent *ev = (XReparentEvent *) re;
2311ab64890Smrg		    event->u.reparent.window	= ev->window;
2321ab64890Smrg		    event->u.reparent.event	= ev->event;
2331ab64890Smrg		    event->u.reparent.parent	= ev->parent;
2341ab64890Smrg		    event->u.reparent.x		= ev->x;
2351ab64890Smrg		    event->u.reparent.y		= ev->y;
2361ab64890Smrg		    event->u.reparent.override	= ev->override_redirect;
2371ab64890Smrg		}
2381ab64890Smrg		break;
2391ab64890Smrg	      case ConfigureNotify:
2401ab64890Smrg		{
2411ab64890Smrg		    register XConfigureEvent *ev = (XConfigureEvent *) re;
2421ab64890Smrg		    event->u.configureNotify.window	= ev->window;
2431ab64890Smrg		    event->u.configureNotify.event	= ev->event;
2441ab64890Smrg		    event->u.configureNotify.aboveSibling	= ev->above;
2451ab64890Smrg		    event->u.configureNotify.x		= ev->x;
2461ab64890Smrg		    event->u.configureNotify.y		= ev->y;
2471ab64890Smrg		    event->u.configureNotify.width	= ev->width;
2481ab64890Smrg		    event->u.configureNotify.height	= ev->height;
2491ab64890Smrg		    event->u.configureNotify.borderWidth= ev->border_width;
2501ab64890Smrg		    event->u.configureNotify.override	= ev->override_redirect;
2511ab64890Smrg		}
2521ab64890Smrg		break;
2531ab64890Smrg	      case ConfigureRequest:
2541ab64890Smrg		{
2551ab64890Smrg		    register XConfigureRequestEvent *ev =
2561ab64890Smrg		        (XConfigureRequestEvent *) re;
2571ab64890Smrg		    event->u.configureRequest.window	= ev->window;
2581ab64890Smrg		    event->u.configureRequest.parent	= ev->parent;
2591ab64890Smrg		    event->u.configureRequest.sibling   = ev->above;
2601ab64890Smrg		    event->u.configureRequest.x		= ev->x;
2611ab64890Smrg		    event->u.configureRequest.y		= ev->y;
2621ab64890Smrg		    event->u.configureRequest.width	= ev->width;
2631ab64890Smrg		    event->u.configureRequest.height	= ev->height;
2641ab64890Smrg		    event->u.configureRequest.borderWidth= ev->border_width;
2651ab64890Smrg		    event->u.configureRequest.valueMask= ev->value_mask;
2661ab64890Smrg		    event->u.u.detail 			= ev->detail;
2671ab64890Smrg		}
2681ab64890Smrg		break;
2691ab64890Smrg	      case GravityNotify:
2701ab64890Smrg		{
2711ab64890Smrg		    register XGravityEvent *ev  = (XGravityEvent *) re;
2721ab64890Smrg		    event->u.gravity.window	= ev->window;
2731ab64890Smrg		    event->u.gravity.event	= ev->event;
2741ab64890Smrg		    event->u.gravity.x		= ev->x;
2751ab64890Smrg		    event->u.gravity.y		= ev->y;
2761ab64890Smrg		}
2771ab64890Smrg		break;
2781ab64890Smrg	      case ResizeRequest:
2791ab64890Smrg		{
2801ab64890Smrg		    register XResizeRequestEvent *ev =
2811ab64890Smrg			(XResizeRequestEvent *) re;
2821ab64890Smrg		    event->u.resizeRequest.window	= ev->window;
2831ab64890Smrg		    event->u.resizeRequest.width	= ev->width;
2841ab64890Smrg		    event->u.resizeRequest.height	= ev->height;
2851ab64890Smrg		}
2861ab64890Smrg		break;
2871ab64890Smrg	      case CirculateNotify:
2881ab64890Smrg		{
2891ab64890Smrg		    register XCirculateEvent *ev = (XCirculateEvent *) re;
2901ab64890Smrg		    event->u.circulate.window		= ev->window;
2911ab64890Smrg		    event->u.circulate.event		= ev->event;
2921ab64890Smrg		    event->u.circulate.place		= ev->place;
2931ab64890Smrg		}
2941ab64890Smrg		break;
2951ab64890Smrg	      case CirculateRequest:
2961ab64890Smrg		{
2971ab64890Smrg		    register XCirculateRequestEvent *ev =
2981ab64890Smrg		        (XCirculateRequestEvent *) re;
2991ab64890Smrg		    event->u.circulate.window		= ev->window;
3001ab64890Smrg		    event->u.circulate.event		= ev->parent;
3011ab64890Smrg		    event->u.circulate.place		= ev->place;
3021ab64890Smrg		}
3031ab64890Smrg		break;
3041ab64890Smrg	      case PropertyNotify:
3051ab64890Smrg		{
3061ab64890Smrg		    register XPropertyEvent *ev = (XPropertyEvent *) re;
3071ab64890Smrg		    event->u.property.window		= ev->window;
3081ab64890Smrg		    event->u.property.atom		= ev->atom;
3091ab64890Smrg		    event->u.property.time		= ev->time;
3101ab64890Smrg		    event->u.property.state		= ev->state;
3111ab64890Smrg		}
3121ab64890Smrg		break;
3131ab64890Smrg	      case SelectionClear:
3141ab64890Smrg		{
3151ab64890Smrg		    register XSelectionClearEvent *ev =
3161ab64890Smrg			 (XSelectionClearEvent *) re;
3171ab64890Smrg		    event->u.selectionClear.window	= ev->window;
3181ab64890Smrg		    event->u.selectionClear.atom	= ev->selection;
3191ab64890Smrg		    event->u.selectionClear.time	= ev->time;
3201ab64890Smrg		}
3211ab64890Smrg		break;
3221ab64890Smrg	      case SelectionRequest:
3231ab64890Smrg		{
3241ab64890Smrg		    register XSelectionRequestEvent *ev =
3251ab64890Smrg		        (XSelectionRequestEvent *) re;
3261ab64890Smrg		    event->u.selectionRequest.owner	= ev->owner;
3271ab64890Smrg		    event->u.selectionRequest.requestor	= ev->requestor;
3281ab64890Smrg		    event->u.selectionRequest.selection	= ev->selection;
3291ab64890Smrg		    event->u.selectionRequest.target	= ev->target;
3301ab64890Smrg		    event->u.selectionRequest.property	= ev->property;
3311ab64890Smrg		    event->u.selectionRequest.time	= ev->time;
3321ab64890Smrg		}
3331ab64890Smrg		break;
3341ab64890Smrg	      case SelectionNotify:
3351ab64890Smrg		{
3361ab64890Smrg		    register XSelectionEvent *ev = (XSelectionEvent *) re;
3371ab64890Smrg		    event->u.selectionNotify.requestor	= ev->requestor;
3381ab64890Smrg		    event->u.selectionNotify.selection	= ev->selection;
3391ab64890Smrg		    event->u.selectionNotify.target	= ev->target;
3401ab64890Smrg		    event->u.selectionNotify.property	= ev->property;
3411ab64890Smrg		    event->u.selectionNotify.time	= ev->time;
3421ab64890Smrg		}
3431ab64890Smrg		break;
3441ab64890Smrg	      case ColormapNotify:
3451ab64890Smrg		{
3461ab64890Smrg		    register XColormapEvent *ev = (XColormapEvent *) re;
3471ab64890Smrg		    event->u.colormap.window		= ev->window;
3481ab64890Smrg		    event->u.colormap.colormap		= ev->colormap;
3491ab64890Smrg		    event->u.colormap.new		= ev->new;
3501ab64890Smrg		    event->u.colormap.state		= ev->state;
3511ab64890Smrg	        }
3521ab64890Smrg		break;
3531ab64890Smrg	      case ClientMessage:
3541ab64890Smrg		{
3551ab64890Smrg		   register int i;
35661b2299dSmrg		   register XClientMessageEvent *ev
3571ab64890Smrg		   			= (XClientMessageEvent *) re;
3581ab64890Smrg		   event->u.clientMessage.window = ev->window;
3591ab64890Smrg		   event->u.u.detail		 = ev->format;
3601ab64890Smrg		   switch (ev->format) {
36161b2299dSmrg			case 8:
3621ab64890Smrg			  event->u.clientMessage.u.b.type   = ev->message_type;
3631ab64890Smrg			  for (i = 0; i < 20; i++)
3641ab64890Smrg			   event->u.clientMessage.u.b.bytes[i] = ev->data.b[i];
3651ab64890Smrg			  break;
3661ab64890Smrg			case 16:
3671ab64890Smrg			  event->u.clientMessage.u.s.type   = ev->message_type;
3681ab64890Smrg			  event->u.clientMessage.u.s.shorts0   = ev->data.s[0];
3691ab64890Smrg			  event->u.clientMessage.u.s.shorts1   = ev->data.s[1];
3701ab64890Smrg			  event->u.clientMessage.u.s.shorts2   = ev->data.s[2];
3711ab64890Smrg			  event->u.clientMessage.u.s.shorts3   = ev->data.s[3];
3721ab64890Smrg			  event->u.clientMessage.u.s.shorts4   = ev->data.s[4];
3731ab64890Smrg			  event->u.clientMessage.u.s.shorts5   = ev->data.s[5];
3741ab64890Smrg			  event->u.clientMessage.u.s.shorts6   = ev->data.s[6];
3751ab64890Smrg			  event->u.clientMessage.u.s.shorts7   = ev->data.s[7];
3761ab64890Smrg			  event->u.clientMessage.u.s.shorts8   = ev->data.s[8];
3771ab64890Smrg			  event->u.clientMessage.u.s.shorts9   = ev->data.s[9];
3781ab64890Smrg			  break;
3791ab64890Smrg			case 32:
3801ab64890Smrg			  event->u.clientMessage.u.l.type   = ev->message_type;
3811ab64890Smrg			  event->u.clientMessage.u.l.longs0   = ev->data.l[0];
3821ab64890Smrg			  event->u.clientMessage.u.l.longs1   = ev->data.l[1];
3831ab64890Smrg			  event->u.clientMessage.u.l.longs2   = ev->data.l[2];
3841ab64890Smrg			  event->u.clientMessage.u.l.longs3   = ev->data.l[3];
3851ab64890Smrg			  event->u.clientMessage.u.l.longs4   = ev->data.l[4];
3861ab64890Smrg			  break;
3871ab64890Smrg			default:
3881ab64890Smrg			  /* client passing bogus data, let server complain */
3891ab64890Smrg			  break;
3901ab64890Smrg			}
3911ab64890Smrg		    }
3921ab64890Smrg		break;
3931ab64890Smrg	      case MappingNotify:
3941ab64890Smrg		  {
3951ab64890Smrg		    register XMappingEvent *ev = (XMappingEvent *) re;
3961ab64890Smrg		    event->u.mappingNotify.firstKeyCode = ev->first_keycode;
3971ab64890Smrg		    event->u.mappingNotify.request 	= ev->request;
3981ab64890Smrg		    event->u.mappingNotify.count	= ev->count;
3991ab64890Smrg		   }
4001ab64890Smrg		break;
40161b2299dSmrg
4021ab64890Smrg	      default:
4031ab64890Smrg		return(_XUnknownNativeEvent(dpy, re, event));
4041ab64890Smrg	}
4051ab64890Smrg	return(1);
4061ab64890Smrg}
407