VirtualBox

Changeset 34295 in vbox for trunk


Ignore:
Timestamp:
Nov 23, 2010 4:12:35 PM (14 years ago)
Author:
vboxsync
Message:

crOpenGL/wddm: more strict window info tracking

Location:
trunk/src/VBox/Additions/common/crOpenGL
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/context.c

    r34284 r34295  
    501501{
    502502    RECT rect;
    503     HWND hwnd;
    504 
    505     if (!window->drawable) {
     503
     504    if (!window->drawable || !window->hWnd) {
    506505        *w = *h = 0;
    507506        return;
    508507    }
    509508
    510     hwnd = WindowFromDC( window->drawable );
    511 
    512     if (!hwnd) {
    513         *w = 0;
    514         *h = 0;
    515     }
    516     else {
    517         if (!GetClientRect(hwnd, &rect))
    518         {
    519             crWarning("GetClientRect failed for %p", hwnd);
    520             *w = *h = 0;
    521             return;
    522         }
    523         *w = rect.right - rect.left;
    524         *h = rect.bottom - rect.top;
    525         if (!ClientToScreen( hwnd, (LPPOINT) &rect ))
    526         {
    527             crWarning("ClientToScreen failed for %p", hwnd);
    528             *w = *h = 0;
    529             return;
    530         }
    531         *x = rect.left;
    532         *y = rect.top;
    533     }
     509    if (window->hWnd!=WindowFromDC(window->drawable))
     510    {
     511        crWarning("Window(%i) DC is no longer valid", window->spuWindow);
     512        return;
     513    }
     514
     515    if (!GetClientRect(window->hWnd, &rect))
     516    {
     517        crWarning("GetClientRect failed for %p", window->hWnd);
     518        *w = *h = 0;
     519        return;
     520    }
     521    *w = rect.right - rect.left;
     522    *h = rect.bottom - rect.top;
     523
     524    if (!ClientToScreen( window->hWnd, (LPPOINT) &rect ))
     525    {
     526        crWarning("ClientToScreen failed for %p", window->hWnd);
     527        *w = *h = 0;
     528        return;
     529    }
     530    *x = rect.left;
     531    *y = rect.top;
    534532}
    535533
     
    537535GetWindowTitle( const WindowInfo *window, char *title )
    538536{
    539     HWND hwnd;
    540537    /* XXX - we don't handle recurseUp */
    541     hwnd = WindowFromDC( window->drawable );
    542     if (hwnd)
    543         GetWindowText(hwnd, title, 100);
     538    if (window->hWnd)
     539        GetWindowText(window->hWnd, title, 100);
    544540    else
    545541        title[0] = 0;
     
    558554    // apparently the "window" parameter passed to this
    559555    // function contains the native window information
    560     HWND NATIVEhwnd = WindowFromDC( window->drawable );
     556    HWND NATIVEhwnd = window->hWnd;
     557
     558    if (NATIVEhwnd!=WindowFromDC(window->drawable))
     559    {
     560        crWarning("Window(%i) DC is no longer valid", window->spuWindow);
     561        return;
     562    }
    561563
    562564    // get the native window's height and width
     
    10281030                {
    10291031#ifdef WINDOWS
    1030                         if (!WindowFromDC(context->currentDrawable->drawable))
     1032                        if (context->currentDrawable->hWnd!=WindowFromDC(context->currentDrawable->drawable))
    10311033                        {
    10321034                            crWindowDestroy((GLint)context->currentDrawable->hWnd);
  • trunk/src/VBox/Additions/common/crOpenGL/load.c

    r33988 r34295  
    142142{
    143143#ifdef WINDOWS
    144     if (!WindowFromDC(pWindow->drawable))
     144    if (pWindow->hWnd!=WindowFromDC(pWindow->drawable))
    145145    {
    146146        return false;
     
    197197    if (!stub.currentContext)
    198198        return;
     199
     200#if defined(WINDOWS) && defined(VBOX_WITH_WDDM)
     201    if (stub.bRunningUnderWDDM)
     202        return;
     203#endif
    199204
    200205#if defined(CR_NEWWINTRACK) && !defined(WINDOWS)
     
    657662        int i;
    658663
     664# ifdef VBOX_WITH_WDDM
     665        stub.bRunningUnderWDDM = false;
     666# endif
    659667        /* Apply viewport hack only if we're running under wine */
    660668        if (NULL!=GetModuleHandle("wined3d.dll") || NULL != GetModuleHandle("wined3dwddm.dll"))
     
    726734    }
    727735
     736    if (!stubSystemWindowExist(pWindow))
     737    {
     738        crWindowDestroy((GLint)pWindow->hWnd);
     739        return;
     740    }
     741
     742    stub.spu->dispatch_table.VBoxPackSetInjectID(pWindow->u32ClientID);
     743
    728744    if (!pWindow->mapped)
    729745    {
     
    841857    }
    842858
     859#if defined(WINDOWS) && defined(VBOX_WITH_WDDM)
     860    if (stub.bRunningUnderWDDM)
     861        return;
     862#endif
    843863    stubCheckWindowState(pWindow, GL_TRUE);
    844864}
     
    884904                    crDebug("running with VBoxDispD3D");
    885905                    stub.trackWindowVisibleRgn = 0;
     906                    stub.bRunningUnderWDDM = true;
    886907                }
    887908            }
     
    932953                        crWarning("VBoxDispMpTstCallbacks.pfnGetRegions failed with 0x%x", hr);
    933954                    }
     955                    crHashtableWalk(stub.windowTable, stubSyncTrCheckWindowsCB, NULL);
    934956                }
    935957            }
  • trunk/src/VBox/Additions/common/crOpenGL/stub.c

    r33540 r34295  
    268268
    269269    if (!pWindow) return GL_FALSE;
    270     hwnd = WindowFromDC(pWindow->drawable);
     270    hwnd = pWindow->hWnd;
    271271    if (!hwnd) return GL_FALSE;
    272272
     273    if (hwnd!=WindowFromDC(pWindow->drawable))
     274    {
     275        crWarning("Window(%i) DC is no longer valid", pWindow->spuWindow);
     276        return GL_FALSE;
     277    }
    273278   
    274279    hVisRgn = CreateRectRgn(0,0,0,0);
  • trunk/src/VBox/Additions/common/crOpenGL/stub.h

    r33540 r34295  
    246246    HHOOK           hMessageHook;
    247247# endif
     248# ifdef VBOX_WITH_WDDM
     249    bool            bRunningUnderWDDM;
     250# endif
    248251#endif
    249252
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