[PATCH 7/8] dix: rename ProcessRawEvents to dix/events.c:DeliverRawEvent
walter harms
wharms at bfs.de
Sat May 28 03:03:14 PDT 2011
Am 27.05.2011 07:13, schrieb Peter Hutterer:
> No functional changes, prep work for future changes.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Xi/exevents.c | 31 +------------------------------
> dix/events.c | 29 +++++++++++++++++++++++++++++
> include/dix.h | 5 +++++
> 3 files changed, 35 insertions(+), 30 deletions(-)
>
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index 042ea69..3e3c67b 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -876,35 +876,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
> return DEFAULT;
> }
>
> -static void
> -ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
> -{
> - GrabPtr grab = device->deviceGrab.grab;
> -
> - if (grab)
> - DeliverGrabbedEvent((InternalEvent*)ev, device, FALSE);
> - else { /* deliver to all root windows */
> - xEvent *xi;
> - int i;
> - int filter;
> -
> - i = EventToXI2((InternalEvent*)ev, (xEvent**)&xi);
> - if (i != Success)
> - {
> - ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n",
> - __func__, device->name, i);
> - return;
> - }
> -
> - filter = GetEventFilter(device, xi);
> -
> - for (i = 0; i < screenInfo.numScreens; i++)
> - DeliverEventsToWindow(device, screenInfo.screens[i]->root, xi, 1,
> - filter, NullGrab);
> - free(xi);
> - }
> -}
> -
> /**
> * Main device event processing function.
> * Called from when processing the events from the event queue.
> @@ -932,7 +903,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
> ev->any.type == ET_RawButtonRelease ||
> ev->any.type == ET_RawMotion)
> {
> - ProcessRawEvent(&ev->raw_event, device);
> + DeliverRawEvent(&ev->raw_event, device);
> return;
> }
>
> diff --git a/dix/events.c b/dix/events.c
> index 791441b..f48c7aa 100644
> --- a/dix/events.c
> +++ b/dix/events.c
> @@ -2241,6 +2241,35 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
> return nondeliveries;
> }
>
> +void
> +DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
> +{
> + GrabPtr grab = device->deviceGrab.grab;
> +
> + if (grab)
> + DeliverGrabbedEvent((InternalEvent*)ev, device, FALSE);
> + else { /* deliver to all root windows */
> + xEvent *xi;
> + int i;
> + int filter;
> +
> + i = EventToXI2((InternalEvent*)ev, (xEvent**)&xi);
> + if (i != Success)
> + {
> + ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n",
> + __func__, device->name, i);
> + return;
> + }
to improve readability for me it would be better to use (rc|ret|...) instead of i
int rc;
rc = EventToXI2((InternalEvent*)ev, (xEvent**)&xi);
if (rc != Success)
{
ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n",
__func__, device->name, rc);
return;
}
/* btw;
does EventToXI2() has any useful return code ?
if not it may be better to omit rc at all
*/
just my 2 cents,
re,
wh
> +
> + filter = GetEventFilter(device, xi);
> +
> + for (i = 0; i < screenInfo.numScreens; i++)
> + DeliverEventsToWindow(device, screenInfo.screens[i]->root, xi, 1,
> + filter, NullGrab);
> + free(xi);
> + }
> +}
> +
> /* If the event goes to dontClient, don't send it and return 0. if
> send works, return 1 or if send didn't work, return 2.
> Only works for core events.
> diff --git a/include/dix.h b/include/dix.h
> index 9a111e8..b1bf9ed 100644
> --- a/include/dix.h
> +++ b/include/dix.h
> @@ -387,6 +387,11 @@ extern _X_EXPORT int DeliverEventsToWindow(
> Mask /* filter */,
> GrabPtr /* grab */);
>
> +extern _X_EXPORT void DeliverRawEvent(
> + RawDeviceEvent* /* ev */,
> + DeviceIntPtr /* dev */
> +);
> +
> extern int DeliverDeviceEvents(
> WindowPtr /* pWin */,
> InternalEvent* /* event */,
More information about the xorg-devel
mailing list