summaryrefslogtreecommitdiff
path: root/community/tigervnc/xorg113.patch
blob: 505e0a758375b77722cd7c61674395b88d37162d (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
diff -ur tigervnc-1.2.0.orig/unix/xserver/hw/vnc/vncHooks.cc tigervnc-1.2.0/unix/xserver/hw/vnc/vncHooks.cc
--- tigervnc-1.2.0.orig/unix/xserver/hw/vnc/vncHooks.cc	2012-01-23 16:54:11.000000000 +0100
+++ tigervnc-1.2.0/unix/xserver/hw/vnc/vncHooks.cc	2012-09-06 18:53:26.392282102 +0200
@@ -116,7 +116,11 @@
 
 // screen functions
 
+#if XORG < 112
 static Bool vncHooksCloseScreen(int i, ScreenPtr pScreen);
+#else
+static Bool vncHooksCloseScreen(ScreenPtr pScreen);
+#endif
 static Bool vncHooksCreateGC(GCPtr pGC);
 static void vncHooksCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
                                RegionPtr pOldRegion);
@@ -133,8 +137,13 @@
 				  DeviceIntPtr pDev,
 #endif
 				  ScreenPtr pScreen, CursorPtr cursor);
+#if XORG < 112
 static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
                                  pointer pReadmask);
+#else
+static void vncHooksBlockHandler(ScreenPtr pScreen, pointer pTimeout,
+                                 pointer pReadmask);
+#endif
 #ifdef RENDER
 static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, 
 			      PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, 
@@ -335,7 +344,11 @@
 // CloseScreen - unwrap the screen functions and call the original CloseScreen
 // function
 
+#if XORG < 112
 static Bool vncHooksCloseScreen(int i, ScreenPtr pScreen_)
+#else
+static Bool vncHooksCloseScreen(ScreenPtr pScreen_)
+#endif
 {
   SCREEN_UNWRAP(pScreen_, CloseScreen);
 
@@ -366,7 +379,11 @@
 
   DBGPRINT((stderr,"vncHooksCloseScreen: unwrapped screen functions\n"));
 
+#if XORG < 112
   return (*pScreen->CloseScreen)(i, pScreen);
+#else
+  return (*pScreen->CloseScreen)(pScreen);
+#endif
 }
 
 // CreateGC - wrap the "GC funcs"
@@ -531,14 +548,27 @@
 // BlockHandler - ignore any changes during the block handler - it's likely
 // these are just drawing the cursor.
 
+#if XORG < 112
 static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
                                  pointer pReadmask)
