src/vmwarectrl.c
static Bool
VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
                        xXineramaScreenInfo *extents,
                        unsigned long number)
{
   VMWAREPtr pVMWARE = VMWAREPTR(pScrn);

   if (pVMWARE && pVMWARE->xinerama) { 
      VMWAREXineramaPtr xineramaState;
      short maxX = 0;
      short maxY = 0;
      size_t i;

      if (pVMWARE->xineramaNextState) {
         VmwareLog(("DoSetTopology: Aborting due to existing pending state\n"));
         return TRUE;
      }

      for (i = 0; i < number; i++) {
         maxX = MAX(maxX, extents[i].x_org + extents[i].width);
         maxY = MAX(maxY, extents[i].y_org + extents[i].height);
      }

      VmwareLog(("DoSetTopology: %d %d\n", maxX, maxY));

      xineramaState = (VMWAREXineramaPtr)calloc(number, sizeof(VMWAREXineramaRec));
      if (xineramaState) {
         memcpy(xineramaState, extents, number * sizeof (VMWAREXineramaRec));

         /*
          * Make this the new pending Xinerama state. Normally we'll
          * wait until the next mode switch in order to synchronously
          * push this state out to X clients and the virtual hardware.
          *
          * However, if we're already in the right video mode, there
          * will be no mode change. In this case, push it out
          * immediately.
          */
         free(pVMWARE->xineramaNextState);
         pVMWARE->xineramaNextState = xineramaState;
         pVMWARE->xineramaNextNumOutputs = number;

         if (maxX == pVMWARE->ModeReg.svga_reg_width &&
             maxY == pVMWARE->ModeReg.svga_reg_height) {

	    /*
	     * The annoyance here is that when we reprogram the
	     * SVGA device's monitor topology registers, it may
	     * rearrange those monitors on the host's screen, but they
	     * will still have the old contents. This might be
	     * correct, but it isn't guaranteed to match what's on X's
	     * framebuffer at the moment. So we'll send a
	     * full-framebuffer update rect afterwards.
	     */

            vmwareNextXineramaState(pVMWARE);
#ifdef HAVE_XORG_SERVER_1_2_0
            RRSendConfigNotify(pScrn->pScreen);
#endif
            vmwareSendSVGACmdUpdateFullScreen(pVMWARE);

            return TRUE;
         } else {
            return VMwareCtrlDoSetRes(pScrn, maxX, maxY, FALSE);
         }

      } else {
         return FALSE;
      }
   } else {
      return FALSE;
   }
}
/*
 *----------------------------------------------------------------------------
 *
 * VMwareCtrlDoSetTopology --
 *
 *      Set the custom topology and set a dynamic mode to the bounding box
 *      of the passed topology. If a topology is already pending, then do
 *      nothing but do not return failure.
 *
 * Results:
 *      TRUE on success, FALSE otherwise.
 *
 * Side effects:
 *      One dynamic mode and the pending xinerama state will be updated if
 *      successful.
 *
 *----------------------------------------------------------------------------
 */
VMwareCtrlDoSetTopology
Set the custom topology and set a dynamic mode to the bounding box
of the passed topology. If a topology is already pending, then do
nothing but do not return failure.

TRUE on success, FALSE otherwise.

