Lines Matching refs:window
320 WindowInfo* window = (WindowInfo *)crAlloc(sizeof (*window));
321 if (!window)
327 if (!renderspuWinInit(window, NULL, visBits, id))
330 crFree(window);
334 return window;
337 void renderspuWinTermOnShutdown(WindowInfo *window)
339 renderspuVBoxCompositorSet(window, NULL);
340 renderspuVBoxPresentBlitterCleanup(window);
341 window->BltInfo.Base.id = -1;
342 renderspu_SystemDestroyWindow( window );
360 crWarning("failed to get dummy window");
366 void renderspuWinTerm( WindowInfo *window )
368 if (!renderspuWinIsTermed(window))
375 renderspuWinTermOnShutdown(window);
376 /* check if this window is bound to some ctx. Note: window pointer is already freed here */
377 crHashtableWalk(render_spu.contextTable, renderspuCheckCurrentCtxWindowCB, window);
384 if (pOldWindow == window)
398 void renderspuWinCleanup(WindowInfo *window)
400 renderspuWinTerm( window );
401 RTCritSectDelete(&window->CompositorLock);
404 void renderspuWinDestroy(WindowInfo *window)
406 renderspuWinCleanup(window);
407 crFree(window);
412 WindowInfo *window = (WindowInfo *) crHashtableSearch(render_spu.dummyWindowTable, visBits);
413 if (!window)
415 window = renderspuWinCreate(visBits, -1);
416 if (!window)
422 crHashtableAdd(render_spu.dummyWindowTable, visBits, window);
425 return window;
428 void renderspuPerformMakeCurrent(WindowInfo *window, GLint nativeWindow, ContextInfo *context)
430 if (window && context)
437 context->currentWindow = window;
438 if (!window)
440 crDebug("Render SPU: MakeCurrent invalid window id: %d", window->BltInfo.Base.id);
449 renderspu_SystemMakeCurrent( window, nativeWindow, context );
466 if (window->BltInfo.Base.id == CR_RENDER_DEFAULT_WINDOW_ID && window->mapPending &&
468 /* Window[CR_RENDER_DEFAULT_CONTEXT_ID] is special, it's the default window and normally hidden.
469 * If the mapPending flag is set, then we should now make the window
472 /*renderspu_SystemShowWindow( window, GL_TRUE );*/
473 window->mapPending = GL_FALSE;
475 window->everCurrent = GL_TRUE;
477 else if (!window && !context)
489 window ? window->BltInfo.Base.id : 0,
497 WindowInfo *window = NULL;
506 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, crWindow);
507 if (!window)
509 crWarning("invalid window %d specified", crWindow);
524 if (!context != !window)
526 crWarning("either window %d or context %d are zero", crWindow, ctx);
530 renderspuPerformMakeCurrent(window, nativeWindow, context);
533 GLboolean renderspuWinInitWithVisual( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id )
535 crMemset(window, 0, sizeof (*window));
536 RTCritSectInit(&window->CompositorLock);
537 window->pCompositor = NULL;
539 window->BltInfo.Base.id = id;
541 window->x = render_spu.defaultX;
542 window->y = render_spu.defaultY;
543 window->BltInfo.width = render_spu.defaultWidth;
544 window->BltInfo.height = render_spu.defaultHeight;
546 /* Set window->title, replacing %i with the window ID number */
551 window->title = crAlloc(crStrlen(render_spu.window_title) + 10);
553 window->title[i] = render_spu.window_title[i];
554 k = sprintf(window->title + i, "%d", window->BltInfo.Base.id);
558 for (; (window->title[j] = s[i]) != 0; i++, j++)
562 window->title = crStrdup(render_spu.window_title);
566 window->BltInfo.Base.visualBits = visual->visAttribs;
568 window->cRefs = 1;
571 crDebug("Render SPU: Creating window (visBits=0x%x, id=%d)", visBits, window->BltInfo.Base.id);
573 /* Have GLX/WGL/AGL create the window */
574 if (!renderspu_SystemVBoxCreateWindow( visual, showIt, window ))
576 crWarning( "Render SPU: Couldn't create a window, renderspu_SystemCreateWindow failed" );
580 window->visible = !!showIt;
582 CRASSERT(window->visual == visual);
601 crWarning( "Render SPU: Couldn't create a window, renderspuFindVisual returned NULL" );
606 crDebug("Render SPU: Creating window (visBits=0x%x, id=%d)", visBits, window->BltInfo.Base.id);
608 /* Have GLX/WGL/AGL create the window */
611 crWarning( "Render SPU: Couldn't create a window, renderspu_SystemCreateWindow failed" );
620 WindowInfo *window;
627 crWarning("failed to allocate window id");
635 crWarning("the specified window key %d is in use", id);
641 window = renderspuWinCreate(visBits, id);
643 if (!window)
646 crFree(window);
650 crHashtableAdd(render_spu.windowTable, id, window);
651 return window->BltInfo.Base.id;
668 WindowInfo *window;
676 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
677 if (window) {
678 crDebug("Render SPU: Destroy window (%d)", win);
679 /* since os-specific backend can hold its own reference to the window object (e.g. on OSX),
680 * we need to explicitly issue a window destroy command
682 * the window object itself will remain valid until its ref count reaches zero */
683 renderspuWinTerm( window );
685 /* remove window info from hash table, and free it */
690 crDebug("Render SPU: Attempt to destroy invalid window (%d)", win);
698 WindowInfo *window;
700 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
701 if (window) {
702 if (w != window->BltInfo.width
703 || h != window->BltInfo.height)
705 /* window is resized, compositor data is no longer valid
708 renderspuVBoxCompositorSet( window, NULL);
709 renderspu_SystemWindowSize( window, w, h );
710 window->BltInfo.width = w;
711 window->BltInfo.height = h;
715 WARN(("Render SPU: Attempt to resize invalid window (%d)", win));
724 WindowInfo *window;
726 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
727 if (window) {
728 renderspu_SystemWindowPosition( window, x, y );
729 window->x = x;
730 window->y = y;
733 crDebug("Render SPU: Attempt to move invalid window (%d)", win);
760 WindowInfo *window;
767 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
768 if (window) {
769 renderspu_SystemWindowVisibleRegion( window, cRects, pRects );
772 crWarning("Render SPU: Attempt to set VisibleRegion for invalid window (%d)", win);
779 WindowInfo *window;
781 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
782 if (window) {
784 if (window->nativeWindow) {
785 /* We're rendering back to the native app window instead of the
786 * new window which we (the Render SPU) created earlier.
787 * So, we never want to show the Render SPU's window.
794 // if (window->visible != visible)
796 renderspu_SystemShowWindow( window, visible );
797 window->visible = visible;
801 crDebug("Render SPU: Attempt to hide/show invalid window (%d)", win);
808 WindowInfo *window;
810 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
811 if (window) {
812 if (renderspuVBoxCompositorSet(window, pCompositor))
814 renderspu_SystemVBoxPresentComposition(window, pChangedEntry);
818 crDebug("Render SPU: Attempt to PresentComposition for invalid window (%d)", win);
877 void renderspuVBoxPresentBlitterCleanup( WindowInfo *window )
879 if (!window->pBlitter)
884 const CR_BLITTER_WINDOW * pBltInfo = CrBltMuralGetCurrentInfo(window->pBlitter);
885 if (pBltInfo && pBltInfo->Base.id == window->BltInfo.Base.id)
887 CrBltMuralSetCurrentInfo(window->pBlitter, NULL);
892 CRASSERT(CrBltMuralGetCurrentInfo(window->pBlitter)->Base.id == window->BltInfo.Base.id);
893 CrBltMuralSetCurrentInfo(window->pBlitter, NULL);
894 CrBltTerm(window->pBlitter);
896 window->pBlitter = NULL;
899 PCR_BLITTER renderspuVBoxPresentBlitterGet( WindowInfo *window )
901 PCR_BLITTER pBlitter = window->pBlitter;
907 pBlitter = (PCR_BLITTER)crHashtableSearch(render_spu.blitterTable, window->visual->visAttribs);
944 crHashtableAdd( render_spu.blitterTable, window->visual->visAttribs, pBlitter );
952 window->pBlitter = pBlitter;
955 CrBltMuralSetCurrentInfo(pBlitter, &window->BltInfo);
974 PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData, bool fRedraw )
976 PCR_BLITTER pBlitter = fRedraw ? window->pBlitter : renderspuVBoxPresentBlitterGet(window);
988 PCR_BLITTER renderspuVBoxPresentBlitterEnsureCreated( WindowInfo *window, int32_t i32MakeCurrentUserData )
990 if (!window->pBlitter)
994 pTmpCompositor = renderspuVBoxCompositorAcquire(window);
998 PCR_BLITTER pBlitter = renderspuVBoxPresentBlitterGet( window );
1019 renderspuVBoxCompositorRelease(window);
1026 return window->pBlitter;
1029 void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor,
1033 PCR_BLITTER pBlitter = renderspuVBoxPresentBlitterGetAndEnter(window, i32MakeCurrentUserData, fRedraw);
1039 renderspu_SystemSwapBuffers(window, 0);
1044 GLboolean renderspuVBoxCompositorSet( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor)
1053 if (window->pCompositor == pCompositor && !fEmpty)
1056 rc = RTCritSectEnter(&window->CompositorLock);
1063 fNeedPresent = renderspu_SystemWindowNeedEmptyPresent(window);
1067 window->pCompositor = !fEmpty ? pCompositor : NULL;
1068 RTCritSectLeave(&window->CompositorLock);
1081 WindowInfo *window = (WindowInfo *) data1;
1082 renderspuVBoxCompositorSet(window, NULL);
1087 /* we need to clear window compositor, which is not that trivial though,
1088 * since the lock order used in presentation thread is compositor lock() -> hash table lock (aquired for id->window resolution)
1095 const struct VBOXVR_SCR_COMPOSITOR * renderspuVBoxCompositorAcquire( WindowInfo *window)
1097 int rc = RTCritSectEnter(&window->CompositorLock);
1100 const VBOXVR_SCR_COMPOSITOR * pCompositor = window->pCompositor;
1103 Assert(!CrVrScrCompositorIsEmpty(window->pCompositor));
1108 RTCritSectLeave(&window->CompositorLock);
1117 int renderspuVBoxCompositorLock(WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR **ppCompositor)
1119 int rc = RTCritSectEnter(&window->CompositorLock);
1123 *ppCompositor = window->pCompositor;
1130 int renderspuVBoxCompositorUnlock(WindowInfo *window)
1132 int rc = RTCritSectLeave(&window->CompositorLock);
1137 int renderspuVBoxCompositorTryAcquire(WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR **ppCompositor)
1139 int rc = RTCritSectTryEnter(&window->CompositorLock);
1142 *ppCompositor = window->pCompositor;
1145 Assert(!CrVrScrCompositorIsEmpty(window->pCompositor));
1150 RTCritSectLeave(&window->CompositorLock);
1160 void renderspuVBoxCompositorRelease( WindowInfo *window)
1163 Assert(window->pCompositor);
1164 Assert(!CrVrScrCompositorIsEmpty(window->pCompositor));
1165 rc = RTCritSectLeave(&window->CompositorLock);
1174 * Set the current raster position to the given window coordinate.
1194 /* set the raster (window) position */
1210 * Draw the mouse pointer bitmap at (x,y) in window coords.
1297 void RENDER_APIENTRY renderspuSwapBuffers( GLint window, GLint flags )
1299 WindowInfo *w = (WindowInfo *) crHashtableSearch(render_spu.windowTable, window);
1303 crDebug("Render SPU: SwapBuffers invalid window id: %d", window);
1614 * NOTE: we can only resize the default (id=CR_RENDER_DEFAULT_WINDOW_ID) window!!!
1618 WindowInfo *window;
1624 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, CR_RENDER_DEFAULT_WINDOW_ID);
1625 if (window)
1627 renderspu_SystemWindowSize(window, w, h);
1656 WindowInfo *window;
1661 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, index);
1662 if (window)
1664 renderspu_SystemGetWindowGeometry(window, &x, &y, &w, &h);
1671 /* return window position, as a screen coordinate */
1675 WindowInfo *window;
1680 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, index);
1681 if (window)
1683 renderspu_SystemGetWindowGeometry(window, &x, &y, &w, &h);
1684 pos[0] = x;/*window->x;*/
1685 pos[1] = y;/*window->y;*/
1692 WindowInfo *window;
1696 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, index);
1697 if (window)
1699 renderspu_SystemGetMaxWindowSize(window, maxSize + 0, maxSize + 1);
1706 WindowInfo *window;
1711 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, index);
1712 if (window)
1714 vis[0] = window->visible;
1735 WindowInfo *window = context->currentWindow;
1738 renderspu_SystemGetWindowGeometry(window, &x, &y, &w, &h);
1848 DECLEXPORT(void) renderspuReparentWindow(GLint window)
1851 CRASSERT(window >= 0);
1853 pWindow = (WindowInfo *) crHashtableSearch(render_spu.windowTable, window);
1857 crDebug("Render SPU: Attempt to reparent invalid window (%d)", window);
1864 if (window == CR_RENDER_DEFAULT_WINDOW_ID)