+#else
+static void vncHooksBlockHandler(ScreenPtr pScreen_, pointer pTimeout,
+                                 pointer pReadmask)
+#endif
 {
+#if XORG < 112
   SCREEN_UNWRAP(screenInfo.screens[i], BlockHandler);
+#else
+  SCREEN_UNWRAP(pScreen_, BlockHandler);
+#endif
 
   vncHooksScreen->desktop->ignoreHooks(true);
 
+#if XORG < 112
   (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+#else
+  (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
+#endif
 
   vncHooksScreen->desktop->ignoreHooks(false);
 
diff -ur tigervnc-1.2.0.orig/unix/xserver/hw/vnc/xf86vncModule.cc tigervnc-1.2.0/unix/xserver/hw/vnc/xf86vncModule.cc
--- tigervnc-1.2.0.orig/unix/xserver/hw/vnc/xf86vncModule.cc	2012-09-06 18:52:54.668284962 +0200
+++ tigervnc-1.2.0/unix/xserver/hw/vnc/xf86vncModule.cc	2012-09-06 18:53:26.393282091 +0200
@@ -53,8 +53,10 @@
 {
     vncExtensionInitWithParams,
     "VNC",
+#if XORG < 112
     NULL,
     NULL,
+#endif
     NULL
 };
 
diff -ur tigervnc-1.2.0.orig/unix/xserver/hw/vnc/xorg-version.h tigervnc-1.2.0/unix/xserver/hw/vnc/xorg-version.h
--- tigervnc-1.2.0.orig/unix/xserver/hw/vnc/xorg-version.h	2012-09-06 18:52:54.669284923 +0200
+++ tigervnc-1.2.0/unix/xserver/hw/vnc/xorg-version.h	2012-09-06 18:53:26.393282091 +0200
@@ -40,8 +40,10 @@
 #define XORG 111
 #elif XORG_VERSION_CURRENT < ((1 * 10000000) + (12 * 100000) + (99 * 1000))
 #define XORG 112
+#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (13 * 100000) + (99 * 1000))
+#define XORG 113
 #else
-#error "X.Org newer than 1.10 is not supported"
+#error "X.Org newer than 1.13 is not supported"
 #endif
 
 #endif
diff -ur tigervnc-1.2.0.orig/unix/xserver/hw/vnc/xvnc.cc tigervnc-1.2.0/unix/xserver/hw/vnc/xvnc.cc
--- tigervnc-1.2.0.orig/unix/xserver/hw/vnc/xvnc.cc	2012-09-06 18:52:51.896283812 +0200
+++ tigervnc-1.2.0/unix/xserver/hw/vnc/xvnc.cc	2012-09-06 18:59:25.784263082 +0200
@@ -285,7 +285,11 @@
 }
 
 void
+#if XORG < 113
 OsVendorFatalError()
+#else
+OsVendorFatalError(const char *f, va_list args)
+#endif
 {
 }
 
@@ -626,14 +630,25 @@
 }
 #endif
 
+#if XORG < 113
 static ColormapPtr InstalledMaps[MAXSCREENS];
+#else
+static DevPrivateKeyRec cmapScrPrivateKeyRec;
+#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
+#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
+#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
+#endif
 
 static int 
 vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
 {
     /* By the time we are processing requests, we can guarantee that there
      * is always a colormap installed */
+#if XORG < 113
     *pmaps = InstalledMaps[pScreen->myNum]->mid;
+#else
+    *pmaps = GetInstalledColormap(pScreen)->mid;
+#endif
     return (1);
 }
 
@@ -641,8 +656,16 @@
 static void 
 vfbInstallColormap(ColormapPtr pmap)
 {
+#if XORG < 113
     int index = pmap->pScreen->myNum;
-    ColormapPtr oldpmap = InstalledMaps[index];
+#endif
+    ColormapPtr oldpmap;
+
+#if XORG < 113
+    oldpmap = InstalledMaps[index];
+#else
+    oldpmap = GetInstalledColormap(pmap->pScreen);
+#endif
 
     if (pmap != oldpmap)
     {
@@ -656,7 +679,11 @@
 	if(oldpmap != (ColormapPtr)None)
 	    WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
 	/* Install pmap */
+#if XORG < 113
 	InstalledMaps[index] = pmap;
+#else
+	SetInstalledColormap(pmap->pScreen, pmap);
+#endif
 	WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
 
 	entries = pmap->pVisual->ColormapEntries;
@@ -692,7 +719,11 @@
 static void
 vfbUninstallColormap(ColormapPtr pmap)
 {
+#if XORG < 113
     ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum];
+#else
+    ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
+#endif
 
     if(pmap == curpmap)
     {
@@ -1153,31 +1184,66 @@
 #endif
 
 static Bool
+#if XORG < 113
 vfbCloseScreen(int index, ScreenPtr pScreen)
+#else
+vfbCloseScreen(ScreenPtr pScreen)
+#endif
 {
+#if XORG < 113
     vfbScreenInfoPtr pvfb = &vfbScreens[index];
+#else
+    vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
+#endif
     int i;
  
     pScreen->CloseScreen = pvfb->closeScreen;
 
     /*
      * XXX probably lots of stuff to clean.  For now,
-     * clear InstalledMaps[] so that server reset works correctly.
+     * clear installed colormaps so that server reset works correctly.
      */
+#if XORG < 113
     for (i = 0; i < MAXSCREENS; i++)
 	InstalledMaps[i] = NULL;
 
     return pScreen->CloseScreen(index, pScreen);
+#else
+    for (i = 0; i < screenInfo.numScreens; i++)
+	SetInstalledColormap(screenInfo.screens[i], NULL);
+
+    /*
+     * fb overwrites miCloseScreen, so do this here
+     */
+    if (pScreen->devPrivate)
+        (*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate);
+    pScreen->devPrivate = NULL;
+
+    return pScreen->CloseScreen(pScreen);
+#endif
 }
 
 static Bool
+#if XORG < 113
 vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+#else
+vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
+#endif
 {
+#if XORG < 113
     vfbScreenInfoPtr pvfb = &vfbScreens[index];
+#else
+    vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
+#endif
     int dpi;
     int ret;
     void *pbits;
 
+#if XORG >= 113
+    if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
+	return FALSE;
+#endif
+
     /* 96 is the default used by most other systems */
     dpi = 96;
     if (monitorResolution)
@@ -1185,8 +1251,13 @@
 
     pbits = vfbAllocateFramebufferMemory(&pvfb->fb);
     if (!pbits) return FALSE;
+#if XORG < 113
     vncFbptr[index] = pbits;
     vncFbstride[index] = pvfb->fb.paddedWidth;
+#else
+    vncFbptr[pScreen->myNum] = pbits;
+    vncFbstride[pScreen->myNum] = pvfb->fb.paddedWidth;
+#endif
 
     miSetPixmapDepths();