summarylogtreecommitdiffstats
path: root/remove-ImplicitPointerConversions.patch
blob: a2b1681787f919100e39a10bb982bb66a4ada57a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
--- 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 <inputstr.h> /* 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 */