VirtualBox

Ignore:
Timestamp:
May 7, 2013 8:16:31 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL->Fe/Qt notification mechanism

Location:
trunk/src/VBox/HostServices/SharedOpenGL
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r45148 r45940  
    244244    return rc;
    245245}
     246
     247static DECLCALLBACK(void) svcNotifyEventCB(int32_t screenId, uint32_t uEvent, void*pvData)
     248{
     249    ComPtr<IDisplay> pDisplay;
     250    ComPtr<IFramebuffer> pFramebuffer;
     251    LONG xo, yo;
     252    LONG64 winId = 0;
     253    ULONG monitorCount, i, w, h;
     254
     255    if (!g_pConsole)
     256    {
     257        crWarning("Console not defined!");
     258        return;
     259    }
     260
     261    CHECK_ERROR2_STMT(g_pConsole, COMGETTER(Display)(pDisplay.asOutParam()), return);
     262
     263    CHECK_ERROR2_STMT(pDisplay, GetFramebuffer(screenId, pFramebuffer.asOutParam(), &xo, &yo), return);
     264
     265    if (!pFramebuffer)
     266        return;
     267
     268    CHECK_ERROR2_STMT(pFramebuffer, Notify3DEvent(VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_WINDOW, NULL), return);
     269}
     270
    246271
    247272static DECLCALLBACK(int) svcUnload (void *)
     
    12811306
    12821307            rc = svcPresentFBOInit();
     1308
     1309            crServerVBoxSetNotifyEventCB(svcNotifyEventCB);
    12831310        }
    12841311    }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r45386 r45940  
    129129void crServerCheckMuralGeometry(CRMuralInfo *mural);
    130130GLboolean crServerSupportRedirMuralFBO(void);
     131
     132void crVBoxServerNotifyEvent(int32_t idScreen);
    131133
    132134#define CR_SERVER_REDIR_F_NONE     0x00
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c

    r45577 r45940  
    5858    cr_server.bUseOutputRedirect = GL_FALSE;
    5959    cr_server.bWindowsInitiallyHidden = GL_FALSE;
     60
     61    memset(cr_server.NotifyEventMap, 0, sizeof (cr_server.NotifyEventMap));
     62    cr_server.cDisableEvent = 0;
     63    cr_server.pfnNotifyEventCB = NULL;
    6064}
    6165
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r45635 r45940  
    25742574#define MAPPED(screen) ((screen).winID != 0)
    25752575
     2576extern DECLEXPORT(void) crServerVBoxSetNotifyEventCB(PFNCRSERVERNOTIFYEVENT pfnCb)
     2577{
     2578    cr_server.pfnNotifyEventCB = pfnCb;
     2579}
     2580
     2581void crVBoxServerNotifyEvent(int32_t idScreen)
     2582{
     2583    /* this is something unexpected, but just in case */
     2584    if (idScreen >= cr_server.screenCount)
     2585    {
     2586        crWarning("invalid screen id %d", idScreen);
     2587        return;
     2588    }
     2589
     2590    if (!cr_server.cDisableEvent)
     2591        cr_server.pfnNotifyEventCB(idScreen, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_WINDOW, NULL);
     2592    else
     2593        ASMBitSet(cr_server.NotifyEventMap, idScreen);
     2594}
     2595
    25762596static void crVBoxServerReparentMuralCB(unsigned long key, void *data1, void *data2)
    25772597{
     
    25862606
    25872607        renderspuReparentWindow(pMI->spuWindow);
     2608
     2609        if (pMI->bVisible && (pMI->fPresentMode & CR_SERVER_REDIR_F_DISPLAY))
     2610            crVBoxServerNotifyEvent(pMI->screenId);
    25882611
    25892612        crServerVBoxCompositionDisableLeave(pMI, GL_FALSE);
     
    27222745    uint32_t cRects;
    27232746    const RTRECT *pRects;
    2724     int rc;
     2747    int rc = VINF_SUCCESS;
    27252748
    27262749    fForcePresent = crServerVBoxCompositionPresentNeeded(pMI);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r45920 r45940  
    193193        renderspuReparentWindow(mural->spuWindow);
    194194        renderspuSetWindowId(cr_server.screen[0].winID);
     195
     196        if (mural->bVisible && (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY))
     197            crVBoxServerNotifyEvent(mural->screenId);
    195198    }
    196199
     
    349352        {
    350353            if  (mural->bVisible)
     354            {
    351355                cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_TRUE);
     356                crVBoxServerNotifyEvent(mural->screenId);
     357            }
    352358            mural->fPresentMode |= CR_SERVER_REDIR_F_DISPLAY;
    353359        }
     
    748754DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable)
    749755{
     756    if (!fEnable)
     757        ++cr_server.cDisableEvent;
     758
    750759    crHashtableWalk(cr_server.muralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)fEnable);
    751760
    752761    crHashtableWalk(cr_server.dummyMuralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)fEnable);
     762
     763    if (fEnable)
     764    {
     765        --cr_server.cDisableEvent;
     766        CRASSERT(cr_server.cDisableEvent < UINT32_MAX/2);
     767        if(!cr_server.cDisableEvent)
     768        {
     769            int i;
     770            for (i = 0; i < cr_server.screenCount; ++i)
     771            {
     772                if (!ASMBitTest(cr_server.NotifyEventMap, i))
     773                    continue;
     774
     775                cr_server.pfnNotifyEventCB(i, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_WINDOW, NULL);
     776
     777                ASMBitClear(cr_server.NotifyEventMap, i);
     778            }
     779        }
     780    }
    753781}
    754782
     
    907935        cr_serverCtxSwitchPostprocess(&CtxSwitch);
    908936
     937#if 1
    909938        if (RT_SUCCESS(rc))
    910939        {
     
    916945            }
    917946        }
    918 
     947#endif
    919948        return;
    920949    }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r45636 r45940  
    807807    {
    808808        cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state);
    809     }
    810 
    811     mural->bVisible = state;
     809
     810        if (state)
     811            crVBoxServerNotifyEvent(mural->screenId);
     812    }
     813
     814    mural->bVisible = !!state;
    812815}
    813816
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette