--- a/src/sis_mergedfb.c +++ b/src/sis_mergedfb.c @@ -47,6 +47,30 @@ #include "windowstr.h" #endif +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 5 +#include /* for inputInfo */ +#endif + +/* + * LookupWindow was removed with video abi 11. + */ +#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4) +#ifndef DixGetAttrAccess +#define DixGetAttrAccess (1<<4) +#endif +#endif + +#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 2) +static inline int +dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) +{ + *pWin = LookupWindow(id, client); + if (!*pWin) + return BadWindow; + return Success; +} +#endif + void SiSMFBInitMergedFB(ScrnInfoPtr pScrn); void SiSMFBHandleModesCRT2(ScrnInfoPtr pScrn, ClockRangePtr clockRanges); void SiSMFBMakeModeList(ScrnInfoPtr pScrn); @@ -2488,10 +2512,12 @@ WindowPtr pWin; xPanoramiXGetStateReply rep; register int n; + 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; rep.type = X_Reply; rep.length = 0; @@ -2515,8 +2541,8 @@ register int n; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - pWin = LookupWindow(stuff->window, client); - if(!pWin) return BadWindow; + if(Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess)) + return BadWindow; rep.type = X_Reply; rep.length = 0; @@ -2540,8 +2566,8 @@ register int n; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - pWin = LookupWindow (stuff->window, client); - if(!pWin) return BadWindow; + if(Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess)) + return BadWindow; rep.type = X_Reply; rep.length = 0; @@ -2631,26 +2657,21 @@ int lookup_ret; REQUEST_SIZE_MATCH(xXineramaSelectInputReq); - /*IvansLee define NEW_XORG_VERSION.*/ - #if NEW_XORG_VERSION == 1 - pWin = SecurityLookupWindow(stuff->window,client,DixWriteAccess); - #else - pWin = SecurityLookupWindow(stuff->window,client,SecurityWriteAccess); - #endif - - if(!pWin) - return BadWindow; + int rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return BadWindow; + #if NEW_XORG_VERSION == 1 /*New Xorg Version >= 1.4 */ - lookup_ret = dixLookupResourceByType((pointer) &pHead, - pWin->drawable.id, EventType, - client, DixWriteAccess); - pHead = (lookup_ret == Success ? pHead : NULL); + lookup_ret = dixLookupResourceByType((pointer) &pHead, + pWin->drawable.id, EventType, + client, DixWriteAccess); + pHead = (lookup_ret == Success ? pHead : NULL); #else pHead = (SiSXineramaEventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, EventType, SecurityWriteAccess); #endif - + if(stuff->enable & (XineramaLayoutChangeNotifyMask)) { /* Check for existing entry */