Side effects:
One dynamic mode and the pending xinerama state will be updated if
successful.
VMwareCtrlDoSetTopology Set the custom topology and set a dynamic mode to the bounding box of the passed topology . If a topology is already pending then do nothing but do not return failure . TRUE on success FALSE otherwise . Side effects : One dynamic mode and the pending xinerama state will be updated if successful .
static Bool
VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
                        xXineramaScreenInfo *extents,
                        unsigned long number)
{
   VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
   if (pVMWARE && pVMWARE->xinerama) { 
      VMWAREXineramaPtr xineramaState;
      short maxX = 0;
      short maxY = 0;
      size_t i;
      if (pVMWARE->xineramaNextState) {
         VmwareLog(("DoSetTopology: Aborting due to existing pending state\n"));
         return TRUE;
      }
      for (i = 0; i < number; i++) {
         maxX = MAX(maxX, extents[i].x_org + extents[i].width);
         maxY = MAX(maxY, extents[i].y_org + extents[i].height);
      }
      VmwareLog(("DoSetTopology: %d %d\n", maxX, maxY));
      xineramaState = (VMWAREXineramaPtr)calloc(number, sizeof(VMWAREXineramaRec));
      if (xineramaState) {
         memcpy(xineramaState, extents, number * sizeof (VMWAREXineramaRec));
         free(pVMWARE->xineramaNextState);
         pVMWARE->xineramaNextState = xineramaState;
         pVMWARE->xineramaNextNumOutputs = number;
         if (maxX == pVMWARE->ModeReg.svga_reg_width &&
             maxY == pVMWARE->ModeReg.svga_reg_height) {
            vmwareNextXineramaState(pVMWARE);
#ifdef HAVE_XORG_SERVER_1_2_0
            RRSendConfigNotify(pScrn->pScreen);
#endif
            vmwareSendSVGACmdUpdateFullScreen(pVMWARE);
            return TRUE;
         } else {
            return VMwareCtrlDoSetRes(pScrn, maxX, maxY, FALSE);
         }
      } else {
         return FALSE;
      }
   } else {
      return FALSE;
   }
}
static Bool VMwareCtrlDoSetTopology ( ScrnInfoPtr pScrn , xXineramaScreenInfo * extents , unsigned long number ) { VMWAREPtr pVMWARE = VMWAREPTR ( pScrn ) ; if ( pVMWARE && pVMWARE -> xinerama ) { VMWAREXineramaPtr xineramaState ; short maxX = 0 ; short maxY = 0 ; size_t i ; if ( pVMWARE -> xineramaNextState ) { VmwareLog ( ( " \n " ) ) ; return TRUE ; } for ( i = 0 ; i < number ; i ++ ) { maxX = MAX ( maxX , extents [ i ] . x_org + extents [ i ] . width ) ; maxY = MAX ( maxY , extents [ i ] . y_org + extents [ i ] . height ) ; } VmwareLog ( ( " \n " , maxX , maxY ) ) ; xineramaState = ( VMWAREXineramaPtr ) calloc ( number , sizeof ( VMWAREXineramaRec ) ) ; if ( xineramaState ) { memcpy ( xineramaState , extents , number * sizeof ( VMWAREXineramaRec ) ) ; free ( pVMWARE -> xineramaNextState ) ; pVMWARE -> xineramaNextState = xineramaState ; pVMWARE -> xineramaNextNumOutputs = number ; if ( maxX == pVMWARE -> ModeReg . svga_reg_width && maxY == pVMWARE -> ModeReg . svga_reg_height ) { vmwareNextXineramaState ( pVMWARE ) ; #ifdef HAVE_XORG_SERVER_1_2_0 RRSendConfigNotify ( pScrn -> pScreen ) ; #endif vmwareSendSVGACmdUpdateFullScreen ( pVMWARE ) ; return TRUE ; } else { return VMwareCtrlDoSetRes ( pScrn , maxX , maxY , FALSE ) ; } } else { return FALSE ; } } else { return FALSE ; } }
VMwareCtrlDoSetTopology
      Set the custom topology and set a dynamic mode to the bounding box
      of the passed topology.
VMwareCtrlDoSetTopology Set the custom topology and set a dynamic mode to the bounding box of the passed topology .
/*
          * Make this the new pending Xinerama state. Normally we'll
          * wait until the next mode switch in order to synchronously
          * push this state out to X clients and the virtual hardware.
          *
          * However, if we're already in the right video mode, there
          * will be no mode change. In this case, push it out
          * immediately.
          */ /*
	     * The annoyance here is that when we reprogram the
	     * SVGA device's monitor topology registers, it may
	     * rearrange those monitors on the host's screen, but they
	     * will still have the old contents. This might be
	     * correct, but it isn't guaranteed to match what's on X's
	     * framebuffer at the moment. So we'll send a
	     * full-framebuffer update rect afterwards.
	     */