[PATCH xf86-video-vmware] Use dixLookupWindow instead of LookupWindow on Xorg 1.5 & later

Jamey Sharp jamey at minilop.net
Wed Sep 28 08:12:34 PDT 2011


Looks sane to me, for whatever that's worth:

Reviewed-by: Jamey Sharp <jamey at minilop.net>

On 9/27/11, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:
> The LookupWindow function was deprecated in xserver commit ed75b056511ccb4
> and removed during the Xorg 1.11 merge window by commit 82a8677d9175732.
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>
> Needed for compatibility with the Xorg 1.11 release - only build tested
> with Xorg 1.11.1, but I tried to preserve compatibility with older releases,
> following the current status quo of this driver, while making it simple to
> drop that when it's no longer needed.
>
>  src/vmwarexinerama.c |   32 ++++++++++++++++++++++++++------
>  1 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/src/vmwarexinerama.c b/src/vmwarexinerama.c
> index 371c7b1..e86df34 100644
> --- a/src/vmwarexinerama.c
> +++ b/src/vmwarexinerama.c
> @@ -46,6 +46,20 @@
>  #ifndef HAVE_XORG_SERVER_1_5_0
>  #include <xf86_ansic.h>
>  #include <xf86_libc.h>
> +
> +/* dixLookupWindow was added in Xorg server 1.5 to replace LookupWindow */
> +#ifndef DixGetAttrAccess
> +# define DixGetAttrAccess   (1<<4)
> +#endif
> +
> +static inline int
> +dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
> +{
> +    *pWin = LookupWindow(stuff->window, client);
> +    if (!*pWin)
> +	return BadWindow;
> +    return Success;
> +}
>  #endif
>
>
> @@ -116,10 +130,12 @@ VMwareXineramaGetState(ClientPtr client)
>      ExtensionEntry *ext;
>      ScrnInfoPtr pScrn;
>      VMWAREPtr pVMWARE;
> +    int rc;
>
>      REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
> -    pWin = LookupWindow(stuff->window, client);
> -    if(!pWin) return BadWindow;
> +    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
> +    if (rc != Success)
> +	return rc;
>
>      if (!(ext = CheckExtension(PANORAMIX_PROTOCOL_NAME))) {
>         return BadMatch;
> @@ -167,10 +183,12 @@ VMwareXineramaGetScreenCount(ClientPtr client)
>      ExtensionEntry *ext;
>      ScrnInfoPtr pScrn;
>      VMWAREPtr pVMWARE;
> +    int rc;
>
>      REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
> -    pWin = LookupWindow(stuff->window, client);
> -    if(!pWin) return BadWindow;
> +    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
> +    if (rc != Success)
> +	return rc;
>
>      if (!(ext = CheckExtension(PANORAMIX_PROTOCOL_NAME))) {
>         return BadMatch;
> @@ -218,10 +236,12 @@ VMwareXineramaGetScreenSize(ClientPtr client)
>      ExtensionEntry *ext;
>      ScrnInfoPtr pScrn;
>      VMWAREPtr pVMWARE;
> +    int rc;
>
>      REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
> -    pWin = LookupWindow (stuff->window, client);
> -    if(!pWin)  return BadWindow;
> +    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
> +    if (rc != Success)
> +	return rc;
>
>      if (!(ext = CheckExtension(PANORAMIX_PROTOCOL_NAME))) {
>         return BadMatch;
> --
> 1.7.3.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list