[PATCH 4/3] Use WriteEventsToClient rather than TryClientEvents where possible.
Jamey Sharp
jamey at minilop.net
Sat May 15 16:08:14 PDT 2010
If filter is NoEventMask (aka CantBeFiltered), grab is null, and the
first event is not in the set of "critical events", then TryClientEvents
simply calls WriteEventsToClient. In that case, it returns 0 for fake or
dead clients, and 1 otherwise. Inline for this special case.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
On Sat, May 15, 2010 at 2:40 PM, Keith Packard <keithp at keithp.com> wrote:
> I'd say Xv should be using WriteEventsToClient as it's not sending an
> input event.
OK, that makes sense, though I still think "xv: TryClientEvents already
checks client and sets sequenceNumber" is worth applying on its own, and
the below patch is only right if "Make WriteEventsToClient/WriteToClient
no-op" is applied first.
Xext/xvmain.c | 6 ++----
dix/selection.c | 12 ++++++------
mi/miexpose.c | 5 +++--
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 45d5946..f6d39d0 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -535,8 +535,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
event.u.videoNotify.drawable = pDraw->id;
event.u.videoNotify.port = pPort->id;
event.u.videoNotify.reason = reason;
- TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1,
- NoEventMask, NoEventMask, NullGrab);
+ WriteEventsToClient(pn->client, 1, (xEventPtr)&event);
pn = pn->next;
}
@@ -563,8 +562,7 @@ XvdiSendPortNotify(
event.u.portNotify.port = pPort->id;
event.u.portNotify.attribute = attribute;
event.u.portNotify.value = value;
- TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1,
- NoEventMask, NoEventMask, NullGrab);
+ WriteEventsToClient(pn->client, 1, (xEventPtr)&event);
pn = pn->next;
}
diff --git a/dix/selection.c b/dix/selection.c
index 4f592d1..f52638c 100644
--- a/dix/selection.c
+++ b/dix/selection.c
@@ -189,8 +189,7 @@ ProcSetSelectionOwner(ClientPtr client)
event.u.selectionClear.time = time.milliseconds;
event.u.selectionClear.window = pSel->window;
event.u.selectionClear.atom = pSel->selection;
- TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask,
- NoEventMask /* CantBeFiltered */, NullGrab);
+ WriteEventsToClient(pSel->client, 1, &event);
}
}
else if (rc == BadMatch)
@@ -296,9 +295,11 @@ ProcConvertSelection(ClientPtr client)
event.u.selectionRequest.selection = stuff->selection;
event.u.selectionRequest.target = stuff->target;
event.u.selectionRequest.property = stuff->property;
- if (TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask,
- NoEventMask /* CantBeFiltered */, NullGrab))
+ if (pSel->client && pSel->client != serverClient && !pSel->client->clientGone)
+ {
+ WriteEventsToClient(pSel->client, 1, &event);
return Success;
+ }
}
event.u.u.type = SelectionNotify;
@@ -307,7 +308,6 @@ ProcConvertSelection(ClientPtr client)
event.u.selectionNotify.selection = stuff->selection;
event.u.selectionNotify.target = stuff->target;
event.u.selectionNotify.property = None;
- TryClientEvents(client, NULL, &event, 1, NoEventMask,
- NoEventMask /* CantBeFiltered */, NullGrab);
+ WriteEventsToClient(client, 1, &event);
return Success;
}
diff --git a/mi/miexpose.c b/mi/miexpose.c
index a50dc5e..57968dd 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -374,6 +374,8 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
pe->u.graphicsExposure.majorEvent = major;
pe->u.graphicsExposure.minorEvent = minor;
}
+ /* GraphicsExpose is a "critical event", which TryClientEvents
+ * handles specially. */
TryClientEvents(client, NULL, pEvent, numRects,
(Mask)0, NoEventMask, NullGrab);
free(pEvent);
@@ -386,8 +388,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
event.u.noExposure.drawable = drawable;
event.u.noExposure.majorEvent = major;
event.u.noExposure.minorEvent = minor;
- TryClientEvents(client, NULL, &event, 1,
- (Mask)0, NoEventMask, NullGrab);
+ WriteEventsToClient(client, 1, &event);
}
}
--
1.7.0
More information about the xorg-devel
mailing list