VirtualBox

Changeset 28279 in vbox


Ignore:
Timestamp:
Apr 14, 2010 12:52:05 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60022
Message:

crOpenGl;FE/Qt4: added initial 3D support on OSX for the mutli-monitor case (the dock still needs some work)

Location:
trunk/src/VBox
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/UICocoaDockIconPreview.mm

    r27215 r28279  
    5858}
    5959- (id)initWithParent:(UICocoaDockIconPreviewPrivate*)parent;
     60- (void)destroy;
    6061- (NSView*)screenContent;
    6162- (void)cleanup;
     
    8283    inline ~UICocoaDockIconPreviewPrivate()
    8384    {
     85
     86        [mUIDockTile destroy];
    8487        [mUIDockTile release];
    8588    }
     
    246249}
    247250
     251- (void)destroy
     252{
     253    /* Remove all content from the application dock tile. */
     254    [mOverlay removeFromSuperview];
     255    [mOverlay release];
     256    mOverlay = nil;
     257    NSDockTile *dock = [[NSApplication sharedApplication] dockTile];
     258    [dock setContentView: nil];
     259    /* Cleanup all other resources */
     260    [self cleanup];
     261}
     262
    248263- (NSView*)screenContent
    249264{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r28215 r28279  
    314314                CGImageRelease(image);
    315315            }
     316}
     317
     318void UIMachineLogic::updateDockIconSize(int screenId, int width, int height)
     319{
     320    if (!isMachineWindowsCreated())
     321        return;
     322
     323    if (   m_fIsDockIconEnabled
     324        && m_pDockIconPreview
     325        && m_DockIconPreviewMonitor == screenId)
     326        m_pDockIconPreview->setOriginalSize(width, height);
    316327}
    317328#endif /* Q_WS_MAC */
     
    344355    //dbgDestroy();
    345356#endif
    346 
    347 #ifdef Q_WS_MAC
    348     if (m_pDockIconPreview)
    349         delete m_pDockIconPreview;
    350 #endif /* Q_WS_MAC */
    351357}
    352358
     
    608614}
    609615
     616void UIMachineLogic::cleanupMachineWindows()
     617{
     618#ifdef Q_WS_MAC
     619    /* We need to clean up the dock stuff before the machine windows. */
     620    cleanupDock();
     621#endif /* Q_WS_MAC */
     622}
     623
     624#ifdef Q_WS_MAC
     625void UIMachineLogic::cleanupDock()
     626{
     627    if (m_pDockIconPreview)
     628    {
     629        delete m_pDockIconPreview;
     630        m_pDockIconPreview = 0;
     631    }
     632}
     633#endif /* Q_WS_MAC */
     634
    610635void UIMachineLogic::sltMachineStateChanged()
    611636{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r27678 r28279  
    8080#ifdef Q_WS_MAC
    8181    void updateDockIcon();
     82    void updateDockIconSize(int screenId, int width, int height);
    8283#endif /* Q_WS_MAC */
    8384
     
    120121    /* Cleanup helpers: */
    121122    //virtual void cleanupRequiredFeatures() {}
    122 #ifdef Q_WS_MAC
    123     //virtual void cleanupDock() {}
     123    virtual void cleanupMachineWindows();
     124#ifdef Q_WS_MAC
     125    virtual void cleanupDock();
    124126#endif /* Q_WS_MAC */
    125127    //virtual void cleanupActionGroups() {}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r28246 r28279  
    828828
    829829#ifdef Q_WS_MAC
    830             // TODO_NEW_CORE
    831 //            mDockIconPreview->setOriginalSize(pResizeEvent->width(), pResizeEvent->height());
     830            machineLogic()->updateDockIconSize(screenId(), pResizeEvent->width(), pResizeEvent->height());
    832831#endif /* Q_WS_MAC */
    833832
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r27419 r28279  
    210210    if (!isMachineWindowsCreated())
    211211        return;
     212
     213    /* Base class cleanup: */
     214    UIMachineLogic::cleanupMachineWindows();
    212215
    213216    /* Cleanup normal machine window: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r27376 r28279  
    133133        return;
    134134
     135    /* Base class cleanup: */
     136    UIMachineLogic::cleanupMachineWindows();
     137
    135138#ifdef Q_WS_MAC // TODO: Is that really need here?
    136139    /* We have to make sure that we are getting the front most process.
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r27419 r28279  
    199199        return;
    200200
     201    /* Base class cleanup: */
     202    UIMachineLogic::cleanupMachineWindows();
     203
    201204    /* Cleanup normal machine window: */
    202205    foreach (UIMachineWindow *pMachineWindow, machineWindows())
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsDisplay.cpp

    r28210 r28279  
    304304{
    305305    int cVal = mSlMonitors->value();
    306     if (cVal > 1)
    307     {
    308 #ifdef Q_WS_MAC
    309         mCb3D->setChecked(false);
    310 #endif
    311     }
    312306#ifdef VBOX_WITH_VIDEOHWACCEL
    313307    mCb2DVideo->setEnabled(VBoxGlobal::isAcceleration2DVideoAvailable());
    314308#endif /* VBOX_WITH_VIDEOHWACCEL */
    315 #ifdef Q_WS_MAC
    316     mCb3D->setEnabled(cVal == 1 && vboxGlobal().virtualBox().GetHost().GetAcceleration3DAvailable());
    317 #else
    318309    mCb3D->setEnabled(vboxGlobal().virtualBox().GetHost().GetAcceleration3DAvailable());
    319 #endif
    320310
    321311    /* The memory requirements have changed too. */
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r27889 r28279  
    347347    {
    348348        renderspuMakeCurrent(0, 0, pCtx->id);
    349     }   
     349    }
    350350}
    351351
     
    372372            if (pNewCtx!=pOldCtx)
    373373            {
    374                 renderspuMakeCurrent(pOldCtx&&pOldCtx->currentWindow ? pOldCtx->currentWindow->id:0, 0, 
     374                renderspuMakeCurrent(pOldCtx&&pOldCtx->currentWindow ? pOldCtx->currentWindow->id:0, 0,
    375375                                     pOldCtx ? pOldCtx->id:0);
    376376            }
     
    10541054    }
    10551055
    1056 #if defined(WINDOWS) || defined(GLX)
    10571056    renderspu_SystemReparentWindow(pWindow);
    1058 #endif
    10591057}
    10601058
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h

    r27708 r28279  
    311311
    312312extern GLint RENDER_APIENTRY renderspuWindowCreate( const char *dpyName, GLint visBits );
     313extern void RENDER_APIENTRY renderspu_SystemReparentWindow(WindowInfo *window);
    313314extern GLint RENDER_APIENTRY renderspuCreateContext( const char *dpyname, GLint visBits, GLint shareCtx );
    314315extern void RENDER_APIENTRY renderspuMakeCurrent(GLint crWindow, GLint nativeWindow, GLint ctx);
    315316extern void RENDER_APIENTRY renderspuSwapBuffers( GLint window, GLint flags );
    316 
    317 #if defined(WINDOWS) || defined(GLX)
    318 extern void renderspu_SystemReparentWindow(WindowInfo *window);
    319 #endif
    320317
    321318#ifdef __cplusplus
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c

    r24378 r28279  
    428428}
    429429
     430void renderspu_SystemReparentWindow(WindowInfo *)
     431{
     432    /* stub only */
     433}
     434
    430435void
    431436renderspu_SystemDestroyWindow(WindowInfo *window)
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c

    r26229 r28279  
    9696}
    9797
    98 void renderspu_SystemDestroyWindow(WindowInfo *pWinInfo)
    99 {
    100     CRASSERT(pWinInfo);
    101 
    102     cocoaViewDestroy(pWinInfo->window);
    103 }
    104 
    105 void renderspu_SystemWindowPosition(WindowInfo *pWinInfo, GLint x, GLint y)
    106 {
    107     CRASSERT(pWinInfo);
    108 
     98void renderspu_SystemReparentWindow(WindowInfo *pWinInfo)
     99{
    109100#ifdef __LP64__
    110101    NativeViewRef pParentWin = (NativeViewRef)render_spu_parent_window_id;
     
    112103    NativeViewRef pParentWin = (NativeViewRef)(uint32_t)render_spu_parent_window_id;
    113104#endif /* __LP64__ */
     105    cocoaViewReparent(pWinInfo->window, pParentWin);
     106}
     107
     108void renderspu_SystemDestroyWindow(WindowInfo *pWinInfo)
     109{
     110    CRASSERT(pWinInfo);
     111
     112    cocoaViewDestroy(pWinInfo->window);
     113}
     114
     115void renderspu_SystemWindowPosition(WindowInfo *pWinInfo, GLint x, GLint y)
     116{
     117    CRASSERT(pWinInfo);
     118
     119#ifdef __LP64__
     120    NativeViewRef pParentWin = (NativeViewRef)render_spu_parent_window_id;
     121#else /* __LP64__ */
     122    NativeViewRef pParentWin = (NativeViewRef)(uint32_t)render_spu_parent_window_id;
     123#endif /* __LP64__ */
    114124
    115125    cocoaViewSetPosition(pWinInfo->window, pParentWin, x, y);
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h

    r23491 r28279  
    4343/* View management */
    4444void cocoaViewCreate(NativeViewRef *ppView, NativeViewRef pParentView, GLbitfield fVisParams);
     45void cocoaViewReparent(NativeViewRef pView, NativeViewRef pParentView);
    4546void cocoaViewDestroy(NativeViewRef pView);
    4647void cocoaViewDisplay(NativeViewRef pView);
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m

    r25293 r28279  
    138138@private
    139139    NSView          *m_pParentView;
     140    NSWindow        *m_pOverlayWin;
    140141
    141142    NSOpenGLContext *m_pGLCtx;
     
    172173- (void)setGLCtx:(NSOpenGLContext*)pCtx;
    173174- (NSOpenGLContext*)glCtx;
     175
     176- (void)setParentView: (NSView*)view;
     177- (NSView*)parentView;
     178- (void)setOverlayWin: (NSWindow*)win;
     179- (NSWindow*)overlayWin;
    174180
    175181- (void)setPos:(NSPoint)pos;
     
    299305    [self cleanup];
    300306
    301     /* Create a buffer for our thumbnail image. Its in the size of this view. */
    302     m_ThumbBitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
    303         pixelsWide:frame.size.width
    304         pixelsHigh:frame.size.height
    305         bitsPerSample:8
    306         samplesPerPixel:4
    307         hasAlpha:YES
    308         isPlanar:NO
    309         colorSpaceName:NSDeviceRGBColorSpace
    310         bytesPerRow:frame.size.width * 4
    311         bitsPerPixel:8 * 4];
    312     m_ThumbImage = [[NSImage alloc] initWithSize:[m_ThumbBitmap size]];
    313     [m_ThumbImage addRepresentation:m_ThumbBitmap];
     307    if (   frame.size.width > 0
     308        && frame.size.height > 0)
     309    {
     310        /* Create a buffer for our thumbnail image. Its in the size of this view. */
     311        m_ThumbBitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
     312            pixelsWide:frame.size.width
     313            pixelsHigh:frame.size.height
     314            bitsPerSample:8
     315            samplesPerPixel:4
     316            hasAlpha:YES
     317            isPlanar:NO
     318            colorSpaceName:NSDeviceRGBColorSpace
     319            bytesPerRow:frame.size.width * 4
     320            bitsPerPixel:8 * 4];
     321        m_ThumbImage = [[NSImage alloc] initWithSize:[m_ThumbBitmap size]];
     322        [m_ThumbImage addRepresentation:m_ThumbBitmap];
     323    }
    314324    [self unlock];
    315325}
     
    447457        m_pOverlayView = pOverlayView;
    448458        m_Thread = [NSThread currentThread];
     459
     460        [m_pOverlayView setOverlayWin: self];
    449461
    450462        m_pOverlayHelperView = [[OverlayHelperView alloc] initWithOverlayWindow:self];
     
    606618}
    607619
     620- (NSView*)parentView
     621{
     622    return m_pParentView;
     623}
     624
     625- (void)setParentView: (NSView*)view
     626{
     627    m_pParentView = view;
     628}
     629
     630- (void)setOverlayWin: (NSWindow*)win
     631{
     632    m_pOverlayWin = win;
     633}
     634
     635- (NSWindow*)overlayWin
     636{
     637    return m_pOverlayWin;
     638}
     639
    608640- (void)setPos:(NSPoint)pos
    609641{
     
    10261058                [m_DockTileView thumbBitmap] != nil)
    10271059            {
    1028                 /* Only update after atleast 200 ms, cause glReadPixels is
     1060                /* Only update after at least 200 ms, cause glReadPixels is
    10291061                 * heavy performance wise. */
    10301062                uint64_t uiNewTime = RTTimeMilliTS();
     
    13061338}
    13071339
     1340void cocoaViewReparent(NativeViewRef pView, NativeViewRef pParentView)
     1341{
     1342    NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init];
     1343
     1344    OverlayView* pOView = (OverlayView*)pView;
     1345
     1346    if (pOView)
     1347    {
     1348        /* Make sure the window is removed from any previous parent window. */
     1349        [[[pOView overlayWin] parentWindow] removeChildWindow:[pOView overlayWin]];
     1350        /* Set the new parent view */
     1351        [pOView setParentView: pParentView];
     1352        /* Add the overlay window as a child to the new parent window */
     1353        [[pParentView window] addChildWindow:[pOView overlayWin] ordered:NSWindowAbove];
     1354    }
     1355
     1356    [pPool release];
     1357}
     1358
    13081359void cocoaViewDestroy(NativeViewRef pView)
    13091360{
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