VirtualBox

Changeset 28342 in vbox


Ignore:
Timestamp:
Apr 14, 2010 11:33:05 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60101
Message:

crOpenGl;FE/Qt4: more dock work for the 3D parts of the multi-monitor support on OSX (still not finished)

Location:
trunk/src/VBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/UIAbstractDockIconPreview.cpp

    r27215 r28342  
    2222/* VBox includes */
    2323#include "UIAbstractDockIconPreview.h"
     24#include "UIFrameBuffer.h"
     25#include "UIMachineLogic.h"
     26#include "UIMachineView.h"
    2427#include "UISession.h"
    25 #include "UIFrameBuffer.h"
    2628
    2729UIAbstractDockIconPreview::UIAbstractDockIconPreview(UISession * /* pSession */, const QPixmap& /* overlayImage */)
     
    6769    m_stateRestoring = ::darwinToCGImageRef("state_restoring_16px.png");
    6870    Assert(m_stateRestoring);
     71}
     72
     73void* UIAbstractDockIconPreviewHelper::currentPreviewWindowId() const
     74{
     75    /* Get the MachineView which is currently previewed and return the win id
     76       of the viewport. */
     77    UIMachineView* pView = m_pSession->machineLogic()->dockPreviewView();
     78    if (pView)
     79        return (void*)pView->viewport()->winId();
     80    return 0;
    6981}
    7082
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/UIAbstractDockIconPreview.h

    r27215 r28342  
    3131#include "VBoxUtils-darwin.h"
    3232
     33class UIFrameBuffer;
    3334class UISession;
    34 class UIFrameBuffer;
    3535
    3636class QPixmap;
     
    5858    void drawOverlayIcons(CGContextRef context);
    5959
     60    void* currentPreviewWindowId() const;
     61
    6062    /* Flipping is necessary cause the drawing context in Carbon is flipped by 180 degree */
    6163    inline CGRect flipRect(CGRect rect) const { return ::darwinFlipCGRect(rect, m_dockIconRect); }
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/UICocoaDockIconPreview.mm

    r28279 r28342  
    5353
    5454    UIDockTileMonitor *mMonitor;
    55     NSImageView     *mAppIcon;
     55    NSImageView       *mAppIcon;
    5656
    5757    UIDockTileOverlay *mOverlay;
     
    5959- (id)initWithParent:(UICocoaDockIconPreviewPrivate*)parent;
    6060- (void)destroy;
    61 - (NSView*)screenContent;
     61- (NSView*)screenContentWithParentView:(NSView*)parentView;
    6262- (void)cleanup;
    6363- (void)restoreAppIcon;
     
    261261}
    262262
    263 - (NSView*)screenContent
    264 {
    265     return [mMonitor screenContent];
     263- (NSView*)screenContentWithParentView:(NSView*)parentView
     264{
     265    if (mMonitor != nil)
     266    {
     267        void *pId = p->currentPreviewWindowId();
     268        if (parentView == pId)
     269            return [mMonitor screenContent];
     270    }
     271    return nil;
    266272}
    267273
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r28294 r28342  
    268268}
    269269
    270 UIMachineWindow* UIMachineLogic::mainMachineWindow()
     270UIMachineWindow* UIMachineLogic::mainMachineWindow() const
    271271{
    272272    /* Return null if windows are not created yet: */
     
    277277}
    278278
    279 UIMachineWindow* UIMachineLogic::defaultMachineWindow()
     279UIMachineWindow* UIMachineLogic::defaultMachineWindow() const
    280280{
    281281    /* Return null if windows are not created yet: */
     
    325325        && m_DockIconPreviewMonitor == screenId)
    326326        m_pDockIconPreview->setOriginalSize(width, height);
     327}
     328
     329UIMachineView* UIMachineLogic::dockPreviewView() const
     330{
     331    if (   m_fIsDockIconEnabled
     332        && m_pDockIconPreview)
     333        return machineWindows().at(m_DockIconPreviewMonitor)->machineView();
     334    return 0;
    327335}
    328336#endif /* Q_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r28279 r28342  
    4444class UIActionsPool;
    4545class UIMachineWindow;
     46class UIMachineView;
    4647class UIDockIconPreview;
    4748class VBoxChangeDockIconUpdateEvent;
     
    7071    UIActionsPool* actionsPool() const { return m_pActionsPool; }
    7172    UIVisualStateType visualStateType() const { return m_visualStateType; }
    72     QList<UIMachineWindow*>& machineWindows() { return m_machineWindowsList; }
    73     UIMachineWindow* mainMachineWindow();
    74     UIMachineWindow* defaultMachineWindow();
     73    const QList<UIMachineWindow*>& machineWindows() const { return m_machineWindowsList; }
     74    UIMachineWindow* mainMachineWindow() const;
     75    UIMachineWindow* defaultMachineWindow() const;
    7576
    7677    /* Maintenance getters/setters: */
     
    8182    void updateDockIcon();
    8283    void updateDockIconSize(int screenId, int width, int height);
     84    UIMachineView* dockPreviewView() const;
    8385#endif /* Q_WS_MAC */
    8486
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r27768 r28342  
    755755}
    756756
     757UIMachineLogic* UISession::machineLogic() const
     758{
     759    return uimachine()->machineLogic();
     760}
     761
    757762QMenu* UISession::newMenu(UIMainMenuType fOptions /* = UIMainMenuType_ALL */)
    758763{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r27768 r28342  
    4141class UIFrameBuffer;
    4242class UIMachine;
     43class UIMachineLogic;
    4344class UIMachineMenuBar;
    4445
     
    8687    UIActionsPool* actionsPool() const;
    8788    QWidget* mainMachineWindow() const;
     89    UIMachineLogic* machineLogic() const;
    8890    QMenu* newMenu(UIMainMenuType fOptions = UIMainMenuType_All);
    8991    QMenuBar* newMenuBar(UIMainMenuType fOptions = UIMainMenuType_All);
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m

    r28279 r28342  
    12001200    NSView *contentView = [[[NSApplication sharedApplication] dockTile] contentView];
    12011201    NSView *screenContent = nil;
    1202     if ([contentView respondsToSelector:@selector(screenContent)])
     1202    /* First try the new variant which checks if this window is within the
     1203       screen which is previewed in the dock. */
     1204    if ([contentView respondsToSelector:@selector(screenContentWithParentView:)])
     1205         screenContent = [contentView performSelector:@selector(screenContentWithParentView:) withObject:(id)m_pParentView];
     1206    /* If it fails, fall back to the old variant (VBox...) */
     1207    else if ([contentView respondsToSelector:@selector(screenContent)])
    12031208         screenContent = [contentView performSelector:@selector(screenContent)];
    12041209    return screenContent;
     
    12071212- (void)reshapeDockTile
    12081213{
    1209     NSRect dockFrame = [[self dockTileScreen] frame];
    1210     NSRect parentFrame = [m_pParentView frame];
    1211 
    1212     m_FBOThumbScaleX = (float)dockFrame.size.width / parentFrame.size.width;
    1213     m_FBOThumbScaleY = (float)dockFrame.size.height / parentFrame.size.height;
    1214     NSRect newFrame = NSMakeRect ((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_RootShift.y) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY));
     1214    NSView *pView = [self dockTileScreen];
     1215    if (pView != nil)
     1216    {
     1217        NSRect dockFrame = [pView frame];
     1218        NSRect parentFrame = [m_pParentView frame];
     1219
     1220        m_FBOThumbScaleX = (float)dockFrame.size.width / parentFrame.size.width;
     1221        m_FBOThumbScaleY = (float)dockFrame.size.height / parentFrame.size.height;
     1222        NSRect newFrame = NSMakeRect ((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_RootShift.y) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY));
    12151223//    NSRect newFrame = NSMakeRect ((int)roundf(m_Pos.x * m_FBOThumbScaleX), (int)roundf(dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (int)roundf(m_Size.width * m_FBOThumbScaleX), (int)roundf(m_Size.height * m_FBOThumbScaleY));
    12161224//      NSRect newFrame = NSMakeRect ((m_Pos.x * m_FBOThumbScaleX), (dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (m_Size.width * m_FBOThumbScaleX), (m_Size.height * m_FBOThumbScaleY));
    12171225//    printf ("%f %f %f %f - %f %f\n", newFrame.origin.x, newFrame.origin.y, newFrame.size.width, newFrame.size.height, m_Size.height, m_FBOThumbScaleY);
    1218     [m_DockTileView setFrame: newFrame];
     1226        [m_DockTileView setFrame: newFrame];
     1227    }
    12191228}
    12201229
     
    13521361        /* Add the overlay window as a child to the new parent window */
    13531362        [[pParentView window] addChildWindow:[pOView overlayWin] ordered:NSWindowAbove];
     1363        [pOView createFBO];
    13541364    }
    13551365
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