[PATCH v2 3/12] Xi: Add support for confine_to on XI 2.1 XIPassiveGrab requests.
Jeremy Huddleston
jeremyhu at gmail.com
Thu Jun 2 21:19:16 PDT 2011
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
I'll review 5+ later ...
Sent from my iPhone...
On Jun 2, 2011, at 22:45, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Changes to v1:
> - use get_confine_to instead of in-place byte offset calculation
>
> Xi/xigrabdev.c | 2 +-
> Xi/xigrabdev.h | 2 ++
> Xi/xipassivegrab.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 43 insertions(+), 1 deletions(-)
>
> diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
> index ca72026..b504630 100644
> --- a/Xi/xigrabdev.c
> +++ b/Xi/xigrabdev.c
> @@ -58,7 +58,7 @@ get_confine_to(xXIGrabDeviceReq *req)
> return (Window*)data;
> }
>
> -static Bool
> +Bool
> HasConfineTo(ClientPtr client)
> {
> XIClientPtr pXIClient;
> diff --git a/Xi/xigrabdev.h b/Xi/xigrabdev.h
> index 08309c9..2f74788 100644
> --- a/Xi/xigrabdev.h
> +++ b/Xi/xigrabdev.h
> @@ -38,4 +38,6 @@ int SProcXIUngrabDevice(ClientPtr client);
>
> void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep);
>
> +Bool HasConfineTo(ClientPtr client);
> +
> #endif /* XIGRABDEV_H */
> diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
> index ae43433..caffc66 100644
> --- a/Xi/xipassivegrab.c
> +++ b/Xi/xipassivegrab.c
> @@ -45,6 +45,23 @@
> #include "dixgrabs.h"
> #include "misc.h"
>
> +#include "xigrabdev.h" /* HasConfineTo */
> +
> +/**
> + * The confine_to window in XI2.1 trails the request. It is the first 4
> + * bytes after the fixed request + the mask bytes + modifier bytes.
> + * Mask and modifiers are both in 4-byte units.
> + *
> + * @return A pointer to the 4 bytes that represent the confine_to on the
> + * wire.
> + */
> +static Window*
> +get_confine_to(const xXIPassiveGrabDeviceReq *req)
> +{
> + char *data = (char*)&req[1] + req->mask_len * 4 + req->num_modifiers * 4;
> + return (Window*)data;
> +}
> +
> int
> SProcXIPassiveGrabDevice(ClientPtr client)
> {
> @@ -60,6 +77,10 @@ SProcXIPassiveGrabDevice(ClientPtr client)
> swapl(&stuff->cursor, n);
> swapl(&stuff->time, n);
> swapl(&stuff->detail, n);
> +
> + if(HasConfineTo(client) == TRUE)
> + swapl(get_confine_to(stuff), n);
> +
> swaps(&stuff->mask_len, n);
> swaps(&stuff->num_modifiers, n);
>
> @@ -89,6 +110,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
> void *tmp;
> int mask_len;
> int n;
> + Window confine_to;
>
> REQUEST(xXIPassiveGrabDeviceReq);
> REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
> @@ -160,6 +182,24 @@ ProcXIPassiveGrabDevice(ClientPtr client)
> if (status != Success)
> return status;
>
> + /* If the client has version 2_1 or higher, it will send the confine_to window
> + * at the end of the request */
> + confine_to = None;
> +
> + if(HasConfineTo(client) == TRUE) {
> + Window *wire_confine_to = get_confine_to(stuff);
> + confine_to = *wire_confine_to;
> + }
> +
> + if (confine_to != None)
> + {
> + status = dixLookupWindow((WindowPtr*)&tmp, confine_to, client, DixSetAttrAccess);
> + if (status != Success)
> + return status;
> + }
> +
> + param.confineTo = confine_to;
> +
> status = CheckGrabValues(client, ¶m);
> if (status != Success)
> return status;
> --
> 1.7.5.1
>
More information about the xorg-devel
mailing list