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 */
/************************************************************/
/* Register extension with GE.
* Requires the event swap function as parameter. The function will be called
* each time an event is sent to a client with different byte order.
* Returns extension offset. This offset is to be used in all generic events
* sent to the client.
/* Register an extension with GE. The given swap function will be called each
* time an event is sent to a client with different byte order.
* @param extension The extensions major opcode
* @param ev_swap the event swap function.
*/
void GERegisterExtension(
int extension,
@ -266,7 +265,8 @@ void GERegisterExtension(
/* 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)
{
ev->type = GenericEvent;

View File

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

View File

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

View File

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

View File

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