static void crVBoxServerReparentMuralCB(unsigned long key, void *data1, void *data2) { CRMuralInfo *pMI = (CRMuralInfo*) data1; int *sIndex = (int*) data2; if (pMI->screenId == *sIndex) { renderspuReparentWindow(pMI->spuWindow); } }
void crServerCheckMuralGeometry(CRMuralInfo *mural) { int tlS, brS, trS, blS; int overlappingScreenCount, primaryS, i; if (!mural->width || !mural->height) return; if (cr_server.screenCount<2 && !cr_server.bForceOffscreenRendering) { CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId]; CRASSERT(cr_server.screenCount>0); mural->hX = mural->gX-cr_server.screen[0].x; mural->hY = mural->gY-cr_server.screen[0].y; cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y); return; } tlS = crServerGetPointScreen(mural->gX, mural->gY); brS = crServerGetPointScreen(mural->gX+mural->width-1, mural->gY+mural->height-1); if (tlS==brS && tlS>=0) { overlappingScreenCount = 1; primaryS = tlS; } else { trS = crServerGetPointScreen(mural->gX+mural->width-1, mural->gY); blS = crServerGetPointScreen(mural->gX, mural->gY+mural->height-1); primaryS = -1; overlappingScreenCount = 0; for (i=0; i<cr_server.screenCount; ++i) { if ((i==tlS) || (i==brS) || (i==trS) || (i==blS) || crServerMuralCoverScreen(mural, i)) { overlappingScreenCount++; primaryS = primaryS<0 ? i:primaryS; } } if (!overlappingScreenCount) { primaryS = 0; } } if (primaryS!=mural->screenId) { mural->screenId = primaryS; renderspuSetWindowId(cr_server.screen[primaryS].winID); renderspuReparentWindow(mural->spuWindow); renderspuSetWindowId(cr_server.screen[0].winID); } mural->hX = mural->gX-cr_server.screen[primaryS].x; mural->hY = mural->gY-cr_server.screen[primaryS].y; if (overlappingScreenCount<2 && !cr_server.bForceOffscreenRendering) { CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId]; if (mural->bUseFBO) { crServerRedirMuralFBO(mural, GL_FALSE); crServerDeleteMuralFBO(mural); } cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y); } else { if (mural->spuWindow) { if (!mural->bUseFBO) { crServerRedirMuralFBO(mural, GL_TRUE); } else { if (mural->width!=mural->fboWidth || mural->height!=mural->height) { crServerRedirMuralFBO(mural, GL_FALSE); crServerDeleteMuralFBO(mural); crServerRedirMuralFBO(mural, GL_TRUE); } } } #ifdef DEBUG_misha else { Assert(!mural->bUseFBO); } #endif if (!mural->bUseFBO) { CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId]; cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y); } } if (mural->pvOutputRedirectInstance) { cr_server.outputRedirect.CRORGeometry(mural->pvOutputRedirectInstance, mural->hX, mural->hY, mural->width, mural->height); } }