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

Alan Coopersmith alan.coopersmith at oracle.com
Tue Sep 27 19:31:22 PDT 2011


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



More information about the xorg-devel mailing list