Cleaning up a bit.

Register correct event in EventSwapVector.
Fix up event swap for GE events, register XI's swap function at GE.
This commit is contained in:
Peter Hutterer 2007-05-02 18:16:40 +09:30
parent e6fd4a24eb
commit c03d9a7217
3 changed files with 43 additions and 22 deletions

View File

@ -235,8 +235,7 @@ GEExtensionInit(void)
memset(GEExtensions, 0, sizeof(GEExtensions)); memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GEEventBase + X_GenericEvent] = EventSwapVector[X_GenericEvent] = (EventSwapPtr) SGEGenericEvent;
(EventSwapPtr) SGEGenericEvent;
} else { } else {
FatalError("GEInit: AddExtensions failed.\n"); FatalError("GEInit: AddExtensions failed.\n");
} }

View File

@ -131,5 +131,7 @@ SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from,
*to = *from; *to = *from;
swaps(&to->sequenceNumber, n); swaps(&to->sequenceNumber, n);
swapl(&to->length, n);
swapl(&to->evtype, n);
swapl(&to->time, n); swapl(&to->time, n);
} }

View File

@ -238,25 +238,6 @@ static XExtensionVersion thisversion = { XI_Present,
XI_Add_DevicePresenceNotify_Minor XI_Add_DevicePresenceNotify_Minor
}; };
/****************************************************************
*
* EventSwap for generic events coming from the GE extension.
*/
static void
XIGEEventSwap(xGenericEvent* from, xGenericEvent* to)
{
int n;
swaps(&from->sequenceNumber, n);
switch(from->evtype)
{
case XI_PointerKeyboardPairingChangedNotify:
SPointerKeyboardPairingChangedNotifyEvent
((pairingChangedNotify*)from, (pairingChangedNotify*)to);
break;
}
}
/************************************************************************* /*************************************************************************
* *
@ -700,6 +681,22 @@ SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to)
swaps(&to->eventY, n); swaps(&to->eventY, n);
} }
static void
SRawDeviceEvent(rawDeviceEvent* from, rawDeviceEvent *to)
{
char n;
int i;
CARD32* valptr;
*to = *from;
swaps(&to->sequenceNumber, n);
swapl(&to->length, n);
swapl(&to->evtype, n);
valptr = &to->valuator0;
for (i = 0; i < from->num_valuators; i++, valptr++)
swapl(valptr, n);
}
/************************************************************************** /**************************************************************************
* *
@ -994,7 +991,6 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DevicePresenceNotify] = NotImplemented; EventSwapVector[DevicePresenceNotify] = NotImplemented;
EventSwapVector[DeviceEnterNotify] = NotImplemented; EventSwapVector[DeviceEnterNotify] = NotImplemented;
EventSwapVector[DeviceLeaveNotify] = NotImplemented; EventSwapVector[DeviceLeaveNotify] = NotImplemented;
EventSwapVector[PointerKeyboardPairingChangedNotify] = NotImplemented;
RestoreExtensionEvents(); RestoreExtensionEvents();
} }
@ -1128,6 +1124,29 @@ SEventIDispatch(xEvent * from, xEvent * to)
} }
} }
/****************************************************************
*
* EventSwap for generic events coming from the GE extension.
*/
static void
XIGEEventSwap(xGenericEvent* from, xGenericEvent* to)
{
int n;
swaps(&from->sequenceNumber, n);
switch(from->evtype)
{
case XI_PointerKeyboardPairingChangedNotify:
SPointerKeyboardPairingChangedNotifyEvent
((pairingChangedNotify*)from, (pairingChangedNotify*)to);
break;
case XI_RawDeviceEvent:
SRawDeviceEvent((rawDeviceEvent*)from, (rawDeviceEvent*)to);
break;
}
}
/********************************************************************** /**********************************************************************
* *
* IExtensionInit - initialize the input extension. * IExtensionInit - initialize the input extension.
@ -1172,6 +1191,7 @@ XInputExtensionInit(void)
EventSwapVector[DeviceLeaveNotify] = SEventIDispatch; EventSwapVector[DeviceLeaveNotify] = SEventIDispatch;
/* init GE events */ /* init GE events */
GERegisterExtension(IReqCode, XIGEEventSwap);
SetGenericFilter(IReqCode, xi_filters); SetGenericFilter(IReqCode, xi_filters);
} else { } else {
FatalError("IExtensionInit: AddExtensions failed\n"); FatalError("IExtensionInit: AddExtensions failed\n");