Clean up, correct some comments.

Send event type down with the RawEvents.
This commit is contained in:
Peter Hutterer 2007-05-17 17:59:02 +09:30
parent bc334286b0
commit 333bab4b23
6 changed files with 19 additions and 29 deletions

View File

@ -246,11 +246,10 @@ GEExtensionInit(void)
/* interface for extensions */ /* interface for extensions */
/************************************************************/ /************************************************************/
/* Register extension with GE. /* Register an extension with GE. The given swap function will be called each
* Requires the event swap function as parameter. The function will be called * time an event is sent to a client with different byte order.
* each time an event is sent to a client with different byte order. * @param extension The extensions major opcode
* Returns extension offset. This offset is to be used in all generic events * @param ev_swap the event swap function.
* sent to the client.
*/ */
void GERegisterExtension( void GERegisterExtension(
int extension, int extension,
@ -266,7 +265,8 @@ void GERegisterExtension(
/* Sets type and extension field for a generic event. This is just an /* Sets type and extension field for a generic event. This is just an
* auxiliary function, extensions could do it manually too. */ * auxiliary function, extensions could do it manually too.
*/
void GEInitEvent(xGenericEvent* ev, int extension) void GEInitEvent(xGenericEvent* ev, int extension)
{ {
ev->type = GenericEvent; ev->type = GenericEvent;

View File

@ -51,7 +51,6 @@ from the author.
(((pWin)->optional) ? (pWin)->optional->geMasks->geClients : NULL) (((pWin)->optional) ? (pWin)->optional->geMasks->geClients : NULL)
/* Interface for other extensions */ /* Interface for other extensions */
Mask GENextMask(int extension);
void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask); void GEWindowSetMask(ClientPtr pClient, WindowPtr pWin, int extension, Mask mask);
void GERegisterExtension( void GERegisterExtension(
int extension, int extension,

View File

@ -52,7 +52,6 @@ extern Mask DeviceButtonMotionMask;
extern Mask DevicePresenceNotifyMask; extern Mask DevicePresenceNotifyMask;
extern Mask DeviceEnterWindowMask; extern Mask DeviceEnterWindowMask;
extern Mask DeviceLeaveWindowMask; extern Mask DeviceLeaveWindowMask;
extern Mask PointerKeyboardPairingChangedNotifyMask;
extern Mask PropagateMask[]; extern Mask PropagateMask[];
extern int DeviceValuator; extern int DeviceValuator;
@ -73,7 +72,6 @@ extern int ChangeDeviceNotify;
extern int DevicePresenceNotify; extern int DevicePresenceNotify;
extern int DeviceEnterNotify; extern int DeviceEnterNotify;
extern int DeviceLeaveNotify; extern int DeviceLeaveNotify;
extern int PointerKeyboardPairingChangedNotify;
extern int RT_INPUTCLIENT; extern int RT_INPUTCLIENT;

View File

@ -134,6 +134,10 @@ Mask ExtValidMasks[EMASKSIZE];
Mask ExtExclusiveMasks[EMASKSIZE]; Mask ExtExclusiveMasks[EMASKSIZE];
/**
* Filters for various generic events.
* Evtype is index, mask is value at index.
*/
static Mask xi_filters[3] = { static Mask xi_filters[3] = {
XI_PointerKeyboardPairingChangedMask, XI_PointerKeyboardPairingChangedMask,
XI_RandomStringMask, XI_RandomStringMask,
@ -213,9 +217,6 @@ int DevicePresenceNotify;
int DeviceEnterNotify; int DeviceEnterNotify;
int DeviceLeaveNotify; int DeviceLeaveNotify;
/* GE events */
int PointerKeyboardPairingChangedNotify;
int RT_INPUTCLIENT; int RT_INPUTCLIENT;
/***************************************************************** /*****************************************************************
@ -828,10 +829,6 @@ FixExtensionEvents(ExtensionEntry * extEntry)
DeviceEnterNotify = DevicePresenceNotify + 1; DeviceEnterNotify = DevicePresenceNotify + 1;
DeviceLeaveNotify = DeviceEnterNotify + 1; DeviceLeaveNotify = DeviceEnterNotify + 1;
/* GE Events */
PointerKeyboardPairingChangedNotify =
XI_PointerKeyboardPairingChangedNotify;
event_base[KeyClass] = DeviceKeyPress; event_base[KeyClass] = DeviceKeyPress;
event_base[ButtonClass] = DeviceButtonPress; event_base[ButtonClass] = DeviceButtonPress;
event_base[ValuatorClass] = DeviceMotionNotify; event_base[ValuatorClass] = DeviceMotionNotify;

View File

@ -1523,10 +1523,6 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
ComputeFreezes(); ComputeFreezes();
} }
/*
* Core flag decides whether to work on the deviceGrab or deviceGrab sync
* fields.
*/
void void
AllowSome(ClientPtr client, AllowSome(ClientPtr client,
TimeStamp time, TimeStamp time,
@ -1538,7 +1534,7 @@ AllowSome(ClientPtr client,
TimeStamp grabTime; TimeStamp grabTime;
DeviceIntPtr dev; DeviceIntPtr dev;
GrabInfoPtr devgrabinfo, GrabInfoPtr devgrabinfo,
grabinfo = (core) ? &thisDev->deviceGrab : &thisDev->deviceGrab; grabinfo = &thisDev->deviceGrab;
thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client); thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client);
thisSynced = FALSE; thisSynced = FALSE;
@ -1547,7 +1543,7 @@ AllowSome(ClientPtr client,
grabTime = grabinfo->grabTime; grabTime = grabinfo->grabTime;
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
devgrabinfo = (core) ? &dev->deviceGrab : &dev->deviceGrab; devgrabinfo = &dev->deviceGrab;
if (dev == thisDev) if (dev == thisDev)
continue; continue;
@ -1593,7 +1589,7 @@ AllowSome(ClientPtr client,
{ {
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
devgrabinfo = (core) ? &dev->deviceGrab : &dev->deviceGrab; devgrabinfo = &dev->deviceGrab;
if (devgrabinfo->grab if (devgrabinfo->grab
&& SameClient(devgrabinfo->grab, client)) && SameClient(devgrabinfo->grab, client))
devgrabinfo->sync.state = THAWED; devgrabinfo->sync.state = THAWED;
@ -1609,7 +1605,7 @@ AllowSome(ClientPtr client,
{ {
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
devgrabinfo = (core) ? &dev->deviceGrab : &dev->deviceGrab; devgrabinfo = &dev->deviceGrab;
if (devgrabinfo->grab if (devgrabinfo->grab
&& SameClient(devgrabinfo->grab, client)) && SameClient(devgrabinfo->grab, client))
devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT; devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT;
@ -1902,7 +1898,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
if (type == GenericEvent) if (type == GenericEvent)
{ {
GEClientPtr pClient; GEClientPtr pClient;
/* FIXME: We don't do more than one GenericEvent at a time yet. */ /* We don't do more than one GenericEvent at a time. */
if (count > 1) if (count > 1)
{ {
ErrorF("Do not send more than one GenericEvent at a time!\n"); ErrorF("Do not send more than one GenericEvent at a time!\n");
@ -3013,8 +3009,7 @@ CheckPassiveGrabsOnWindow(
tempGrab.modifiersDetail.exact&(~0x1f00); tempGrab.modifiersDetail.exact&(~0x1f00);
} }
#endif #endif
grabinfo = (xE->u.u.type & EXTENSION_EVENT_BASE) ? grabinfo = &device->deviceGrab;
&device->deviceGrab : &device->deviceGrab;
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
FixUpEventFromWindow(device, xE, grab->window, None, TRUE); FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
@ -4703,7 +4698,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
GrabPtr grab; GrabPtr grab;
TimeStamp time; TimeStamp time;
int rc; int rc;
GrabInfoPtr grabInfo = (deviceGrab) ? &dev->deviceGrab : &dev->deviceGrab; GrabInfoPtr grabInfo = &dev->deviceGrab;
UpdateCurrentTime(); UpdateCurrentTime();
if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
@ -4751,7 +4746,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
tempGrab.eventMask = mask; tempGrab.eventMask = mask;
tempGrab.device = dev; tempGrab.device = dev;
tempGrab.cursor = NULL; tempGrab.cursor = NULL;
tempGrab.coreGrab = deviceGrab; tempGrab.coreGrab = (deviceGrab) ? FALSE : TRUE;
tempGrab.genericMasks = NULL; tempGrab.genericMasks = NULL;
(*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE); (*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE);

View File

@ -603,6 +603,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
ev->evtype = XI_RawDeviceEvent; ev->evtype = XI_RawDeviceEvent;
ev->extension = IReqCode; ev->extension = IReqCode;
ev->length = (num_valuators > 4) ? (num_valuators - 4) : 0; ev->length = (num_valuators > 4) ? (num_valuators - 4) : 0;
ev->event_type = type;
ev->buttons = buttons; ev->buttons = buttons;
ev->num_valuators = num_valuators; ev->num_valuators = num_valuators;
ev->first_valuator = first_valuator; ev->first_valuator = first_valuator;