aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/dispatch.c23
-rw-r--r--xorg-server/dix/events.c25
-rw-r--r--xorg-server/dix/extension.c14
3 files changed, 26 insertions, 36 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 6e3361573..b39271fd9 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -337,8 +337,6 @@ DisableLimitedSchedulingLatency(void)
SmartScheduleLatencyLimited = 0;
}
-#define MAJOROP ((xReq *)client->requestBuffer)->reqType
-
void
Dispatch(void)
{
@@ -419,21 +417,28 @@ Dispatch(void)
}
client->sequence++;
+ client->majorOp = ((xReq *)client->requestBuffer)->reqType;
+ client->minorOp = 0;
+ if (client->majorOp >= EXTENSION_BASE) {
+ ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
+ if (ext)
+ client->minorOp = ext->MinorOpcode(client);
+ }
#ifdef XSERVER_DTRACE
- XSERVER_REQUEST_START(LookupMajorName(MAJOROP), MAJOROP,
+ XSERVER_REQUEST_START(LookupMajorName(client->majorOp), client->majorOp,
((xReq *)client->requestBuffer)->length,
client->index, client->requestBuffer);
#endif
if (result > (maxBigRequestSize << 2))
result = BadLength;
else {
- result = XaceHookDispatch(client, MAJOROP);
+ result = XaceHookDispatch(client, client->majorOp);
if (result == Success)
- result = (* client->requestVector[MAJOROP])(client);
+ result = (* client->requestVector[client->majorOp])(client);
XaceHookAuditEnd(client, result);
}
#ifdef XSERVER_DTRACE
- XSERVER_REQUEST_DONE(LookupMajorName(MAJOROP), MAJOROP,
+ XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp), client->majorOp,
client->sequence, client->index, result);
#endif
@@ -444,8 +449,8 @@ Dispatch(void)
}
else if (result != Success)
{
- SendErrorToClient(client, MAJOROP,
- MinorOpcodeOfRequest(client),
+ SendErrorToClient(client, client->majorOp,
+ client->minorOp,
client->errorValue, result);
break;
}
@@ -466,8 +471,6 @@ Dispatch(void)
SmartScheduleLatencyLimited = 0;
}
-#undef MAJOROP
-
static int VendorRelease = VENDOR_RELEASE;
static char *VendorString = VENDOR_NAME;
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 5e0dc5f17..4847db005 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -469,10 +469,11 @@ GetXI2MaskByte(unsigned char xi2mask[][XI2MASKSIZE], DeviceIntPtr dev, int event
/**
- * Return the windows complete XI2 mask for the given XI2 event type.
+ * @return TRUE if the mask is set for this event from this device on the
+ * window, or FALSE otherwise.
*/
-Mask
-GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
+Bool
+WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
{
OtherInputMasks *inputMasks = wOtherInputMasks(win);
int filter;
@@ -484,7 +485,7 @@ GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
evtype = ((xGenericEvent*)ev)->evtype;
filter = GetEventFilter(dev, ev);
- return (GetXI2MaskByte(inputMasks->xi2mask, dev, evtype) & filter);
+ return !!(GetXI2MaskByte(inputMasks->xi2mask, dev, evtype) & filter);
}
Mask
@@ -2075,7 +2076,7 @@ GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
{
OtherInputMasks *inputMasks = wOtherInputMasks(win);
/* Has any client selected for the event? */
- if (!GetWindowXI2Mask(dev, win, events))
+ if (!WindowXI2MaskIsset(dev, win, events))
goto out;
*clients = inputMasks->inputClients;
} else {
@@ -3787,14 +3788,13 @@ CheckPassiveGrabsOnWindow(
}
if (!activate)
- {
- return grab;
- }
+ break;
else if (!GetXIType(event) && !GetCoreType(event))
{
ErrorF("Event type %d in CheckPassiveGrabsOnWindow is neither"
" XI 1.x nor core\n", event->any.type);
- return NULL;
+ grab = NULL;
+ break;
}
/* The only consumers of corestate are Xi 1.x and core events, which
@@ -3860,9 +3860,10 @@ CheckPassiveGrabsOnWindow(
}
free(xE);
- return grab;
+ break;
}
- return NULL;
+
+ return grab;
#undef CORE_MATCH
#undef XI_MATCH
#undef XI2_MATCH
@@ -4632,7 +4633,7 @@ DeviceEnterLeaveEvent(
TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask,
filter, grab);
} else {
- if (!GetWindowXI2Mask(mouse, pWin, (xEvent*)event))
+ if (!WindowXI2MaskIsset(mouse, pWin, (xEvent*)event))
goto out;
DeliverEventsToWindow(mouse, pWin, (xEvent*)event, 1, filter,
NullGrab);
diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c
index 53aaf051f..cc516b6ba 100644
--- a/xorg-server/dix/extension.c
+++ b/xorg-server/dix/extension.c
@@ -228,20 +228,6 @@ StandardMinorOpcode(ClientPtr client)
return ((xReq *)client->requestBuffer)->data;
}
-unsigned short
-MinorOpcodeOfRequest(ClientPtr client)
-{
- unsigned char major;
-
- major = ((xReq *)client->requestBuffer)->reqType;
- if (major < EXTENSION_BASE)
- return 0;
- major -= EXTENSION_BASE;
- if (major >= NumExtensions)
- return 0;
- return (*extensions[major]->MinorOpcode)(client);
-}
-
void
CloseDownExtensions(void)
{