]> source.dussan.org Git - tigervnc.git/commitdiff
Add support for X.Org 1.13
authorAdam Tkac <atkac@redhat.com>
Wed, 5 Sep 2012 13:29:19 +0000 (13:29 +0000)
committerAdam Tkac <atkac@redhat.com>
Wed, 5 Sep 2012 13:29:19 +0000 (13:29 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4995 3789f03b-4d11-0410-bbf8-ca57d06f2519

unix/xserver/hw/vnc/vncHooks.cc
unix/xserver/hw/vnc/xf86vncModule.cc
unix/xserver/hw/vnc/xorg-version.h
unix/xserver/hw/vnc/xvnc.cc

index c75886c010e646418e185eab1380eda0113abb0e..f99c267ab68dae0c04911f21f289cdea3ba7a7f7 100644 (file)
@@ -118,7 +118,11 @@ static DevPrivateKeyRec vncHooksGCKeyRec;
 
 // 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);
@@ -135,8 +139,13 @@ static Bool vncHooksDisplayCursor(
                                  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, 
@@ -352,7 +361,11 @@ Bool vncHooksInit(ScreenPtr pScreen, XserverDesktop* desktop)
 // 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);
 
@@ -385,7 +398,11 @@ static Bool vncHooksCloseScreen(int i, ScreenPtr pScreen_)
 
   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"
@@ -550,14 +567,27 @@ static Bool vncHooksDisplayCursor(
 // 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);
 
index b1ab2756091cdc5343c2f1cce480dc08cef8fc64..f37600b10ac7f8cfaf6b0f567eb28ffd4f9f051b 100644 (file)
@@ -58,8 +58,10 @@ ExtensionModule vncExt =
 {
     vncExtensionInitWithParams,
     "VNC",
+#if XORG < 112
     NULL,
     NULL,
+#endif
     NULL
 };
 
index 9a2db9370fb155257cb30b180083cc025d183b6c..c1f45d7d95121ea2c8dfe42dfae93d57b62b2f33 100644 (file)
 #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
index fcf7deb56acdba17ebc27789bd5e095183db097d..3b848b2b16d78a6a8e174979f5ed28e1e89c363a 100644 (file)
@@ -285,7 +285,11 @@ OsVendorInit()
 }
 
 void
+#if XORG < 113
 OsVendorFatalError()
+#else
+OsVendorFatalError(const char *f, va_list args)
+#endif
 {
 }
 
@@ -626,14 +630,25 @@ GetTimeInMillis()
 }
 #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 @@ vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
 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 @@ vfbInstallColormap(ColormapPtr pmap)
        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 @@ vfbInstallColormap(ColormapPtr pmap)
 static void
 vfbUninstallColormap(ColormapPtr pmap)
 {
+#if XORG < 113
     ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum];
+#else
+    ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
+#endif
 
     if(pmap == curpmap)
     {
@@ -1314,31 +1345,66 @@ static Bool vncRandRInit(ScreenPtr pScreen)
 #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)
@@ -1346,8 +1412,13 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 
     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();